1 |
Signed-off-by: Michał Górny <mgorny@g.o> |
2 |
--- |
3 |
eclass/pypi.eclass | 5 +++-- |
4 |
eclass/tests/pypi.sh | 33 +++++++++++++++++++++++++++++++++ |
5 |
2 files changed, 36 insertions(+), 2 deletions(-) |
6 |
|
7 |
diff --git a/eclass/pypi.eclass b/eclass/pypi.eclass |
8 |
index 3a37214f8977..c7b9604807eb 100644 |
9 |
--- a/eclass/pypi.eclass |
10 |
+++ b/eclass/pypi.eclass |
11 |
@@ -82,7 +82,8 @@ pypi_sdist_url() { |
12 |
# @DESCRIPTION: |
13 |
# Output the wheel filename for the specified project/version tuple. |
14 |
# |
15 |
-# If <package> is unspecified, it defaults to ${PN}. |
16 |
+# If <package> is unspecified, it defaults to ${PN}. The package name |
17 |
+# is normalized according to the wheel specification. |
18 |
# |
19 |
# If <version> is unspecified, it defaults to ${PV}. |
20 |
# |
21 |
@@ -97,7 +98,7 @@ pypi_wheel_name() { |
22 |
die "Usage: ${FUNCNAME} <project> [<version> [<python-tag> [<abi-platform-tag>]]]" |
23 |
fi |
24 |
|
25 |
- local project=${1-"${PN}"} |
26 |
+ local project=$(pypi_normalize_name "${1-"${PN}"}") |
27 |
local version=${2-"${PV}"} |
28 |
local pytag=${3-py3} |
29 |
local abitag=${4-none-any} |
30 |
diff --git a/eclass/tests/pypi.sh b/eclass/tests/pypi.sh |
31 |
index 67b2c3c481fb..111b61380fe4 100755 |
32 |
--- a/eclass/tests/pypi.sh |
33 |
+++ b/eclass/tests/pypi.sh |
34 |
@@ -29,4 +29,37 @@ test-eq "pypi_normalize_name foo___bar" foo_bar |
35 |
test-eq "pypi_normalize_name Flask-BabelEx" flask_babelex |
36 |
test-eq "pypi_normalize_name jaraco.context" jaraco_context |
37 |
|
38 |
+PN=Foo.Bar |
39 |
+PV=1.2.3 |
40 |
+ |
41 |
+test-eq "pypi_wheel_name" foo_bar-1.2.3-py3-none-any.whl |
42 |
+test-eq "pypi_wheel_name Flask-BabelEx" flask_babelex-1.2.3-py3-none-any.whl |
43 |
+test-eq "pypi_wheel_name Flask-BabelEx 4" flask_babelex-4-py3-none-any.whl |
44 |
+test-eq "pypi_wheel_name Flask-BabelEx 4 py2.py3" \ |
45 |
+ flask_babelex-4-py2.py3-none-any.whl |
46 |
+test-eq "pypi_wheel_name cryptography 39.0.1 cp36 abi3-manylinux_2_28_x86_64" \ |
47 |
+ cryptography-39.0.1-cp36-abi3-manylinux_2_28_x86_64.whl |
48 |
+ |
49 |
+test-eq "pypi_wheel_url" \ |
50 |
+ https://files.pythonhosted.org/packages/py3/F/Foo.Bar/foo_bar-1.2.3-py3-none-any.whl |
51 |
+test-eq "pypi_wheel_url Flask-BabelEx" \ |
52 |
+ https://files.pythonhosted.org/packages/py3/F/Flask-BabelEx/flask_babelex-1.2.3-py3-none-any.whl |
53 |
+test-eq "pypi_wheel_url Flask-BabelEx 4" \ |
54 |
+ https://files.pythonhosted.org/packages/py3/F/Flask-BabelEx/flask_babelex-4-py3-none-any.whl |
55 |
+test-eq "pypi_wheel_url Flask-BabelEx 4 py2.py3" \ |
56 |
+ https://files.pythonhosted.org/packages/py2.py3/F/Flask-BabelEx/flask_babelex-4-py2.py3-none-any.whl |
57 |
+test-eq "pypi_wheel_url cryptography 39.0.1 cp36 abi3-manylinux_2_28_x86_64" \ |
58 |
+ https://files.pythonhosted.org/packages/cp36/c/cryptography/cryptography-39.0.1-cp36-abi3-manylinux_2_28_x86_64.whl |
59 |
+ |
60 |
+test-eq "pypi_wheel_url --unpack" \ |
61 |
+ "https://files.pythonhosted.org/packages/py3/F/Foo.Bar/foo_bar-1.2.3-py3-none-any.whl -> foo_bar-1.2.3-py3-none-any.whl.zip" |
62 |
+test-eq "pypi_wheel_url --unpack Flask-BabelEx" \ |
63 |
+ "https://files.pythonhosted.org/packages/py3/F/Flask-BabelEx/flask_babelex-1.2.3-py3-none-any.whl -> flask_babelex-1.2.3-py3-none-any.whl.zip" |
64 |
+test-eq "pypi_wheel_url --unpack Flask-BabelEx 4" \ |
65 |
+ "https://files.pythonhosted.org/packages/py3/F/Flask-BabelEx/flask_babelex-4-py3-none-any.whl -> flask_babelex-4-py3-none-any.whl.zip" |
66 |
+test-eq "pypi_wheel_url --unpack Flask-BabelEx 4 py2.py3" \ |
67 |
+ "https://files.pythonhosted.org/packages/py2.py3/F/Flask-BabelEx/flask_babelex-4-py2.py3-none-any.whl -> flask_babelex-4-py2.py3-none-any.whl.zip" |
68 |
+test-eq "pypi_wheel_url --unpack cryptography 39.0.1 cp36 abi3-manylinux_2_28_x86_64" \ |
69 |
+ "https://files.pythonhosted.org/packages/cp36/c/cryptography/cryptography-39.0.1-cp36-abi3-manylinux_2_28_x86_64.whl -> cryptography-39.0.1-cp36-abi3-manylinux_2_28_x86_64.whl.zip" |
70 |
+ |
71 |
texit |
72 |
-- |
73 |
2.39.1 |