[Python-checkins] cpython: Packaging: remove last mentions and uses of setup.py in the code.

eric.araujo python-checkins at python.org
Fri Jun 17 19:41:35 CEST 2011


http://hg.python.org/cpython/rev/eca2efd642fe
changeset:   70846:eca2efd642fe
user:        Éric Araujo <merwok at netwok.org>
date:        Thu Jun 16 23:34:55 2011 +0200
summary:
  Packaging: remove last mentions and uses of setup.py in the code.

Now only the compatibility layer (in create, util and install) talk
about setup.py.

files:
  Lib/packaging/command/build_ext.py             |   5 +--
  Lib/packaging/compiler/msvc9compiler.py        |   8 ++--
  Lib/packaging/compiler/msvccompiler.py         |   3 +-
  Lib/packaging/compiler/unixccompiler.py        |   2 +-
  Lib/packaging/dist.py                          |   9 +++--
  Lib/packaging/tests/test_command_bdist_dumb.py |  16 ----------
  Lib/packaging/tests/test_dist.py               |   4 +-
  7 files changed, 15 insertions(+), 32 deletions(-)


diff --git a/Lib/packaging/command/build_ext.py b/Lib/packaging/command/build_ext.py
--- a/Lib/packaging/command/build_ext.py
+++ b/Lib/packaging/command/build_ext.py
@@ -38,7 +38,7 @@
 
     # XXX thoughts on how to deal with complex command-line options like
     # these, i.e. how to make it so fancy_getopt can suck them off the
-    # command line and make it look like setup.py defined the appropriate
+    # command line and turn them into the appropriate
     # lists of tuples of what-have-you.
     #   - each command needs a callback to process its command-line options
     #   - Command.__init__() needs access to its share of the whole
@@ -287,9 +287,6 @@
     def run(self):
         from packaging.compiler import new_compiler
 
-        # 'self.extensions', as supplied by setup.py, is a list of
-        # Extension instances.  See the documentation for Extension (in
-        # distutils.extension) for details.
         if not self.extensions:
             return
 
diff --git a/Lib/packaging/compiler/msvc9compiler.py b/Lib/packaging/compiler/msvc9compiler.py
--- a/Lib/packaging/compiler/msvc9compiler.py
+++ b/Lib/packaging/compiler/msvc9compiler.py
@@ -130,10 +130,10 @@
                 raise KeyError("sdkinstallrootv2.0")
         except KeyError:
             raise PackagingPlatformError(
-            """Python was built with Visual Studio 2008;
-extensions must be built with a compiler than can generate compatible binaries.
-Visual Studio 2008 was not found on this system. If you have Cygwin installed,
-you can try compiling with MingW32, by passing "-c mingw32" to setup.py.""")
+"""Python was built with Visual Studio 2008; extensions must be built with a
+compiler than can generate compatible binaries. Visual Studio 2008 was not
+found on this system. If you have Cygwin installed, you can try compiling
+with MingW32, by passing "-c mingw32" to pysetup.""")
 
         if version >= 9.0:
             self.set_macro("FrameworkVersion", self.vsbase, "clr version")
diff --git a/Lib/packaging/compiler/msvccompiler.py b/Lib/packaging/compiler/msvccompiler.py
--- a/Lib/packaging/compiler/msvccompiler.py
+++ b/Lib/packaging/compiler/msvccompiler.py
@@ -134,8 +134,7 @@
 """Python was built with Visual Studio 2003; extensions must be built with
 a compiler than can generate compatible binaries. Visual Studio 2003 was
 not found on this system. If you have Cygwin installed, you can try
-compiling with MingW32, by passing "-c mingw32" to setup.py.""")
-# XXX update this comment for setup.cfg
+compiling with MingW32, by passing "-c mingw32" to pysetup.""")
 
         p = r"Software\Microsoft\NET Framework Setup\Product"
         for base in HKEYS:
diff --git a/Lib/packaging/compiler/unixccompiler.py b/Lib/packaging/compiler/unixccompiler.py
--- a/Lib/packaging/compiler/unixccompiler.py
+++ b/Lib/packaging/compiler/unixccompiler.py
@@ -33,7 +33,7 @@
 #     we need some way for outsiders to feed preprocessor/compiler/linker
 #     flags in to us -- eg. a sysadmin might want to mandate certain flags
 #     via a site config file, or a user might want to set something for
-#     compiling this module distribution only via the setup.py command
+#     compiling this module distribution only via the pysetup command
 #     line, whatever.  As long as these options come from something on the
 #     current system, they can be as system-dependent as they like, and we
 #     should just happily stuff them into the preprocessor/compiler/linker
diff --git a/Lib/packaging/dist.py b/Lib/packaging/dist.py
--- a/Lib/packaging/dist.py
+++ b/Lib/packaging/dist.py
@@ -47,7 +47,7 @@
 
     # 'global_options' describes the command-line options that may be
     # supplied to the setup script prior to any actual commands.
-    # Eg. "./setup.py -n" or "./setup.py --dry-run" both take advantage of
+    # Eg. "pysetup -n" or "pysetup --dry-run" both take advantage of
     # these global options.  This list should be kept to a bare minimum,
     # since every global option is also valid as a command option -- and we
     # don't want to pollute the commands with too many options that they
@@ -63,14 +63,15 @@
     common_usage = """\
 Common commands: (see '--help-commands' for more)
 
