mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
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.
This commit is contained in:
parent
434812d569
commit
b6be20ca33
7 changed files with 15 additions and 32 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() != '']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue