diff options
author | rgommers <ralf.gommers@googlemail.com> | 2011-03-04 00:13:08 +0800 |
---|---|---|
committer | rgommers <ralf.gommers@googlemail.com> | 2011-03-04 14:23:44 +0800 |
commit | 13212a5d7919f8668522a8251bea90b3a2b22894 (patch) | |
tree | 2f4e05446b8bc3133b01931cd1489e01cc29f8ac | |
parent | 578cbb489bfad48b1611c4cfd5d89fc6ac9a7ce8 (diff) | |
download | python-numpy-13212a5d7919f8668522a8251bea90b3a2b22894.tar.gz python-numpy-13212a5d7919f8668522a8251bea90b3a2b22894.tar.bz2 python-numpy-13212a5d7919f8668522a8251bea90b3a2b22894.zip |
BUG: fix up setup.py and pavement.py so the binary builds work again.
-rw-r--r-- | pavement.py | 33 | ||||
-rw-r--r-- | release.sh | 3 | ||||
-rwxr-xr-x | setup.py | 28 |
3 files changed, 44 insertions, 20 deletions
diff --git a/pavement.py b/pavement.py index 8537ab175..d3d0f57a6 100644 --- a/pavement.py +++ b/pavement.py @@ -223,7 +223,15 @@ def bdist_superpack(options): os.remove(target) if not os.path.exists(os.path.dirname(target)): os.makedirs(os.path.dirname(target)) - os.rename(source, target) + try: + os.rename(source, target) + except OSError: + # When git is installed on OS X but not under Wine, the name of the + # .exe has "-Unknown" in it instead of the correct git revision. + # Try to fix this here: + revidx = source.index(".dev-") + 5 + gitrev = source[revidx:revidx+7] + os.rename(source.replace(gitrev, "Unknown"), target) bdist_wininst_arch(pyver, 'nosse') copy_bdist("nosse") @@ -390,11 +398,20 @@ def macosx_version(): def mpkg_name(pyver): maj, min = macosx_version()[:2] + # Note that bdist_mpkg breaks this if building a dev version with a git + # commit string attached. make_fullplatcomponents() in + # bdist_mpkg/cmd_bdist_mpkg.py replaces '-' with '_', comment this out if + # needed. return "numpy-%s-py%s-macosx%s.%s.mpkg" % (FULLVERSION, pyver, maj, min) def _build_mpkg(pyver): - ldflags = "-undefined dynamic_lookup -bundle -arch i386 -arch ppc -Wl,-search_paths_first" + # account for differences between Python 2.7.1 versions from python.org + if os.environ.get('MACOSX_DEPLOYMENT_TARGET', None) == "10.6": + ldflags = "-undefined dynamic_lookup -bundle -arch i386 -arch x86_64 -Wl,-search_paths_first" + else: + ldflags = "-undefined dynamic_lookup -bundle -arch i386 -arch ppc -Wl,-search_paths_first" ldflags += " -L%s" % os.path.join(os.path.dirname(__file__), "build") + if pyver == "2.5": sh("CC=gcc-4.0 LDFLAGS='%s' %s setupegg.py bdist_mpkg" % (ldflags, " ".join(MPKG_PYTHON[pyver]))) else: @@ -440,7 +457,6 @@ def _create_dmg(pyver, src_dir, volname=None): sh(" ".join(cmd)) @task -@needs("pdf") @cmdopts([("python-version=", "p", "python version")]) def dmg(options): try: @@ -449,11 +465,17 @@ def dmg(options): pyver = DEFAULT_PYTHON idirs = options.installers.installersdir + # Check if docs exist. If not, say so and quit. + ref = os.path.join(options.doc.destdir_pdf, "reference.pdf") + user = os.path.join(options.doc.destdir_pdf, "userguide.pdf") + if (not os.path.exists(ref)) or (not os.path.exists(user)): + warnings.warn("Docs need to be built first! Can't find them.") + + # Build the mpkg package call_task("clean") _build_mpkg(pyver) macosx_installer_dir = "tools/numpy-macosx-installer" - dmg = os.path.join(macosx_installer_dir, dmg_name(FULLVERSION, pyver)) if os.path.exists(dmg): os.remove(dmg) @@ -474,10 +496,7 @@ def dmg(options): if os.path.exists(pdf_docs): shutil.rmtree(pdf_docs) os.makedirs(pdf_docs) - - user = os.path.join(options.doc.destdir_pdf, "userguide.pdf") shutil.copy(user, os.path.join(pdf_docs, "userguide.pdf")) - ref = os.path.join(options.doc.destdir_pdf, "reference.pdf") shutil.copy(ref, os.path.join(pdf_docs, "reference.pdf")) # Build the dmg diff --git a/release.sh b/release.sh index c7ae6a645..1c75f70fb 100644 --- a/release.sh +++ b/release.sh @@ -5,10 +5,13 @@ # downloads, i.e. two versions for Python 2.7. The Intel 32/64-bit version is # for OS X 10.6+, the other dmg installers are for 10.3+ and are built on 10.5 +# bootstrap needed to ensure we build the docs from the right scipy version paver bootstrap source bootstrap/bin/activate python setupsconsegg.py install +# build docs +paver pdf #------------------------------------------------------------------ # Build tarballs, Windows and 64-bit OS X installers (on OS X 10.6) @@ -94,6 +94,20 @@ if os.path.exists('MANIFEST'): os.remove('MANIFEST') # a lot more robust than what was previously being used. builtins.__NUMPY_SETUP__ = True +# Construct full version info. Needs to be in setup.py namespace, otherwise it +# can't be accessed from pavement.py at build time. +FULLVERSION = VERSION +if not ISRELEASED: + if os.path.exists('.git'): + GIT_REVISION = git_version() + elif os.path.exists('numpy/version.py'): + # must be a source distribution, use existing version file + from numpy.version import git_revision as GIT_REVISION + else: + GIT_REVISION = "Unknown" + + FULLVERSION += '.dev-' + GIT_REVISION[:7] + def write_version_py(filename='numpy/version.py'): cnt = """ # THIS FILE IS GENERATED FROM NUMPY SETUP.PY @@ -106,22 +120,10 @@ release = %(isrelease)s if not release: version = full_version """ - FULL_VERSION = VERSION - if not ISRELEASED: - if os.path.exists('.git'): - GIT_REVISION = git_version() - elif os.path.exists(filename): - # must be a source distribution, use existing version file - from numpy.version import git_revision as GIT_REVISION - else: - GIT_REVISION = "Unknown" - - FULL_VERSION += '.dev-' + GIT_REVISION[:7] - a = open(filename, 'w') try: a.write(cnt % {'version': VERSION, - 'full_version' : FULL_VERSION, + 'full_version' : FULLVERSION, 'git_revision' : GIT_REVISION, 'isrelease': str(ISRELEASED)}) finally: |