From: Zooko O'Whielacronx Date: Thu, 29 Jan 2009 05:56:08 +0000 (-0700) Subject: setup: always create a support dir and populate it with a site-packages and add same... X-Git-Tag: allmydata-tahoe-1.3.0~127 X-Git-Url: https://git.rkrishnan.org/pf/frontends/(%5B%5E?a=commitdiff_plain;h=20127ffdf5aed7fd14c9de31c1a010b6fd6fa5c7;p=tahoe-lafs%2Ftahoe-lafs.git 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. --- diff --git a/setup.py b/setup.py index 7f10422b..54f566f0 100644 --- a/setup.py +++ b/setup.py @@ -22,27 +22,14 @@ def pylibdir(prefixdir): basedir = os.path.dirname(os.path.abspath(__file__)) supportlib = pylibdir(os.path.join(basedir, "support")) - +prefixdirs = [] # argh! horrible kludge to work-around setuptools #54 for i in range(len(sys.argv)): arg = sys.argv[i] - prefixdir = None if arg.startswith("--prefix="): - prefixdir = arg[len("--prefix="):] + prefixdirs.append(arg[len("--prefix="):]) if arg == "--prefix": if len(sys.argv) > i+1: - prefixdir = 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) + prefixdirs.append(sys.argv[i+1]) if arg.startswith("develop") or arg.startswith("build") or arg.startswith("test"): # argh! horrible kludge to workaround setuptools #17 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]) 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: from ez_setup import use_setuptools except ImportError: