8000 Merged in jamadden/numpy/issue-21-install-from-git-on-osx (pull reque… · prototype99/numpy@ed5758a · GitHub
[go: up one dir, main page]

Skip to content

Commit ed5758a

Browse files
committed
Merged in jamadden/numpy/issue-21-install-from-git-on-osx (pull request ganesh-k13#3)
Fix ganesh-k13#21. Do some __file__ munging on OS X in setup.py to compensate for symlinks in $TMPDIR
2 parents e06ba67 + 3afef5a commit ed5758a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

setup.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@
3030
else:
3131
import __builtin__ as builtins
3232

33+
if sys.platform == 'darwin' and __file__.startswith('/var'):
34+
# See https://bitbucket.org/pypy/numpy/issues/21. Basically, a pip
35+
# install from a git checkout gets /var and /private/var confused
36+
# on OS X. The former is a symlink to the later, and used as
37+
# $TMPDIR (to which the checkout is copied), and pip
38+
# reads-and-evals this setup.py directly and sets __file__ to
39+
# something underneath $TMPDIR. Meanwhile, when the rest of the
40+
# code is executed by the python interpreter, it gets the complete path
41+
# starting with /private. This confuses numpy.distutils.misc_util:rel_path
42+
# and breaks shared libraries.
43+
# So to fix it, we change our __file__ because it's the least invasive thing to
44+
# do. This should only happen from git checkouts, pip uses a different mechanism
45+
# for tarballs. The OS X filesystem layout is also unlikely to change.
46+
__file__ = '/private' + __file__
3347

3448
CLASSIFIERS = """\
3549
Development Status :: 5 - Production/Stable

0 commit comments

Comments
 (0)
0