[PyObjC-svn] r2459 - trunk/pyobjc/build-support
[email protected] Tue, 06 Apr 2010 03:44:10 -0500
| Newsgroups | gmane.comp.python.pyobjc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: ronaldoussoren
Date: Tue Apr 6 03:44:10 2010
New Revision: 2459
Log:
Finish the build_frameworks script.
Sadly enough this uncovered an issue in the
python trunk, I'm working on a proper fix for
that.
Modified:
trunk/pyobjc/build-support/build_frameworks.py
Modified: trunk/pyobjc/build-support/build_frameworks.py
==============================================================================
--- trunk/pyobjc/build-support/build_frameworks.py (original)
+++ trunk/pyobjc/build-support/build_frameworks.py Tue Apr 6 03:44:10 2010
@@ -4,9 +4,19 @@
used by the run_tests.py script
"""
import subprocess, getopt, logging, os, sys, shutil
+from urllib.request import urlopen
+
+gUsage="""\
+build_frameworks.py [-v versions] [--versions=versions] [-a archs] [--arch archs]
+
+- versions: comma seperated list of python versiosn, defaults to "2.6,2.7,3.1,3.2"
+- archs: comma seperated list of build variations, defaults to "32-bit,intel"
+"""
gBaseDir = os.path.dirname(os.path.abspath(__file__))
+gArchs = ("32-bit", "intel")
+
gURLMap = {
'2.6': 'http://svn.python.org/projects/python/branches/release26-maint',
'2.7': 'http://svn.python.org/projects/python/trunk',
@@ -15,6 +25,7 @@
'3.2': 'http://svn.python.org/projects/python/branches/py3k',
}
+
class ShellError (Exception):
pass
@@ -92,16 +103,117 @@
lg.debug("Install failed for %r", version)
raise ShellError(xit)
+ lg.debug("Installing distribute")
+
+ lg.debug("Download distribute_setup script")
+ fd = urlopen("http://python-distribute.org/distribute_setup.py")
+ data = fd.read()
+ fd.close()
+
+ scriptfn = os.path.join(builddir, "distribute_setup.py")
+ fd = open(scriptfn, "wb")
+ fd.write(data)
+ fd.close()
+
+ python = "/Library/Frameworks/DbgPython-{0}.framework/Versions/{1}/bin/python".format(
+ archs, version)
+ if version[0] == '3':
+ python += '3'
+
+
+ # Script is in python2 format, translate to python3 before
+ # trying to run it.
+ lg.debug("Convert install script to python3")
+ p = subprocess.Popen([
+ os.path.join(os.path.dirname(python), "2to3"),
+ scriptfn])
+ xit = p.wait()
+ if xit != 0:
+ lg.warning("Running 2to3 failed")
+ raise ShellError(xit)
+
+ lg.debug("Run distribute_setup script")
+ p = subprocess.Popen([
+ python,
+ scriptfn])
+ xit = p.wait()
+ if xit != 0:
+ lg.warning("Installing 'distribute' failed")
+ raise ShellError(xit)
+
+ lg.debug("Installing virtualenv")
+
+ # Sadly enough plain virtualenv doens't support
+ # python3 yet, but there is a fork that does.
+ # Therefore install the real virtualenv for python 2.x
+ # and the fork for python 3.x
+ if version[0] == '2':
+ p = subprocess.Popen([
+ os.path.join(os.path.dirname(python), "easy_install"),
+ "virtualenv"])
+ else:
+ p = subprocess.Popen([
+ os.path.join(os.path.dirname(python), "easy_install"),
+ "virtualenv3"])
+
+ xit = p.wait()
+ if xit != 0:
+ lg.warning("Installing 'distribute' failed")
+ raise ShellError(xit)
+
lg.info("Installation of %r done", version)
def main():
logging.basicConfig(level=logging.DEBUG)
try:
- for version in ("2.6", "2.7", "3.1", "3.2"):
+ opts, args = getopt.getopt(sys.argv[1:], 'v:a:h?', ['help', 'versions=', 'archs='])
+ except getopt.error as msg:
+ print(msg, file=sys.stderr)
+ print(gUsage, file=sys.stderr)
+ sys.exit(1)
+
+ versions = sorted(gURLMap.keys())
+ archs = gArchs
+
+ if args:
+ print("Additional arguments", file=sys.stderr)
+ print(gUsage, file=sys.stderr)
+ sys.exit(1)
+
+ for k, v in opts:
+ if k in ('-h', '-?', '--help'):
+ print(gUsage)
+ sys.exit(0)
+
+ elif k in ('-v', '--versions'):
+ versions = v.split(',')
+
+ for v in versions:
+ if v not in gURLMap:
+ print("Unsupported python version: {0}".format(v),
+ file=sys.stderr)
+ sys.exit(1)
+
+ elif k in ('-a', '--archs'):
+ archs = v.split(',')
+
+ for v in archs:
+ if v not in gArchs:
+ print("Unsupported python architecture: {0}".format(v),
+ file=sys.stderr)
+ sys.exit(1)
+
+ else:
+ print("ERROR: unhandled script option: {0}".format(k),
+ file=sys.stderr)
+ sys.exit(2)
+
+ try:
+ for version in sorted(versions):
create_checkout(version)
- for archs in ("32-bit", "intel"):
+ for archs in gArchs:
build_framework(version, archs)
except ShellError:
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev