setup: always create a support dir and populate it with a site-packages and add same to the PYTHONPATH, just in case someone is going to do "build", "develop", or "test" or something else which triggers a build
I think there must be a much better solution for this -- probably to fix setuptools #54 and ship our own fork of setuptools and rely on it.
This commit is contained in:
parent
d3b78d86ca
commit
20127ffdf5
34
setup.py
34
setup.py
|
@ -22,27 +22,14 @@ def pylibdir(prefixdir):
|
||||||
basedir = os.path.dirname(os.path.abspath(__file__))
|
basedir = os.path.dirname(os.path.abspath(__file__))
|
||||||
supportlib = pylibdir(os.path.join(basedir, "support"))
|
supportlib = pylibdir(os.path.join(basedir, "support"))
|
||||||
|
|
||||||
|
prefixdirs = [] # argh! horrible kludge to work-around setuptools #54
|
||||||
for i in range(len(sys.argv)):
|
for i in range(len(sys.argv)):
|
||||||
arg = sys.argv[i]
|
arg = sys.argv[i]
|
||||||
prefixdir = None
|
|
||||||
if arg.startswith("--prefix="):
|
if arg.startswith("--prefix="):
|
||||||
prefixdir = arg[len("--prefix="):]
|
prefixdirs.append(arg[len("--prefix="):])
|
||||||
if arg == "--prefix":
|
if arg == "--prefix":
|
||||||
if len(sys.argv) > i+1:
|
if len(sys.argv) > i+1:
|
||||||
prefixdir = sys.argv[i+1]
|
prefixdirs.append(sys.argv[i+1])
|
||||||
|
|
||||||
if prefixdir:
|
|
||||||
libdir = pylibdir(prefixdir)
|
|
||||||
try:
|
|
||||||
os.makedirs(libdir)
|
|
||||||
except EnvironmentError, le:
|
|
||||||
# Okay, maybe the dir was already there.
|
|
||||||
pass
|
|
||||||
sys.path.append(libdir)
|
|
||||||
pp = os.environ.get('PYTHONPATH','').split(os.pathsep)
|
|
||||||
pp.append(libdir)
|
|
||||||
os.environ['PYTHONPATH'] = os.pathsep.join(pp)
|
|
||||||
|
|
||||||
if arg.startswith("develop") or arg.startswith("build") or arg.startswith("test"): # argh! horrible kludge to workaround setuptools #17
|
if arg.startswith("develop") or arg.startswith("build") or arg.startswith("test"): # argh! horrible kludge to workaround setuptools #17
|
||||||
if sys.platform == "linux2":
|
if sys.platform == "linux2":
|
||||||
|
@ -53,6 +40,21 @@ for i in range(len(sys.argv)):
|
||||||
sd = "/System/Library/Frameworks/Python.framework/Versions/%d.%d/Extras/lib/python" % (sys.version_info[:2])
|
sd = "/System/Library/Frameworks/Python.framework/Versions/%d.%d/Extras/lib/python" % (sys.version_info[:2])
|
||||||
sys.argv.extend(["--site-dirs", sd])
|
sys.argv.extend(["--site-dirs", sd])
|
||||||
|
|
||||||
|
if not prefixdirs:
|
||||||
|
prefixdirs.append("support")
|
||||||
|
|
||||||
|
for prefixdir in prefixdirs:
|
||||||
|
libdir = pylibdir(prefixdir)
|
||||||
|
try:
|
||||||
|
os.makedirs(libdir)
|
||||||
|
except EnvironmentError, le:
|
||||||
|
# Okay, maybe the dir was already there.
|
||||||
|
pass
|
||||||
|
sys.path.append(libdir)
|
||||||
|
pp = os.environ.get('PYTHONPATH','').split(os.pathsep)
|
||||||
|
pp.append(libdir)
|
||||||
|
os.environ['PYTHONPATH'] = os.pathsep.join(pp)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from ez_setup import use_setuptools
|
from ez_setup import use_setuptools
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
Loading…
Reference in New Issue