[bumpversion]
-current_version = 58.0.4
+current_version = 58.1.0
commit = True
tag = True
strategy:
matrix:
python:
+ - pypy3
- 3.6
- 3.9
- 3.10.0-alpha - 3.10.99
- - pypy3
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
include
lib
distribute.egg-info
+foo.egg-info
setuptools.egg-info
.coverage
.eggs
+v58.1.0
+-------
+
+
+Changes
+^^^^^^^
+* #2796: Merge with pypa/distutils@02e9f65ab0
+
+
v58.0.4
-------
--- /dev/null
+Deprecated the ``bdist_rpm`` command. Binary packages should be built as wheels instead.
+-- by :user:`hugovk`
--- /dev/null
+Replace confirparser's readfp with read_file, deprecated since Python 3.2.
+-- by :user:`hugovk`
=====================
Some entry points may require additional dependencies to properly function.
-For such an entry point, declare in square brakets any number of dependency
+For such an entry point, declare in square brackets any number of dependency
``extras`` following the entry point definition. Such entry points will only
be viable if their extras were declared and installed. See the
:doc:`guide on dependencies management <dependency_management>` for
pip install --editable .
This creates a link file in your interpreter site package directory which
-associate with your source code. For more information, see: (WIP)
+associate with your source code. For more information, see :doc:`development_mode`.
Uploading your package to PyPI
[metadata]
name = setuptools
-version = 58.0.4
+version = 58.1.0
author = Python Packaging Authority
author_email = distutils-sig@python.org
description = Easily download, build, install, upgrade, and uninstall Python packages
# For extensions under Cygwin, Python's library directory must be
# appended to library_dirs
if sys.platform[:6] == 'cygwin':
- if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
+ if not sysconfig.python_build:
# building third party extensions
self.library_dirs.append(os.path.join(sys.prefix, "lib",
"python" + get_python_version(),
"""Sets the install directories by applying the install schemes."""
# it's the caller's problem if they supply a bad name!
if (hasattr(sys, 'pypy_version_info') and
+ sys.version_info < (3, 8) and
not name.endswith(('_user', '_home'))):
if os.name == 'nt':
name = 'pypy_nt'
"""
if prefix is None:
prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
- if IS_PYPY:
- return os.path.join(prefix, 'include')
- elif os.name == "posix":
+ if os.name == "posix":
+ if IS_PYPY and sys.version_info < (3, 8):
+ return os.path.join(prefix, 'include')
if python_build:
# Assume the executable is in the build directory. The
# pyconfig.h file should be in the same directory. Since
else:
incdir = os.path.join(get_config_var('srcdir'), 'Include')
return os.path.normpath(incdir)
- python_dir = 'python' + get_python_version() + build_flags
+ implementation = 'pypy' if IS_PYPY else 'python'
+ python_dir = implementation + get_python_version() + build_flags
return os.path.join(prefix, "include", python_dir)
elif os.name == "nt":
if python_build:
If 'prefix' is supplied, use it instead of sys.base_prefix or
sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
"""
- if IS_PYPY:
+
+ if IS_PYPY and sys.version_info < (3, 8):
# PyPy-specific schema
if prefix is None:
prefix = PREFIX
else:
# Pure Python
libdir = "lib"
+ implementation = 'pypy' if IS_PYPY else 'python'
libpython = os.path.join(prefix, libdir,
- "python" + get_python_version())
+ implementation + get_python_version())
if standard_lib:
return libpython
else:
if 'CC' in os.environ:
newcc = os.environ['CC']
- if (sys.platform == 'darwin'
- and 'LDSHARED' not in os.environ
+ if('LDSHARED' not in os.environ
and ldshared.startswith(cc)):
- # On OS X, if CC is overridden, use that as the default
+ # If CC is overridden, use that as the default
# command for LDSHARED as well
ldshared = newcc + ldshared[len(cc):]
cc = newcc
linker_exe=cc,
archiver=archiver)
+ if 'RANLIB' in os.environ and compiler.executables.get('ranlib', None):
+ compiler.set_executables(ranlib=os.environ['RANLIB'])
+
compiler.shared_lib_extension = shlib_suffix
from distutils import sysconfig
from distutils.ccompiler import get_default_compiler
+from distutils.unixccompiler import UnixCCompiler
from distutils.tests import support
from test.support import run_unittest, swap_item
# make sure AR gets caught
class compiler:
compiler_type = 'unix'
+ executables = UnixCCompiler.executables
+
+ def __init__(self):
+ self.exes = {}
def set_executables(self, **kw):
- self.exes = kw
+ for k, v in kw.items():
+ self.exes[k] = v
sysconfig_vars = {
'AR': 'sc_ar',
os.environ['ARFLAGS'] = '--env-arflags'
os.environ['CFLAGS'] = '--env-cflags'
os.environ['CPPFLAGS'] = '--env-cppflags'
+ os.environ['RANLIB'] = 'env_ranlib'
comp = self.customize_compiler()
self.assertEqual(comp.exes['archiver'],
' --env-cppflags'))
self.assertEqual(comp.shared_lib_extension, 'sc_shutil_suffix')
+ if sys.platform == "darwin":
+ self.assertEqual(comp.exes['ranlib'],
+ 'env_ranlib')
+ else:
+ self.assertTrue('ranlib' not in comp.exes)
+
del os.environ['AR']
del os.environ['CC']
del os.environ['CPP']
del os.environ['ARFLAGS']
del os.environ['CFLAGS']
del os.environ['CPPFLAGS']
+ del os.environ['RANLIB']
comp = self.customize_compiler()
self.assertEqual(comp.exes['archiver'],
self.assertEqual(comp.exes['linker_so'],
'sc_ldshared')
self.assertEqual(comp.shared_lib_extension, 'sc_shutil_suffix')
+ self.assertTrue('ranlib' not in comp.exes)
def test_parse_makefile_base(self):
self.makefile = TESTFN
sysconfig.get_config_var = gcv
self.assertEqual(self.cc.rpath_foo(), '-Wl,--enable-new-dtags,-R/foo')
+ def gcv(v):
+ if v == 'CC':
+ return 'gcc -pthread -B /bar'
+ elif v == 'GNULD':
+ return 'yes'
+ sysconfig.get_config_var = gcv
+ self.assertEqual(self.cc.rpath_foo(), '-Wl,--enable-new-dtags,-R/foo')
+
# GCC non-GNULD
sys.platform = 'bar'
def gcv(v):
sysconfig.get_config_var = gcv
self.assertEqual(self.cc.rpath_foo(), '-R/foo')
- @unittest.skipUnless(sys.platform == 'darwin', 'test only relevant for OS X')
- def test_osx_cc_overrides_ldshared(self):
+ @unittest.skipIf(sys.platform == 'win32', "can't test on Windows")
+ def test_cc_overrides_ldshared(self):
# Issue #18080:
# ensure that setting CC env variable also changes default linker
def gcv(v):
sysconfig.customize_compiler(self.cc)
self.assertEqual(self.cc.linker_so[0], 'my_cc')
- @unittest.skipUnless(sys.platform == 'darwin', 'test only relevant for OS X')
- def test_osx_explicit_ldshared(self):
+ @unittest.skipIf(sys.platform == 'win32', "can't test on Windows")
+ def test_explicit_ldshared(self):
# Issue #18080:
# ensure that setting CC env variable does not change
# explicit LDSHARED setting for linker
* link shared library handled by 'cc -shared'
"""
-import os, sys, re
+import os, sys, re, shlex
from distutils import sysconfig
from distutils.dep_util import newer
# this time, there's no way to determine this information from
# the configuration data stored in the Python installation, so
# we use this hack.
- compiler = os.path.basename(sysconfig.get_config_var("CC"))
+ compiler = os.path.basename(shlex.split(sysconfig.get_config_var("CC"))[0])
if sys.platform[:6] == "darwin":
from distutils.util import get_macosx_target_ver, split_version
macosx_target_ver = get_macosx_target_ver()
import distutils.command.bdist_rpm as orig
+import warnings
+
+from setuptools import SetuptoolsDeprecationWarning
class bdist_rpm(orig.bdist_rpm):
"""
def run(self):
+ warnings.warn(
+ "bdist_rpm is deprecated and will be removed in a future "
+ "version. Use bdist_wheel (wheel packages) instead.",
+ SetuptoolsDeprecationWarning,
+ )
+
# ensure distro name is up-to-date
self.run_command('egg_info')
# Now the config is in bytes, but for RawConfigParser, it should
# be text, so decode it.
config = config.decode(sys.getfilesystemencoding())
- cfg.readfp(io.StringIO(config))
+ cfg.read_file(io.StringIO(config))
except configparser.Error:
return None
if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
--- /dev/null
+"""develop tests
+"""
+import mock
+import sys
+
+import pytest
+
+from setuptools.dist import Distribution
+from setuptools import SetuptoolsDeprecationWarning
+
+
+@pytest.mark.skipif(sys.platform == 'win32', reason='non-Windows only')
+@mock.patch('distutils.command.bdist_rpm.bdist_rpm')
+def test_bdist_rpm_warning(distutils_cmd):
+ dist = Distribution(
+ dict(
+ script_name='setup.py',
+ script_args=['bdist_rpm'],
+ name='foo',
+ py_modules=['hi'],
+ )
+ )
+ dist.parse_command_line()
+ with pytest.warns(SetuptoolsDeprecationWarning):
+ dist.run_commands()
+
+ distutils_cmd.run.assert_called_once()
def test_case_retained(self, tmpdir):
"""
+ When editing a file, case of keys should be retained.
"""
config = tmpdir.join('setup.cfg')
- self.write_text(str(config), '[names]\nJARACO=jaraco')
- setopt.edit_config(str(config), dict())
- assert 'JARACO' in config.read_text(encoding='ascii')
+ self.write_text(str(config), '[names]\nFoO=bAr')
+ setopt.edit_config(str(config), dict(names=dict(oTher='yes')))
+ actual = config.read_text(encoding='ascii')
+ assert 'FoO' in actual
+ assert 'oTher' in actual