[pypy-commit] pypy default: Get rid of the backward-compatibility of positional arguments.

arigo pypy.commits at gmail.com
Fri Jun 10 06:20:55 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r85073:24501b6937bb
Date: 2016-06-10 12:21 +0200
http://bitbucket.org/pypy/pypy/changeset/24501b6937bb/

Log:	Get rid of the backward-compatibility of positional arguments.

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
@@ -3,10 +3,12 @@
 It uses 'pypy/goal/pypy-c' and parts of the rest of the working
 copy.  Usage:
 
-    package.py [--options] pypy-VER-PLATFORM
+    package.py [--options] --archive-name=pypy-VER-PLATFORM
 
 The output is found in the directory from --builddir,
 by default /tmp/usession-YOURNAME/build/.
+
+For a list of all options, see 'package.py --help'.
 """
 
 import shutil
@@ -289,26 +291,12 @@
         help='destination dir for archive')
     parser.add_argument('--override_pypy_c', type=str, default='',
         help='use as pypy exe instead of pypy/goal/pypy-c')
-    # Positional arguments, for backward compatability with buldbots
-    parser.add_argument('extra_args', help='optional interface to positional arguments', nargs=argparse.REMAINDER,
-        metavar='[archive-name] [rename_pypy_c] [targetdir] [override_pypy_c]',
-        )
     options = parser.parse_args(args)
 
-    # Handle positional arguments, choke if both methods are used
-    for i,target, default in ([0, 'name', ''], [1, 'pypy_c', pypy_exe],
-                              [2, 'targetdir', ''], [3,'override_pypy_c', '']):
-        if len(options.extra_args)>i:
-            if getattr(options, target) != default:
-                print 'positional argument',i,target,'already has value',getattr(options, target)
-                parser.print_help()
-                return
-            setattr(options, target, options.extra_args[i])
     if os.environ.has_key("PYPY_PACKAGE_NOSTRIP"):
         options.nostrip = True
-
     if os.environ.has_key("PYPY_PACKAGE_WITHOUTTK"):
-        options.tk = True
+        options.no_tk = True
     if not options.builddir:
         # The import actually creates the udir directory
         from rpython.tool.udir import udir
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
@@ -22,7 +22,9 @@
     def test_dir_structure(self, test='test'):
         retval, builddir = package.package(
             '--without-cffi',
-            test, self.rename_pypy_c, _fake=True)
+            '--archive-name', test,
+            '--rename_pypy_c', self.rename_pypy_c,
+            _fake=True)
         assert retval == 0
         prefix = builddir.join(test)
         cpyver = '%d.%d' % CPYTHON_VERSION[:2]
@@ -71,7 +73,9 @@
         builddir = udir.ensure("build", dir=True)
         retval, builddir = package.package(
             '--without-cffi', '--builddir', str(builddir),
-            test, self.rename_pypy_c, _fake=True)
+            '--archive-name', test,
+            '--rename_pypy_c', self.rename_pypy_c,
+            _fake=True)
 
     def test_with_zipfile_module(self):
         prev = package.USE_ZIPFILE_MODULE


More information about the pypy-commit mailing list