-  setup.py build      will build the package underneath 'build/'
-  setup.py install    will install the package
+  pysetup run build      will build the package underneath 'build/'
+  pysetup run install    will install the package
 """
 
     # options that are not propagated to the commands
     display_options = [
         ('help-commands', None,
          "list all available commands"),
+        # XXX this is obsoleted by the pysetup metadata action
         ('name', None,
          "print package name"),
         ('version', 'V',
@@ -360,7 +361,7 @@
                 return
 
         # Handle the cases of --help as a "global" option, ie.
-        # "setup.py --help" and "setup.py --help command ...".  For the
+        # "pysetup run --help" and "pysetup run --help command ...".  For the
         # former, we show global options (--dry-run, etc.)
         # and display-only options (--name, --version, etc.); for the
         # latter, we omit the display-only options and show help for
diff --git a/Lib/packaging/tests/test_command_bdist_dumb.py b/Lib/packaging/tests/test_command_bdist_dumb.py
--- a/Lib/packaging/tests/test_command_bdist_dumb.py
+++ b/Lib/packaging/tests/test_command_bdist_dumb.py
@@ -1,6 +1,5 @@
 """Tests for distutils.command.bdist_dumb."""
 
-import sys
 import os
 
 from packaging.dist import Distribution
@@ -9,15 +8,6 @@
 from packaging.tests.support import requires_zlib
 
 
-SETUP_PY = """\
-from distutils.run import setup
-import foo
-
-setup(name='foo', version='0.1', py_modules=['foo'],
-      url='xxx', author='xxx', author_email='xxx')
-"""
-
-
 class BuildDumbTestCase(support.TempdirManager,
                         support.LoggingCatcher,
                         unittest.TestCase):
@@ -25,12 +15,9 @@
     def setUp(self):
         super(BuildDumbTestCase, self).setUp()
         self.old_location = os.getcwd()
-        self.old_sys_argv = sys.argv, sys.argv[:]
 
     def tearDown(self):
         os.chdir(self.old_location)
-        sys.argv = self.old_sys_argv[0]
-        sys.argv[:] = self.old_sys_argv[1]
         super(BuildDumbTestCase, self).tearDown()
 
     @requires_zlib
@@ -40,7 +27,6 @@
         tmp_dir = self.mkdtemp()
         pkg_dir = os.path.join(tmp_dir, 'foo')
         os.mkdir(pkg_dir)
-        self.write_file((pkg_dir, 'setup.py'), SETUP_PY)
         self.write_file((pkg_dir, 'foo.py'), '#')
         self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
         self.write_file((pkg_dir, 'README'), '')
@@ -50,8 +36,6 @@
                              'url': 'xxx', 'author': 'xxx',
                              'author_email': 'xxx'})
         os.chdir(pkg_dir)
-
-        sys.argv[:] = ['setup.py']
         cmd = bdist_dumb(dist)
 
         # so the output is the same no matter
diff --git a/Lib/packaging/tests/test_dist.py b/Lib/packaging/tests/test_dist.py
--- a/Lib/packaging/tests/test_dist.py
+++ b/Lib/packaging/tests/test_dist.py
@@ -4,6 +4,7 @@
 import sys
 import logging
 import textwrap
+import sysconfig
 import packaging.dist
 
 from packaging.dist import Distribution
@@ -396,7 +397,8 @@
         dist = Distribution()
         sys.argv = []
         dist.help = True
-        dist.script_name = 'setup.py'
+        dist.script_name = os.path.join(sysconfig.get_path('scripts'),
+                                        'pysetup')
         __, stdout = captured_stdout(dist.parse_command_line)
         output = [line for line in stdout.split('\n')
                   if line.strip() != '']

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list