Hello community,
here is the log from the commit of package python-packaging for
openSUSE:Factory checked in at 2019-10-10 11:51:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-packaging (Old)
and /work/SRC/openSUSE:Factory/.python-packaging.new.2352 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-packaging"
Thu Oct 10 11:51:41 2019 rev:13 rq:736042 version:19.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-packaging/python-packaging.changes
2019-08-27 15:23:16.772783693 +0200
+++
/work/SRC/openSUSE:Factory/.python-packaging.new.2352/python-packaging.changes
2019-10-10 11:51:43.871594192 +0200
@@ -1,0 +2,12 @@
+Tue Oct 8 09:22:51 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 19.2:
+ * Many buildsystem tweaks to accomodate for distribution shipping
+- Remove all the merged patches:
+ * 0001-Fix-test-failures-test_linux_platforms_manylinux-for.patch
+ * 0002-Fix-check-for-64-bit-OS.patch
+ * 0003-Add-additional-test-to-get-100-branch-coverage.patch
+ * 0004-Fix-test_macos_version_detection-failure-on-32-bit-L.patch
+ * 0005-Drop-dependency-on-attrs.patch
+
+-------------------------------------------------------------------
Old:
----
0001-Fix-test-failures-test_linux_platforms_manylinux-for.patch
0002-Fix-check-for-64-bit-OS.patch
0003-Add-additional-test-to-get-100-branch-coverage.patch
0004-Fix-test_macos_version_detection-failure-on-32-bit-L.patch
0005-Drop-dependency-on-attrs.patch
packaging-19.1.tar.gz
New:
----
packaging-19.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-packaging.spec ++++++
--- /var/tmp/diff_new_pack.rFT0a8/_old 2019-10-10 11:51:44.959591305 +0200
+++ /var/tmp/diff_new_pack.rFT0a8/_new 2019-10-10 11:51:44.959591305 +0200
@@ -26,19 +26,13 @@
%bcond_with test
%endif
Name: python-packaging%{psuffix}
-Version: 19.1
+Version: 19.2
Release: 0
Summary: Core utilities for Python packages
License: Apache-2.0
Group: Development/Languages/Python
URL: https://github.com/pypa/packaging
Source:
https://pypi.io/packages/source/p/packaging/packaging-%{version}.tar.gz
-# FIXME: drop these patches on the next release after 19.1
-Patch0: 0001-Fix-test-failures-test_linux_platforms_manylinux-for.patch
-Patch1: 0002-Fix-check-for-64-bit-OS.patch
-Patch2: 0003-Add-additional-test-to-get-100-branch-coverage.patch
-Patch3: 0004-Fix-test_macos_version_detection-failure-on-32-bit-L.patch
-Patch4: 0005-Drop-dependency-on-attrs.patch
BuildRequires: %{python_module six}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -61,17 +55,9 @@
%prep
%setup -q -n packaging-%{version}
-%patch0 -p1
-%patch1 -p1
-%patch2 -p1
-%patch3 -p1
-%patch4 -p1
# sdist must provide a packaging.egg-info, used below in install phase
test -d packaging.egg-info
-# FIXME: drop this on the next release after 19.1
-sed -i '/^attrs/d' packaging.egg-info/requires.txt
-
%build
%python_build
++++++ packaging-19.1.tar.gz -> packaging-19.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-19.1/CHANGELOG.rst
new/packaging-19.2/CHANGELOG.rst
--- old/packaging-19.1/CHANGELOG.rst 2019-07-30 08:28:22.000000000 +0200
+++ new/packaging-19.2/CHANGELOG.rst 2019-09-19 00:19:32.000000000 +0200
@@ -1,6 +1,21 @@
Changelog
---------
+19.2 - 2019-09-18
+~~~~~~~~~~~~~~~~~
+
+* Remove dependency on ``attrs`` (:issue:`178`, :issue:`179`)
+
+* Use appropriate fallbacks for CPython ABI tag (:issue:`181`, :issue:`185`)
+
+* Add manylinux2014 support (:issue:`186`)
+
+* Improve ABI detection (:issue:`181`)
+
+* Properly handle debug wheels for Python 3.8 (:issue:`172`)
+
+* Improve detection of debug builds on Windows (:issue:`194`)
+
19.1 - 2019-07-30
~~~~~~~~~~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-19.1/PKG-INFO new/packaging-19.2/PKG-INFO
--- old/packaging-19.1/PKG-INFO 2019-07-30 08:32:32.000000000 +0200
+++ new/packaging-19.2/PKG-INFO 2019-09-19 00:21:41.000000000 +0200
@@ -1,6 +1,6 @@
-Metadata-Version: 1.2
+Metadata-Version: 2.1
Name: packaging
-Version: 19.1
+Version: 19.2
Summary: Core utilities for Python packages
Home-page: https://github.com/pypa/packaging
Author: Donald Stufft and individual contributors
@@ -74,6 +74,21 @@
Changelog
---------
+ 19.2 - 2019-09-18
+ ~~~~~~~~~~~~~~~~~
+
+ * Remove dependency on ``attrs`` (`#178
<https://github.com/pypa/packaging/issues/178>`__, `#179
<https://github.com/pypa/packaging/issues/179>`__)
+
+ * Use appropriate fallbacks for CPython ABI tag (`#181
<https://github.com/pypa/packaging/issues/181>`__, `#185
<https://github.com/pypa/packaging/issues/185>`__)
+
+ * Add manylinux2014 support (`#186
<https://github.com/pypa/packaging/issues/186>`__)
+
+ * Improve ABI detection (`#181
<https://github.com/pypa/packaging/issues/181>`__)
+
+ * Properly handle debug wheels for Python 3.8 (`#172
<https://github.com/pypa/packaging/issues/172>`__)
+
+ * Improve detection of debug builds on Windows (`#194
<https://github.com/pypa/packaging/issues/194>`__)
+
19.1 - 2019-07-30
~~~~~~~~~~~~~~~~~
@@ -304,3 +319,4 @@
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
+Description-Content-Type: text/x-rst
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-19.1/docs/development/release-process.rst
new/packaging-19.2/docs/development/release-process.rst
--- old/packaging-19.1/docs/development/release-process.rst 2019-07-20
07:02:52.000000000 +0200
+++ new/packaging-19.2/docs/development/release-process.rst 2019-09-19
00:20:03.000000000 +0200
@@ -2,7 +2,8 @@
===============
#. Checkout the current ``master`` branch, with a clean working directory.
-#. Modify the ``CHANGELOG.rst`` to include changes made since the last release.
+#. Modify the ``CHANGELOG.rst`` to include changes made since the last release
+ and update the section header for the new release.
#. Bump the version in ``packaging/__about__.py``
#. Install the latest ``setuptools``, ``wheel`` and ``twine`` packages
@@ -22,5 +23,11 @@
$ twine upload dist/*
+#. Create a
+ `release on GitHub <https://github.com/pypa/packaging/releases>`_ and
+ include the artifacts uploaded to PyPI.
+
#. Bump the version for development in ``packaging/__about__.py`` and
``CHANGELOG.rst``.
+
+#. Notify the other project owners of the release.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-19.1/packaging/__about__.py
new/packaging-19.2/packaging/__about__.py
--- old/packaging-19.1/packaging/__about__.py 2019-07-30 08:28:34.000000000
+0200
+++ new/packaging-19.2/packaging/__about__.py 2019-09-19 00:17:31.000000000
+0200
@@ -18,7 +18,7 @@
__summary__ = "Core utilities for Python packages"
__uri__ = "https://github.com/pypa/packaging"
-__version__ = "19.1"
+__version__ = "19.2"
__author__ = "Donald Stufft and individual contributors"
__email__ = "[email protected]"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-19.1/packaging/tags.py
new/packaging-19.2/packaging/tags.py
--- old/packaging-19.1/packaging/tags.py 2019-07-20 07:03:21.000000000
+0200
+++ new/packaging-19.2/packaging/tags.py 2019-09-19 00:16:00.000000000
+0200
@@ -5,14 +5,20 @@
from __future__ import absolute_import
import distutils.util
+
+try:
+ from importlib.machinery import EXTENSION_SUFFIXES
+except ImportError: # pragma: no cover
+ import imp
+
+ EXTENSION_SUFFIXES = [x[0] for x in imp.get_suffixes()]
+ del imp
import platform
import re
import sys
import sysconfig
import warnings
-import attr
-
INTERPRETER_SHORT_NAMES = {
"python": "py", # Generic.
@@ -26,14 +32,39 @@
_32_BIT_INTERPRETER = sys.maxsize <= 2 ** 32
[email protected](frozen=True, repr=False)
class Tag(object):
- interpreter = attr.ib(converter=str.lower)
- abi = attr.ib(converter=str.lower)
- platform = attr.ib(converter=str.lower)
+
+ __slots__ = ["_interpreter", "_abi", "_platform"]
+
+ def __init__(self, interpreter, abi, platform):
+ self._interpreter = interpreter.lower()
+ self._abi = abi.lower()
+ self._platform = platform.lower()
+
+ @property
+ def interpreter(self):
+ return self._interpreter
+
+ @property
+ def abi(self):
+ return self._abi
+
+ @property
+ def platform(self):
+ return self._platform
+
+ def __eq__(self, other):
+ return (
+ (self.platform == other.platform)
+ and (self.abi == other.abi)
+ and (self.interpreter == other.interpreter)
+ )
+
+ def __hash__(self):
+ return hash((self._interpreter, self._abi, self._platform))
def __str__(self):
- return "{}-{}-{}".format(self.interpreter, self.abi, self.platform)
+ return "{}-{}-{}".format(self._interpreter, self._abi, self._platform)
def __repr__(self):
return "<{self} @ {self_id}>".format(self=self, self_id=id(self))
@@ -58,30 +89,48 @@
return "cp{major}{minor}".format(major=py_version[0], minor=py_version[1])
-# TODO: This code is simpler compared to pep425tags as CPython 2.7 didn't seem
-# to need the fallbacks. Is that acceptable?
-def _cpython_abi(py_version):
- soabi = sysconfig.get_config_var("SOABI")
- if soabi:
- options = soabi.split("-", 2)[1]
- else:
- found_options = [str(py_version[0]), str(py_version[1])]
- if sysconfig.get_config_var("Py_DEBUG"):
- found_options.append("d")
- if sysconfig.get_config_var("WITH_PYMALLOC"):
- found_options.append("m")
- if sysconfig.get_config_var("Py_UNICODE_SIZE") == 4:
- found_options.append("u")
- options = "".join(found_options)
- return "cp{options}".format(options=options)
+def _cpython_abis(py_version):
+ abis = []
+ version = "{}{}".format(*py_version[:2])
+ debug = pymalloc = ucs4 = ""
+ with_debug = sysconfig.get_config_var("Py_DEBUG")
+ has_refcount = hasattr(sys, "gettotalrefcount")
+ # Windows doesn't set Py_DEBUG, so checking for support of debug-compiled
+ # extension modules is the best option.
+ # https://github.com/pypa/pip/issues/3383#issuecomment-173267692
+ has_ext = "_d.pyd" in EXTENSION_SUFFIXES
+ if with_debug or (with_debug is None and (has_refcount or has_ext)):
+ debug = "d"
+ if py_version < (3, 8):
+ with_pymalloc = sysconfig.get_config_var("WITH_PYMALLOC")
+ if with_pymalloc or with_pymalloc is None:
+ pymalloc = "m"
+ if py_version < (3, 3):
+ unicode_size = sysconfig.get_config_var("Py_UNICODE_SIZE")
+ if unicode_size == 4 or (
+ unicode_size is None and sys.maxunicode == 0x10FFFF
+ ):
+ ucs4 = "u"
+ elif debug:
+ # Debug builds can also load "normal" extension modules.
+ # We can also assume no UCS-4 or pymalloc requirement.
+ abis.append("cp{version}".format(version=version))
+ abis.insert(
+ 0,
+ "cp{version}{debug}{pymalloc}{ucs4}".format(
+ version=version, debug=debug, pymalloc=pymalloc, ucs4=ucs4
+ ),
+ )
+ return abis
-def _cpython_tags(py_version, interpreter, abi, platforms):
- for tag in (Tag(interpreter, abi, platform) for platform in platforms):
- yield tag
- for tag in (Tag(interpreter, "abi3", platform) for platform in platforms):
+def _cpython_tags(py_version, interpreter, abis, platforms):
+ for abi in abis:
+ for platform_ in platforms:
+ yield Tag(interpreter, abi, platform_)
+ for tag in (Tag(interpreter, "abi3", platform_) for platform_ in
platforms):
yield tag
- for tag in (Tag(interpreter, "none", platform) for platform in platforms):
+ for tag in (Tag(interpreter, "none", platform_) for platform_ in
platforms):
yield tag
# PEP 384 was first implemented in Python 3.2.
for minor_version in range(py_version[1] - 1, 1, -1):
@@ -155,38 +204,37 @@
def _mac_arch(arch, is_32bit=_32_BIT_INTERPRETER):
- if is_32bit:
- if arch.startswith("ppc"):
- return "ppc"
- else:
- return "i386"
- else:
+ if not is_32bit:
return arch
+ if arch.startswith("ppc"):
+ return "ppc"
+
+ return "i386"
+
def _mac_binary_formats(version, cpu_arch):
formats = [cpu_arch]
if cpu_arch == "x86_64":
- if version >= (10, 4):
- formats.extend(["intel", "fat64", "fat32"])
- else:
+ if version < (10, 4):
return []
+ formats.extend(["intel", "fat64", "fat32"])
+
elif cpu_arch == "i386":
- if version >= (10, 4):
- formats.extend(["intel", "fat32", "fat"])
- else:
+ if version < (10, 4):
return []
+ formats.extend(["intel", "fat32", "fat"])
+
elif cpu_arch == "ppc64":
# TODO: Need to care about 32-bit PPC for ppc64 through 10.2?
if version > (10, 5) or version < (10, 4):
return []
- else:
- formats.append("fat64")
+ formats.append("fat64")
+
elif cpu_arch == "ppc":
- if version <= (10, 6):
- formats.extend(["fat32", "fat"])
- else:
+ if version > (10, 6):
return []
+ formats.extend(["fat32", "fat"])
formats.append("universal")
return formats
@@ -286,9 +334,11 @@
linux = _normalize_string(distutils.util.get_platform())
if linux == "linux_x86_64" and is_32bit:
linux = "linux_i686"
- # manylinux1: CentOS 5 w/ glibc 2.5.
- # manylinux2010: CentOS 6 w/ glibc 2.12.
- manylinux_support = ("manylinux2010", (2, 12)), ("manylinux1", (2, 5))
+ manylinux_support = (
+ ("manylinux2014", (2, 17)), # CentOS 7 w/ glibc 2.17 (PEP 599)
+ ("manylinux2010", (2, 12)), # CentOS 6 w/ glibc 2.12 (PEP 571)
+ ("manylinux1", (2, 5)), # CentOS 5 w/ glibc 2.5 (PEP 513)
+ )
manylinux_support_iter = iter(manylinux_support)
for name, glibc_version in manylinux_support_iter:
if _is_manylinux_compatible(name, glibc_version):
@@ -337,8 +387,8 @@
if interpreter_name == "cp":
interpreter = _cpython_interpreter(py_version)
- abi = _cpython_abi(py_version)
- for tag in _cpython_tags(py_version, interpreter, abi, platforms):
+ abis = _cpython_abis(py_version)
+ for tag in _cpython_tags(py_version, interpreter, abis, platforms):
yield tag
elif interpreter_name == "pp":
interpreter = _pypy_interpreter()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-19.1/packaging.egg-info/PKG-INFO
new/packaging-19.2/packaging.egg-info/PKG-INFO
--- old/packaging-19.1/packaging.egg-info/PKG-INFO 2019-07-30
08:32:32.000000000 +0200
+++ new/packaging-19.2/packaging.egg-info/PKG-INFO 2019-09-19
00:21:41.000000000 +0200
@@ -1,6 +1,6 @@
-Metadata-Version: 1.2
+Metadata-Version: 2.1
Name: packaging
-Version: 19.1
+Version: 19.2
Summary: Core utilities for Python packages
Home-page: https://github.com/pypa/packaging
Author: Donald Stufft and individual contributors
@@ -74,6 +74,21 @@
Changelog
---------
+ 19.2 - 2019-09-18
+ ~~~~~~~~~~~~~~~~~
+
+ * Remove dependency on ``attrs`` (`#178
<https://github.com/pypa/packaging/issues/178>`__, `#179
<https://github.com/pypa/packaging/issues/179>`__)
+
+ * Use appropriate fallbacks for CPython ABI tag (`#181
<https://github.com/pypa/packaging/issues/181>`__, `#185
<https://github.com/pypa/packaging/issues/185>`__)
+
+ * Add manylinux2014 support (`#186
<https://github.com/pypa/packaging/issues/186>`__)
+
+ * Improve ABI detection (`#181
<https://github.com/pypa/packaging/issues/181>`__)
+
+ * Properly handle debug wheels for Python 3.8 (`#172
<https://github.com/pypa/packaging/issues/172>`__)
+
+ * Improve detection of debug builds on Windows (`#194
<https://github.com/pypa/packaging/issues/194>`__)
+
19.1 - 2019-07-30
~~~~~~~~~~~~~~~~~
@@ -304,3 +319,4 @@
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
+Description-Content-Type: text/x-rst
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-19.1/packaging.egg-info/requires.txt
new/packaging-19.2/packaging.egg-info/requires.txt
--- old/packaging-19.1/packaging.egg-info/requires.txt 2019-07-30
08:32:32.000000000 +0200
+++ new/packaging-19.2/packaging.egg-info/requires.txt 2019-09-19
00:21:41.000000000 +0200
@@ -1,3 +1,2 @@
-attrs
pyparsing>=2.0.2
six
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-19.1/setup.py new/packaging-19.2/setup.py
--- old/packaging-19.1/setup.py 2019-07-20 07:17:29.000000000 +0200
+++ new/packaging-19.2/setup.py 2019-09-19 00:21:32.000000000 +0200
@@ -43,12 +43,13 @@
version=about["__version__"],
description=about["__summary__"],
long_description=long_description,
+ long_description_content_type="text/x-rst",
license=about["__license__"],
url=about["__uri__"],
author=about["__author__"],
author_email=about["__email__"],
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
- install_requires=["attrs", "pyparsing>=2.0.2", "six"], # Needed to avoid
issue #91
+ install_requires=["pyparsing>=2.0.2", "six"], # Needed to avoid issue #91
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-19.1/tests/test_tags.py
new/packaging-19.2/tests/test_tags.py
--- old/packaging-19.1/tests/test_tags.py 2019-07-20 07:03:21.000000000
+0200
+++ new/packaging-19.2/tests/test_tags.py 2019-09-19 00:16:00.000000000
+0200
@@ -11,6 +11,7 @@
import distutils.util
import platform
+import re
import sys
import sysconfig
import types
@@ -26,6 +27,16 @@
return tags.Tag("py3", "none", "any")
[email protected]
+def is_x86():
+ return re.match(r"(i\d86|x86_64)", platform.machine()) is not None
+
+
[email protected]
+def is_64bit_os():
+ return platform.architecture()[0] == "64bit"
+
+
def test_tag_lowercasing():
tag = tags.Tag("PY3", "None", "ANY")
assert tag.interpreter == "py3"
@@ -43,6 +54,12 @@
assert example_tag in tags
+def test_tag_hash_equality(example_tag):
+ equal_tag = tags.Tag("py3", "none", "any")
+ assert example_tag == equal_tag
+ assert example_tag.__hash__() == equal_tag.__hash__()
+
+
def test_tag_str(example_tag):
assert str(example_tag) == "py3-none-any"
@@ -172,63 +189,71 @@
def test_macos_arch_detection(arch, monkeypatch):
if platform.system() != "Darwin" or platform.mac_ver()[2] != arch:
monkeypatch.setattr(platform, "mac_ver", lambda: ("10.14", ("", "",
""), arch))
+ monkeypatch.setattr(tags, "_mac_arch", lambda *args: arch)
assert tags._mac_platforms((10, 14))[0].endswith(arch)
-def test_cpython_abi_py3(monkeypatch):
- has_soabi = bool(sysconfig.get_config_var("SOABI"))
- if platform.python_implementation() != "CPython" or not has_soabi:
- monkeypatch.setattr(
- sysconfig, "get_config_var", lambda key: "'cpython-37m-darwin'"
- )
- soabi = sysconfig.get_config_var("SOABI").split("-", 2)[1]
- result = tags._cpython_abi(sys.version_info[:2])
- assert result == "cp{soabi}".format(soabi=soabi)
[email protected](
+ "py_debug,gettotalrefcount,result",
+ [(1, False, True), (0, False, False), (None, True, True)],
+)
+def test_cpython_abis_debug(py_debug, gettotalrefcount, result, monkeypatch):
+ config = {"Py_DEBUG": py_debug, "WITH_PYMALLOC": 0, "Py_UNICODE_SIZE": 2}
+ monkeypatch.setattr(sysconfig, "get_config_var", config.__getitem__)
+ if gettotalrefcount:
+ monkeypatch.setattr(sys, "gettotalrefcount", 1, raising=False)
+ expected = ["cp37d" if result else "cp37"]
+ assert tags._cpython_abis((3, 7)) == expected
+
+
+def test_cpython_abis_debug_file_extension(monkeypatch):
+ config = {"Py_DEBUG": None}
+ monkeypatch.setattr(sysconfig, "get_config_var", config.__getitem__)
+ monkeypatch.delattr(sys, "gettotalrefcount", raising=False)
+ monkeypatch.setattr(tags, "EXTENSION_SUFFIXES", {"_d.pyd"})
+ assert tags._cpython_abis((3, 8)) == ["cp38d", "cp38"]
+
+
[email protected](
+ "debug,expected", [(True, ["cp38d", "cp38"]), (False, ["cp38"])]
+)
+def test_cpython_abis_debug_38(debug, expected, monkeypatch):
+ config = {"Py_DEBUG": debug}
+ monkeypatch.setattr(sysconfig, "get_config_var", config.__getitem__)
+ assert tags._cpython_abis((3, 8)) == expected
@pytest.mark.parametrize(
- "debug,pymalloc,unicode_width",
+ "pymalloc,version,result",
+ [(1, (3, 7), True), (0, (3, 7), False), (None, (3, 7), True), (1, (3, 8),
False)],
+)
+def test_cpython_abis_pymalloc(pymalloc, version, result, monkeypatch):
+ config = {"Py_DEBUG": 0, "WITH_PYMALLOC": pymalloc, "Py_UNICODE_SIZE": 2}
+ monkeypatch.setattr(sysconfig, "get_config_var", config.__getitem__)
+ base_abi = "cp{}{}".format(version[0], version[1])
+ expected = [base_abi + "m" if result else base_abi]
+ assert tags._cpython_abis(version) == expected
+
+
[email protected](
+ "unicode_size,maxunicode,version,result",
[
- (False, False, 2),
- (True, False, 2),
- (False, True, 2),
- (False, False, 4),
- (True, True, 2),
- (False, True, 4),
- (True, True, 4),
+ (4, 0x10FFFF, (3, 2), True),
+ (2, 0xFFFF, (3, 2), False),
+ (None, 0x10FFFF, (3, 2), True),
+ (None, 0xFFFF, (3, 2), False),
+ (4, 0x10FFFF, (3, 3), False),
],
)
-def test_cpython_abi_py2(debug, pymalloc, unicode_width, monkeypatch):
- has_soabi = sysconfig.get_config_var("SOABI")
- if platform.python_implementation() != "CPython" or has_soabi:
- diff_debug = debug != sysconfig.get_config_var("Py_DEBUG")
- diff_malloc = pymalloc != sysconfig.get_config_var("WITH_PYMALLOC")
- unicode_size = sysconfig.get_config_var("Py_UNICODE_SIZE")
- diff_unicode_size = unicode_size != unicode_width
- if diff_debug or diff_malloc or diff_unicode_size:
- config_vars = {
- "SOABI": None,
- "Py_DEBUG": int(debug),
- "WITH_PYMALLOC": int(pymalloc),
- "Py_UNICODE_SIZE": unicode_width,
- }
- monkeypatch.setattr(sysconfig, "get_config_var",
config_vars.__getitem__)
- else:
- config_vars = {
- "SOABI": None,
- "Py_DEBUG": int(debug),
- "WITH_PYMALLOC": int(pymalloc),
- "Py_UNICODE_SIZE": unicode_width,
- }
- monkeypatch.setattr(sysconfig, "get_config_var",
config_vars.__getitem__)
- options = ""
- if debug:
- options += "d"
- if pymalloc:
- options += "m"
- if unicode_width == 4:
- options += "u"
- assert "cp33{}".format(options) == tags._cpython_abi((3, 3))
+def test_cpython_abis_wide_unicode(
+ unicode_size, maxunicode, version, result, monkeypatch
+):
+ config = {"Py_DEBUG": 0, "WITH_PYMALLOC": 0, "Py_UNICODE_SIZE":
unicode_size}
+ monkeypatch.setattr(sysconfig, "get_config_var", config.__getitem__)
+ monkeypatch.setattr(sys, "maxunicode", maxunicode)
+ base_abi = "cp{}{}".format(version[0], version[1])
+ expected = [base_abi + "u" if result else base_abi]
+ assert tags._cpython_abis(version) == expected
def test_independent_tags():
@@ -254,7 +279,32 @@
def test_cpython_tags():
- result = list(tags._cpython_tags((3, 3), "cp33", "cp33m", ["plat1",
"plat2"]))
+ result = list(
+ tags._cpython_tags((3, 8), "cp38", ["cp38d", "cp38"], ["plat1",
"plat2"])
+ )
+ assert result == [
+ tags.Tag("cp38", "cp38d", "plat1"),
+ tags.Tag("cp38", "cp38d", "plat2"),
+ tags.Tag("cp38", "cp38", "plat1"),
+ tags.Tag("cp38", "cp38", "plat2"),
+ tags.Tag("cp38", "abi3", "plat1"),
+ tags.Tag("cp38", "abi3", "plat2"),
+ tags.Tag("cp38", "none", "plat1"),
+ tags.Tag("cp38", "none", "plat2"),
+ tags.Tag("cp37", "abi3", "plat1"),
+ tags.Tag("cp37", "abi3", "plat2"),
+ tags.Tag("cp36", "abi3", "plat1"),
+ tags.Tag("cp36", "abi3", "plat2"),
+ tags.Tag("cp35", "abi3", "plat1"),
+ tags.Tag("cp35", "abi3", "plat2"),
+ tags.Tag("cp34", "abi3", "plat1"),
+ tags.Tag("cp34", "abi3", "plat2"),
+ tags.Tag("cp33", "abi3", "plat1"),
+ tags.Tag("cp33", "abi3", "plat2"),
+ tags.Tag("cp32", "abi3", "plat1"),
+ tags.Tag("cp32", "abi3", "plat2"),
+ ]
+ result = list(tags._cpython_tags((3, 3), "cp33", ["cp33m"], ["plat1",
"plat2"]))
assert result == [
tags.Tag("cp33", "cp33m", "plat1"),
tags.Tag("cp33", "cp33m", "plat2"),
@@ -270,16 +320,17 @@
def test_sys_tags_on_mac_cpython(monkeypatch):
if platform.python_implementation() != "CPython":
monkeypatch.setattr(platform, "python_implementation", lambda:
"CPython")
- monkeypatch.setattr(tags, "_cpython_abi", lambda py_version: "cp33m")
+ monkeypatch.setattr(tags, "_cpython_abis", lambda py_version:
["cp33m"])
if platform.system() != "Darwin":
monkeypatch.setattr(platform, "system", lambda: "Darwin")
monkeypatch.setattr(tags, "_mac_platforms", lambda:
["macosx_10_5_x86_64"])
- abi = tags._cpython_abi(sys.version_info[:2])
+ abis = tags._cpython_abis(sys.version_info[:2])
platforms = tags._mac_platforms()
result = list(tags.sys_tags())
+ assert len(abis) == 1
assert result[0] == tags.Tag(
"cp{major}{minor}".format(major=sys.version_info[0],
minor=sys.version_info[1]),
- abi,
+ abis[0],
platforms[0],
)
assert result[-1] == tags.Tag("py{}0".format(sys.version_info[0]), "none",
"any")
@@ -382,17 +433,18 @@
def test_sys_tags_on_windows_cpython(monkeypatch):
if platform.python_implementation() != "CPython":
monkeypatch.setattr(platform, "python_implementation", lambda:
"CPython")
- monkeypatch.setattr(tags, "_cpython_abi", lambda py_version: "cp33m")
+ monkeypatch.setattr(tags, "_cpython_abis", lambda py_version:
["cp33m"])
if platform.system() != "Windows":
monkeypatch.setattr(platform, "system", lambda: "Windows")
monkeypatch.setattr(tags, "_generic_platforms", lambda: ["win_amd64"])
- abi = tags._cpython_abi(sys.version_info[:2])
+ abis = tags._cpython_abis(sys.version_info[:2])
platforms = tags._generic_platforms()
result = list(tags.sys_tags())
interpreter = "cp{major}{minor}".format(
major=sys.version_info[0], minor=sys.version_info[1]
)
- expected = tags.Tag(interpreter, abi, platforms[0])
+ assert len(abis) == 1
+ expected = tags.Tag(interpreter, abis[0], platforms[0])
assert result[0] == expected
expected = tags.Tag("py{}0".format(sys.version_info[0]), "none", "any")
assert result[-1] == expected
@@ -486,24 +538,29 @@
assert not tags._have_compatible_glibc(2, 4)
-def test_linux_platforms_64bit_on_64bit_os(monkeypatch):
- is_64bit_os = distutils.util.get_platform().endswith("_x86_64")
- if platform.system() != "Linux" or not is_64bit_os:
+def test_linux_platforms_64bit_on_64bit_os(is_64bit_os, is_x86, monkeypatch):
+ if platform.system() != "Linux" or not is_64bit_os or not is_x86:
monkeypatch.setattr(distutils.util, "get_platform", lambda:
"linux_x86_64")
monkeypatch.setattr(tags, "_is_manylinux_compatible", lambda *args:
False)
linux_platform = tags._linux_platforms(is_32bit=False)[-1]
assert linux_platform == "linux_x86_64"
-def test_linux_platforms_32bit_on_64bit_os(monkeypatch):
- is_64bit_os = distutils.util.get_platform().endswith("_x86_64")
- if platform.system() != "Linux" or not is_64bit_os:
+def test_linux_platforms_32bit_on_64bit_os(is_64bit_os, is_x86, monkeypatch):
+ if platform.system() != "Linux" or not is_64bit_os or not is_x86:
monkeypatch.setattr(distutils.util, "get_platform", lambda:
"linux_x86_64")
monkeypatch.setattr(tags, "_is_manylinux_compatible", lambda *args:
False)
linux_platform = tags._linux_platforms(is_32bit=True)[-1]
assert linux_platform == "linux_i686"
+def test_linux_platforms_manylinux_unsupported(monkeypatch):
+ monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_x86_64")
+ monkeypatch.setattr(tags, "_is_manylinux_compatible", lambda *args: False)
+ linux_platform = tags._linux_platforms(is_32bit=False)
+ assert linux_platform == ["linux_x86_64"]
+
+
def test_linux_platforms_manylinux1(monkeypatch):
monkeypatch.setattr(
tags, "_is_manylinux_compatible", lambda name, _: name == "manylinux1"
@@ -511,7 +568,8 @@
if platform.system() != "Linux":
monkeypatch.setattr(distutils.util, "get_platform", lambda:
"linux_x86_64")
platforms = tags._linux_platforms(is_32bit=False)
- assert platforms == ["manylinux1_x86_64", "linux_x86_64"]
+ arch = platform.machine()
+ assert platforms == ["manylinux1_" + arch, "linux_" + arch]
def test_linux_platforms_manylinux2010(monkeypatch):
@@ -521,24 +579,43 @@
if platform.system() != "Linux":
monkeypatch.setattr(distutils.util, "get_platform", lambda:
"linux_x86_64")
platforms = tags._linux_platforms(is_32bit=False)
- expected = ["manylinux2010_x86_64", "manylinux1_x86_64", "linux_x86_64"]
+ arch = platform.machine()
+ expected = ["manylinux2010_" + arch, "manylinux1_" + arch, "linux_" + arch]
+ assert platforms == expected
+
+
+def test_linux_platforms_manylinux2014(monkeypatch):
+ monkeypatch.setattr(
+ tags, "_is_manylinux_compatible", lambda name, _: name ==
"manylinux2014"
+ )
+ if platform.system() != "Linux":
+ monkeypatch.setattr(distutils.util, "get_platform", lambda:
"linux_x86_64")
+ platforms = tags._linux_platforms(is_32bit=False)
+ arch = platform.machine()
+ expected = [
+ "manylinux2014_" + arch,
+ "manylinux2010_" + arch,
+ "manylinux1_" + arch,
+ "linux_" + arch,
+ ]
assert platforms == expected
def test_sys_tags_linux_cpython(monkeypatch):
if platform.python_implementation() != "CPython":
monkeypatch.setattr(platform, "python_implementation", lambda:
"CPython")
- monkeypatch.setattr(tags, "_cpython_abi", lambda py_version: "cp33m")
+ monkeypatch.setattr(tags, "_cpython_abis", lambda py_version:
["cp33m"])
if platform.system() != "Linux":
monkeypatch.setattr(platform, "system", lambda: "Linux")
monkeypatch.setattr(tags, "_linux_platforms", lambda: ["linux_x86_64"])
- abi = tags._cpython_abi(sys.version_info[:2])
+ abis = tags._cpython_abis(sys.version_info[:2])
platforms = tags._linux_platforms()
result = list(tags.sys_tags())
expected_interpreter = "cp{major}{minor}".format(
major=sys.version_info[0], minor=sys.version_info[1]
)
- assert result[0] == tags.Tag(expected_interpreter, abi, platforms[0])
+ assert len(abis) == 1
+ assert result[0] == tags.Tag(expected_interpreter, abis[0], platforms[0])
expected = tags.Tag("py{}0".format(sys.version_info[0]), "none", "any")
assert result[-1] == expected