Ronald Oussoren avatar Ronald Oussoren committed 946fc6f

Some small fixes to the test/build support code

Comments (0)

Files changed (4)

build-support/build_frameworks.py

 
 # Name of the Python framework and any additional arguments
 # passed to the configure command.
-gFrameworkNameTemplate="DbgPython-{archs}"
-gExtraConfigureArgs=[
-    "--with-pydebug",
+gFlavours = [
+        dict(
+            name="debug",
+            template="DbgPython-{archs}",
+            flags=[
+                "--with-pydebug",
+            ],
+        ),
+#        dict(
+#            name="release",
+#            template="ReleasePython-{archs}",
+#            flags=[
+#            ],
+#        ),
 ]
 
+
 # Location of the SVN branches to be used
 gURLMap = {
     '2.6': 'http://svn.python.org/projects/python/branches/release26-maint',
         lg.warn("Checkout for %s failed", version)
         raise ShellError(xit)
 
-def build_framework(version, archs):
+def build_framework(flavour, version, archs):
     """
     Build the given version of Python in the given architecture
     variant. 
     a local copy of the package).
     """
     lg = logging.getLogger("build_framework")
-    lg.info("Build framework version=%r archs=%r", version, archs)
+    lg.info("Build %s framework version=%r archs=%r", flavour["name"], version, archs)
 
     builddir = os.path.join(gBaseDir, "checkouts", version, "build")
     if os.path.exists(builddir):
     p = subprocess.Popen([
         "../configure",
             "--enable-framework",
-            "--with-framework-name={0}".format(gFrameworkNameTemplate.format(version=version, archs=archs)),
+            "--with-framework-name={0}".format(flavour["template"].format(version=version, archs=archs)),
             "--enable-universalsdk={0}".format(gSdkMap[archs]),
             "--with-universal-archs={0}".format(archs),
-            ] + gExtraConfigureArgs + [
+            ] + flavour["flags"] + [
             "MACOSX_DEPLOYMENT_TARGET={0}".format(gDeploymentTargetMap[archs]),
             ], cwd=builddir)
 
         lg.debug("Install failed for %r", version)
         raise ShellError(xit)
 
-def install_distribute(version, archs):
+def install_distribute(flavour, version, archs):
     lg = logging.getLogger("install_distribute")
     lg.debug("Installing distribute")
 
         lg.debug("Remove existing 'build' subdir")
         shutil.rmtree(builddir)
 
-    frameworkName=gFrameworkNameTemplate.format(archs=archs, version=version)
+    frameworkName=flavour["template"].format(archs=archs, version=version)
 
     python = "/Library/Frameworks/{0}.framework/Versions/{1}/bin/python".format(
             frameworkName, version)
         raise ShellError(xit)
 
 
-def install_virtualenv(version, archs):
+def install_virtualenv(flavour, version, archs):
     lg = logging.getLogger("install_virtualenv")
 
     lg.info("Installing virtualenv from local source")
 
-    frameworkName=gFrameworkNameTemplate.format(archs=archs, version=version)
+    frameworkName=flavour["template"].format(archs=archs, version=version)
 
     python = "/Library/Frameworks/{0}.framework/Versions/{1}/bin/python".format(
             frameworkName, version)
         for version in sorted(versions):
             create_checkout(version)
 
-            for arch in sorted(archs):
-                lg.info('Building framework for python %s (%s)', version, arch)
-                build_framework(version, arch)
-                lg.info('Installing distribute for python %s (%s)', version, arch)
-                install_distribute(version, arch)
-                lg.info('Installing virtualenv for python %s (%s)', version, arch)
-                install_virtualenv(version, arch)
-                lg.info('Done python %s (%s)', version, arch)
+            for flavour in gFlavours:
+                for arch in sorted(archs):
+                    try:
+                        lg.info('Building %s framework for python %s (%s)', flavour["name"], version, arch)
+                        build_framework(flavour, version, arch)
+                        lg.info('Installing distribute for python %s (%s)', version, arch)
+                        install_distribute(flavour, version, arch)
+                        lg.info('Installing virtualenv for python %s (%s)', version, arch)
+                        install_virtualenv(flavour, version, arch)
+                        lg.info('Done %s python %s (%s)', flavour["name"], version, arch)
+                    except Exception as exc:
+                        lg.warning("building %s for pyton %s (%s) failed: %s",
+                                flavour["name"], version, arch, exc)
+                        import traceback
+                        traceback.print_exc()
     
     except ShellError:
         sys.exit(1)

build-support/run_tests.py

 gUsage = """\
 run_tests.py [-a archs] [--archs=archs] [-v versions] [--versions,versions]
 
-archs:    32-bit,3-way,intel (values separated by commas)
+archs:    32-bit,3-way (values separated by commas)
 versions: 2.6,2.7,3.1,3.2    (values seperated by commas)
 """
 
 
 gFrameworkNameTemplate="DbgPython-{archs}"
 
-gVersions=["2.6", "2.7", "3.1", "3.2"]
-gArchs=["32-bit", "3-way", "intel"]
-
-gVersions=["3.2", "2.7"]
-gArchs=["3-way"]
+gVersions=["3.2", "2.7", "3.1", "2.6"]
+gArchs=["32-bit", "3-way"]
 
 gArchMap={
     '3-way': ['ppc', 'i386', 'x86_64'],
     'intel': ['i386', 'x86_64'],
 }
 
-# XXX: Temporary workaround for structure of 
-# my local work environment.
-gPyObjCCore="pyobjc-core"
-if os.path.exists(os.path.join(gRootDir, "pyobjc-core-py3k")):
-    gPyObjCCore="pyobjc-core-py3k"
-
 
 def supports_arch_command(version):
 
     if version[0] == '3':
         base_python += '3'
 
+    if os.path.exists(base_python + "-all"):
+        base_python = base_python + "-all"
+
     lg.debug("Interpreter: %s", base_python)
 
     if not os.path.exists(base_python):
 
 
     lg.debug("Install base packages")
-    if sys.version_info[0] == 3:
+    if version[0] == '3':
         python = os.path.join(subdir, "bin", "python3")
     else:
         python = os.path.join(subdir, "bin", "python")
         if not os.path.exists(os.path.join(resultdir, pkg)):
             os.makedirs(os.path.join(resultdir, pkg))
 
-        if pkg == "pyobjc-core":
-            pkgroot = os.path.join(gRootDir, gPyObjCCore)
-        else:
-            pkgroot = os.path.join(gRootDir, pkg)
+        pkgroot = os.path.join(gRootDir, pkg)
         pkgbuild = os.path.join(pkgroot, "build")
         if os.path.exists(pkgbuild):
             lg.debug("Remove build directory for %s", pkg)
         if not os.path.exists(os.path.join(resultdir, pkg)):
             os.makedirs(os.path.join(resultdir, pkg))
 
-        if pkg == "pyobjc-core":
-            pkgroot = os.path.join(gRootDir, gPyObjCCore)
-        else:
-            pkgroot = os.path.join(gRootDir, pkg)
+        pkgroot = os.path.join(gRootDir, pkg)
 
         if pkg == "pyobjc-framework-InterfaceBuilderKit":
             env = os.environ.copy()
                 xit = p.wait()
                 if xit != 0:
                     lg.warning("Test %s failed", pkg)
+
+                with open(os.path.join(resultdir, pkg, "test-stdout-{0}.exit".format(a)), "w") as fd:
+                    fd.write(str(xit))
                 
         else:
             lg.debug("Test %s for %s", pkg, os.path.basename(subdir))
 
             for fn in os.listdir(moddir):
                 if not fn.startswith('test'): continue
+                if fn.endswith('exit'): continue
 
                 if fn == 'test-stdout.txt':
                     a = 'all'
                 info['archs'].append(a)
                 info[a] =  parse_tests(os.path.join(moddir, fn))
 
+                with open (os.path.join(moddir, fn)[:-3] + 'exit') as fd:
+                    info[a]['exit'] = fd.read().strip()
+
+
                 if info[a]['test_fail'] and (info['class'] is None):
                     info['class'] = 'warning'
 
                 if info[a]['test_error']:
                     info['class'] = 'error'
 
+                if info[a]['exit'] != 0:
+                    info['class'] = 'crash'
+
 
             if info['class'] is None:
                 info['class'] = 'ok'

build-support/set-version.py

 """
 import os, sys, re
 
-DRYRUN=True
+DRYRUN=False
 
 
 topdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
     print ("Updating '%s'"%(subdir,))
     fn = os.path.join(topdir, subdir, "setup.py")
     r = re.compile('^\s*version=.*$', re.MULTILINE)
-    data = r.sub('    version="%s"'%(VERSION,), load_file(fn))
+    data = r.sub('    version="%s",'%(VERSION,), load_file(fn))
 
     r = re.compile('^\s*\'pyobjc-core>=.*$', re.MULTILINE)
     data = r.sub('        \'pyobjc-core>=%s\','%(VERSION,), data)

build-support/templates/index.html

       table#summary td.error { 
         background-color: red;
       }
+      table#summary td.crash { 
+        background-color: red;
+        text-decoration: underline;
+      }
 
     </style>
   </head>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.