From b6be20ca337348b7cf2b356f9354a4121627add0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Thu, 16 Jun 2011 23:34:55 +0200 Subject: 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. --- 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 index 403e5fd..c820336 100644 --- a/Lib/packaging/command/build_ext.py +++ b/Lib/packaging/command/build_ext.py @@ -38,7 +38,7 @@ class build_ext(Command): # 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 @@ class build_ext(Command): 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 index 43fc5fa..6ca49c2 100644 --- a/Lib/packaging/compiler/msvc9compiler.py +++ b/Lib/packaging/compiler/msvc9compiler.py @@ -130,10 +130,10 @@ class MacroExpander: 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 index 97f76bb..3d4ac3c 100644 --- a/Lib/packaging/compiler/msvccompiler.py +++ b/Lib/packaging/compiler/msvccompiler.py @@ -134,8 +134,7 @@ class MacroExpander: """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 index 8c24c0f..c857d03 100644 --- a/Lib/packaging/compiler/unixccompiler.py +++ b/Lib/packaging/compiler/unixccompiler.py @@ -33,7 +33,7 @@ import sysconfig # 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 index 5c390ce..7b431ac 100644 --- a/Lib/packaging/dist.py +++ b/Lib/packaging/dist.py @@ -47,7 +47,7 @@ class Distribution: # '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 @@ class Distribution: 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 @@ Common commands: (see '--help-commands' for more) 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 index b235795..fd199ea 100644 --- 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 import unittest, support 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 @@ class BuildDumbTestCase(support.TempdirManager, 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 @@ class BuildDumbTestCase(support.TempdirManager, 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 @@ class BuildDumbTestCase(support.TempdirManager, '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 index e1c5ff0..9ad7a08 100644 --- a/Lib/packaging/tests/test_dist.py +++ b/Lib/packaging/tests/test_dist.py @@ -4,6 +4,7 @@ import io import sys import logging import textwrap +import sysconfig import packaging.dist from packaging.dist import Distribution @@ -396,7 +397,8 @@ class MetadataTestCase(support.TempdirManager, 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() != ''] -- cgit v0.12