Skip to content

Commit 142a24f

Browse files
author
Michal Ostrowski
committed
Make setup.py more tolerant of invocation mode.
Without this change, setup.py may be sensitive to whether or not it is referred to with a directory or not: python ./setup.py .... vs python setup.py ....
1 parent 4323ac5 commit 142a24f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

python/setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@
3636

3737
# Optional PySocks support
3838
extras_require = dict(Socks=['PySocks >= 1.5.0'])
39-
40-
base_dir = os.path.relpath(os.path.normpath(os.path.split(__file__)[0]),
41-
os.getcwd())
39+
setup_dir = os.path.split(__file__)[0]
40+
if setup_dir == '':
41+
setup_dir = '.';
42+
base_dir = os.path.relpath(os.path.normpath(setup_dir), os.getcwd())
4243
src_dir = os.path.normpath(os.path.join(base_dir, 'src'))
4344

4445
setup(

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import os.path
2626
import imp
2727

28-
base_dir = os.path.abspath(os.path.split(__file__)[0])
28+
base_dir = os.path.split(os.path.abspath(__file__))[0]
2929

3030
setup = os.path.join(base_dir, "python", "setup.py")
3131
fobj = open(setup)

0 commit comments

Comments
 (0)