mirror of
https://github.com/python/cpython.git
synced 2025-11-13 07:26:31 +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
|
# 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
|
# 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.
|
# lists of tuples of what-have-you.
|
||||||
# - each command needs a callback to process its command-line options
|
# - each command needs a callback to process its command-line options
|
||||||
# - Command.__init__() needs access to its share of the whole
|
# - Command.__init__() needs access to its share of the whole
|
||||||
|
|
@ -287,9 +287,6 @@ class build_ext(Command):
|
||||||
def run(self):
|
def run(self):
|
||||||
from packaging.compiler import new_compiler
|
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:
|
if not self.extensions:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,10 +130,10 @@ class MacroExpander:
|
||||||
raise KeyError("sdkinstallrootv2.0")
|
raise KeyError("sdkinstallrootv2.0")
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise PackagingPlatformError(
|
raise PackagingPlatformError(
|
||||||
"""Python was built with Visual Studio 2008;
|
"""Python was built with Visual Studio 2008; extensions must be built with a
|
||||||
extensions must be built with a compiler than can generate compatible binaries.
|
compiler than can generate compatible binaries. Visual Studio 2008 was not
|
||||||
Visual Studio 2008 was not found on this system. If you have Cygwin installed,
|
found on this system. If you have Cygwin installed, you can try compiling
|
||||||
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.""")
|
with MingW32, by passing "-c mingw32" to pysetup.""")
|
||||||
|
|
||||||
if version >= 9.0:
|
if version >= 9.0:
|
||||||
self.set_macro("FrameworkVersion", self.vsbase, "clr version")
|
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
|
"""Python was built with Visual Studio 2003; extensions must be built with
|
||||||
a compiler than can generate compatible binaries. Visual Studio 2003 was
|
a compiler than can generate compatible binaries. Visual Studio 2003 was
|
||||||
not found on this system. If you have Cygwin installed, you can try
|
not found on this system. If you have Cygwin installed, you can try
|
||||||
compiling with MingW32, by passing "-c mingw32" to setup.py.""")
|
compiling with MingW32, by passing "-c mingw32" to pysetup.""")
|
||||||
# XXX update this comment for setup.cfg
|
|
||||||
|
|
||||||
p = r"Software\Microsoft\NET Framework Setup\Product"
|
p = r"Software\Microsoft\NET Framework Setup\Product"
|
||||||
for base in HKEYS:
|
for base in HKEYS:
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ import sysconfig
|
||||||
# we need some way for outsiders to feed preprocessor/compiler/linker
|
# we need some way for outsiders to feed preprocessor/compiler/linker
|
||||||
# flags in to us -- eg. a sysadmin might want to mandate certain flags
|
# 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
|
# 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
|
# 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
|
# current system, they can be as system-dependent as they like, and we
|
||||||
# should just happily stuff them into the preprocessor/compiler/linker
|
# 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
|
# 'global_options' describes the command-line options that may be
|
||||||
# supplied to the setup script prior to any actual commands.
|
# 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,
|
# 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
|
# 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
|
# don't want to pollute the commands with too many options that they
|
||||||
|
|
@ -63,14 +63,15 @@ class Distribution:
|
||||||
common_usage = """\
|
common_usage = """\
|
||||||
Common commands: (see '--help-commands' for more)
|
Common commands: (see '--help-commands' for more)
|
||||||
|
|
||||||
setup.py build will build the package underneath 'build/'
|
pysetup run build will build the package underneath 'build/'
|
||||||
setup.py install will install the package
|
pysetup run install will install the package
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# options that are not propagated to the commands
|
# options that are not propagated to the commands
|
||||||
display_options = [
|
display_options = [
|
||||||
('help-commands', None,
|
('help-commands', None,
|
||||||
"list all available commands"),
|
"list all available commands"),
|
||||||
|
# XXX this is obsoleted by the pysetup metadata action
|
||||||
('name', None,
|
('name', None,
|
||||||
"print package name"),
|
"print package name"),
|
||||||
('version', 'V',
|
('version', 'V',
|
||||||
|
|
@ -360,7 +361,7 @@ Common commands: (see '--help-commands' for more)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Handle the cases of --help as a "global" option, ie.
|
# 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.)
|
# former, we show global options (--dry-run, etc.)
|
||||||
# and display-only options (--name, --version, etc.); for the
|
# and display-only options (--name, --version, etc.); for the
|
||||||
# latter, we omit the display-only options and show help for
|
# latter, we omit the display-only options and show help for
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
"""Tests for distutils.command.bdist_dumb."""
|
"""Tests for distutils.command.bdist_dumb."""
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from packaging.dist import Distribution
|
from packaging.dist import Distribution
|
||||||
|
|
@ -9,15 +8,6 @@ from packaging.tests import unittest, support
|
||||||
from packaging.tests.support import requires_zlib
|
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,
|
class BuildDumbTestCase(support.TempdirManager,
|
||||||
support.LoggingCatcher,
|
support.LoggingCatcher,
|
||||||
unittest.TestCase):
|
unittest.TestCase):
|
||||||
|
|
@ -25,12 +15,9 @@ class BuildDumbTestCase(support.TempdirManager,
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(BuildDumbTestCase, self).setUp()
|
super(BuildDumbTestCase, self).setUp()
|
||||||
self.old_location = os.getcwd()
|
self.old_location = os.getcwd()
|
||||||
self.old_sys_argv = sys.argv, sys.argv[:]
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
os.chdir(self.old_location)
|
os.chdir(self.old_location)
|
||||||
sys.argv = self.old_sys_argv[0]
|
|
||||||
sys.argv[:] = self.old_sys_argv[1]
|
|
||||||
super(BuildDumbTestCase, self).tearDown()
|
super(BuildDumbTestCase, self).tearDown()
|
||||||
|
|
||||||
@requires_zlib
|
@requires_zlib
|
||||||
|
|
@ -40,7 +27,6 @@ class BuildDumbTestCase(support.TempdirManager,
|
||||||
tmp_dir = self.mkdtemp()
|
tmp_dir = self.mkdtemp()
|
||||||
pkg_dir = os.path.join(tmp_dir, 'foo')
|
pkg_dir = os.path.join(tmp_dir, 'foo')
|
||||||
os.mkdir(pkg_dir)
|
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, 'foo.py'), '#')
|
||||||
self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
|
self.write_file((pkg_dir, 'MANIFEST.in'), 'include foo.py')
|
||||||
self.write_file((pkg_dir, 'README'), '')
|
self.write_file((pkg_dir, 'README'), '')
|
||||||
|
|
@ -50,8 +36,6 @@ class BuildDumbTestCase(support.TempdirManager,
|
||||||
'url': 'xxx', 'author': 'xxx',
|
'url': 'xxx', 'author': 'xxx',
|
||||||
'author_email': 'xxx'})
|
'author_email': 'xxx'})
|
||||||
os.chdir(pkg_dir)
|
os.chdir(pkg_dir)
|
||||||
|
|
||||||
sys.argv[:] = ['setup.py']
|
|
||||||
cmd = bdist_dumb(dist)
|
cmd = bdist_dumb(dist)
|
||||||
|
|
||||||
# so the output is the same no matter
|
# so the output is the same no matter
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import io
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
import textwrap
|
import textwrap
|
||||||
|
import sysconfig
|
||||||
import packaging.dist
|
import packaging.dist
|
||||||
|
|
||||||
from packaging.dist import Distribution
|
from packaging.dist import Distribution
|
||||||
|
|
@ -396,7 +397,8 @@ class MetadataTestCase(support.TempdirManager,
|
||||||
dist = Distribution()
|
dist = Distribution()
|
||||||
sys.argv = []
|
sys.argv = []
|
||||||
dist.help = True
|
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)
|
__, stdout = captured_stdout(dist.parse_command_line)
|
||||||
output = [line for line in stdout.split('\n')
|
output = [line for line in stdout.split('\n')
|
||||||
if line.strip() != '']
|
if line.strip() != '']
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue