Skip to content

Commit 745d8e6

Browse files
Merge remote-tracking branch 'origin/master' into master
2 parents 4affb13 + dda954f commit 745d8e6

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

setup.py

+9-14
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"""RotatingFileHandler replacement with concurrency, gzip and Windows support
99
"""
1010

11+
import io
1112
import os
1213
import sys
1314

@@ -19,7 +20,7 @@
1920
long_description = fh.read()
2021

2122
about = {}
22-
with open(os.path.join(
23+
with io.open(os.path.join(
2324
here, 'src', 'concurrent_log_handler', '__version__.py'), 'r', encoding='utf-8') as fh:
2425
exec(fh.read(), about)
2526

@@ -45,20 +46,14 @@
4546

4647
package_keywords = "logging, windows, linux, unix, rotate, QueueHandler, QueueListener, portalocker"
4748

48-
# noinspection PyBroadException
49-
try:
50-
IS_PY2 = sys.version_info.major == 2
51-
except Exception:
52-
IS_PY2 = True
49+
# https://github.com/Preston-Landers/concurrent-log-handler/issues/28
50+
# If Python 2, don't allow fulfillment with portalocker 2.0 as it won't work
51+
install_requires = [
52+
'portalocker<=1.7.1; python_version < "3"',
53+
'portalocker>=1.4.0; python_version >= "3"',
54+
]
5355

54-
if IS_PY2:
55-
# https://github.com/Preston-Landers/concurrent-log-handler/issues/28
56-
# If Python 2, don't allow fulfillment with portalocker 2.0 as it won't work
57-
install_requires = ['portalocker<=1.7.1']
58-
else:
59-
install_requires = ['portalocker>=1.4.0']
60-
61-
if "win" in sys.platform:
56+
if sys.platform.startswith("win"):
6257
try:
6358
import win32file
6459
except ImportError:

0 commit comments

Comments
 (0)