Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r77476:f3753d1ed6ab
Date: 2015-05-22 10:15 +0200
http://bitbucket.org/pypy/pypy/changeset/f3753d1ed6ab/

Log:    Add all the "--without-NAME" options for all cffi build scripts

diff --git a/pypy/tool/release/package.py b/pypy/tool/release/package.py
--- a/pypy/tool/release/package.py
+++ b/pypy/tool/release/package.py
@@ -50,16 +50,23 @@
         os.system("chmod -R g-w %s" % dirname)
 
 
+cffi_build_scripts = {
+    "sqlite3": "_sqlite3_build.py",
+    "audioop": "_audioop_build.py",
+    "tk": "_tkinter/tklib_build.py",
+    "curses": "_curses_build.py" if sys.platform != "win32" else None,
+    "syslog": "_syslog_build.py" if sys.platform != "win32" else None,
+    "gdbm": "_gdbm_build.py"  if sys.platform != "win32" else None,
+    "pwdgrp": "_pwdgrp_build.py" if sys.platform != "win32" else None,
+    "xx": None,    # for testing: 'None' should be completely ignored
+    }
+
 def create_cffi_import_libraries(pypy_c, options, basedir):
     shutil.rmtree(str(basedir.join('lib_pypy', '__pycache__')),
                   ignore_errors=True)
-    modules = ['_sqlite3_build.py', '_audioop_build.py']
-    if not sys.platform == 'win32':
-        modules += ['_curses_build.py', '_syslog_build.py', '_gdbm_build.py',
-                    '_pwdgrp_build.py']
-    if not options.no_tk:
-        modules.append('_tkinter/tklib_build.py')
-    for module in modules:
+    for key, module in sorted(cffi_build_scripts.items()):
+        if module is None or getattr(options, 'no_' + key):
+            continue
         if module.endswith('.py'):
             args = [str(pypy_c), module]
             cwd = str(basedir.join('lib_pypy'))
@@ -70,9 +77,9 @@
         try:
             subprocess.check_call(args, cwd=cwd)
         except subprocess.CalledProcessError:
-            print >>sys.stderr, """Building {0} bindings failed.
+            print >>sys.stderr, """!!!!!!!!!!\nBuilding {0} bindings failed.
 You can either install development headers package or
-add --without-{0} option to skip packaging binary CFFI 
extension.""".format(module)
+add --without-{0} option to skip packaging this binary CFFI 
extension.""".format(key)
             raise MissingDependenciesError(module)
 
 def pypy_runs(pypy_c, quiet=False):
@@ -109,8 +116,7 @@
         try:
             create_cffi_import_libraries(pypy_c, options, basedir)
         except MissingDependenciesError:
-            # This is a non-fatal error
-            retval = -1
+            return 1, None
 
     if sys.platform == 'win32' and not rename_pypy_c.lower().endswith('.exe'):
         rename_pypy_c += '.exe'
@@ -280,11 +286,18 @@
         pypy_exe = 'pypy'
     parser = argparse.ArgumentParser()
     args = list(args)
-    args[0] = str(args[0])
-    parser.add_argument('--without-tk', dest='no_tk', action='store_true',
-        help='build and package the cffi tkinter module')
+    if args:
+        args[0] = str(args[0])
+    else:
+        args.append('--help')
+    for key, module in sorted(cffi_build_scripts.items()):
+        if module is not None:
+            parser.add_argument('--without-' + key,
+                    dest='no_' + key,
+                    action='store_true',
+                    help='do not build and package the %r cffi module' % 
(key,))
     parser.add_argument('--without-cffi', dest='no_cffi', action='store_true',
-        help='do not pre-import any cffi modules')
+        help='skip building *all* the cffi modules listed above')
     parser.add_argument('--nostrip', dest='nostrip', action='store_true',
         help='do not strip the exe, making it ~10MB larger')
     parser.add_argument('--rename_pypy_c', dest='pypy_c', type=str, 
default=pypy_exe,
diff --git a/pypy/tool/release/test/test_package.py 
b/pypy/tool/release/test/test_package.py
--- a/pypy/tool/release/test/test_package.py
+++ b/pypy/tool/release/test/test_package.py
@@ -1,7 +1,7 @@
 
 import py
 from pypy.conftest import pypydir
-from pypy.tool.release import package, package
+from pypy.tool.release import package
 from pypy.module.sys.version import  CPYTHON_VERSION
 import tarfile, zipfile, sys
 
@@ -32,8 +32,9 @@
     else:
         fake_pypy_c = False
     try:
-        retval, builddir = package.package(py.path.local(pypydir).dirpath(), 
test,
-                                   rename_pypy_c)
+        retval, builddir = package.package(
+            '--without-cffi', str(py.path.local(pypydir).dirpath()),
+            test, rename_pypy_c)
         assert retval == 0
         prefix = builddir.join(test)
         cpyver = '%d.%d' % CPYTHON_VERSION[:2]
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to