Skip to content

Commit

Permalink
build: remove 'm' and 'd' ABI tags for Python 3.8 wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
koehlma authored Apr 21, 2020
1 parent dad6b08 commit dbc1e1b
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 11 deletions.
25 changes: 14 additions & 11 deletions poetry/masonry/utils/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,22 @@ def get_abi_tag(env):
env,
"Py_DEBUG",
lambda: hasattr(sys, "gettotalrefcount"),
warn=(impl == "cp"),
warn=(impl == "cp" and env.version_info < (3, 8)),
):
d = "d"
if get_flag(env, "WITH_PYMALLOC", lambda: impl == "cp", warn=(impl == "cp")):
m = "m"
if get_flag(
env,
"Py_UNICODE_SIZE",
lambda: sys.maxunicode == 0x10FFFF,
expected=4,
warn=(impl == "cp" and env.version_info < (3, 3)),
) and env.version_info < (3, 3):
u = "u"
if env.version_info < (3, 8):
if get_flag(
env, "WITH_PYMALLOC", lambda: impl == "cp", warn=(impl == "cp")
):
m = "m"
if get_flag(
env,
"Py_UNICODE_SIZE",
lambda: sys.maxunicode == 0x10FFFF,
expected=4,
warn=(impl == "cp" and env.version_info < (3, 3)),
) and env.version_info < (3, 3):
u = "u"
abi = "%s%s%s%s%s" % (impl, get_impl_ver(env), d, m, u)
elif soabi and soabi.startswith("cpython-"):
abi = "cp" + soabi.split("-")[1]
Expand Down
11 changes: 11 additions & 0 deletions poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,7 @@ def __init__(
is_venv=False,
pip_version="19.1",
sys_path=None,
config_vars=None,
**kwargs
):
super(MockEnv, self).__init__(**kwargs)
Expand All @@ -1162,6 +1163,7 @@ def __init__(
self._is_venv = is_venv
self._pip_version = Version.parse(pip_version)
self._sys_path = sys_path
self._config_vars = config_vars

@property
def version_info(self): # type: () -> Tuple[int]
Expand Down Expand Up @@ -1192,3 +1194,12 @@ def sys_path(self):

def is_venv(self): # type: () -> bool
return self._is_venv

def config_var(self, var): # type: (str) -> Any
if self._config_vars is None:
return super().config_var(var)
else:
try:
return self._config_vars[var]
except KeyError:
return None
79 changes: 79 additions & 0 deletions tests/masonry/utils/test_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import pytest

from poetry.masonry.utils.tags import get_abi_tag
from poetry.utils.env import MockEnv


def test_tags_cpython38():
assert (
get_abi_tag(
MockEnv(
version_info=(3, 8, 0),
python_implementation="CPython",
config_vars={"Py_DEBUG": True},
)
)
== "cp38d"
)
assert (
get_abi_tag(
MockEnv(
version_info=(3, 8, 0), python_implementation="CPython", config_vars={},
)
)
== "cp38"
)


def test_tags_cpython37():
assert (
get_abi_tag(
MockEnv(
version_info=(3, 7, 3),
python_implementation="CPython",
config_vars={"Py_DEBUG": True, "WITH_PYMALLOC": True},
)
)
== "cp37dm"
)
assert (
get_abi_tag(
MockEnv(
version_info=(3, 7, 3),
python_implementation="CPython",
config_vars={"Py_DEBUG": True, "WITH_PYMALLOC": False},
)
)
== "cp37d"
)
assert (
get_abi_tag(
MockEnv(
version_info=(3, 7, 3),
python_implementation="CPython",
config_vars={"Py_DEBUG": False, "WITH_PYMALLOC": True},
)
)
== "cp37m"
)
assert (
get_abi_tag(
MockEnv(
version_info=(3, 7, 3),
python_implementation="CPython",
config_vars={"Py_DEBUG": False, "WITH_PYMALLOC": False},
)
)
== "cp37"
)
with pytest.warns(RuntimeWarning):
assert (
get_abi_tag(
MockEnv(
version_info=(3, 7, 3),
python_implementation="CPython",
config_vars={"Py_DEBUG": False},
)
)
== "cp37m"
)

0 comments on commit dbc1e1b

Please sign in to comment.