This is an automated email from the ASF dual-hosted git repository.

juergbi pushed a commit to branch juerg/ci-test
in repository https://gitbox.apache.org/repos/asf/buildstream-plugins.git

commit 85dc81f07bace44e927a0190d670d37511ca9de9
Author: Jürg Billeter <[email protected]>
AuthorDate: Fri Aug 2 17:38:50 2024 +0200

    test
---
 tests/testutils/python_repo.py | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/tests/testutils/python_repo.py b/tests/testutils/python_repo.py
index e26d2c7..04c4e7a 100644
--- a/tests/testutils/python_repo.py
+++ b/tests/testutils/python_repo.py
@@ -39,7 +39,7 @@ HTML_TEMPLATE = """\
     <title>Links for {name}</title>
   </head>
   <body>
-    <a href='{name}-{version}.tar.gz'>{name}-{version}.tar.gz</a><br />
+    <a href='{distname}'>{distname}</a><br />
   </body>
 </html>
 """
@@ -65,7 +65,7 @@ def generate_pip_package(tmpdir, pypi, name, version="0.1", 
dependencies=None):
     if os.path.exists(pypi_package):
         return
 
-    distname = re.sub("[^0-9a-zA-Z]+", "-", name)
+    # distname = re.sub("[^0-9a-zA-Z]+", "-", name)
 
     # create the package source files in tmpdir resulting in a directory
     # tree resembling the following structure:
@@ -109,16 +109,18 @@ def generate_pip_package(tmpdir, pypi, name, 
version="0.1", dependencies=None):
     #
     os.makedirs(pypi_package)
 
+    # copy generated tarfile to pypi package
+    dist_dir = os.path.join(tmpdir, "dist")
+    dist_files = os.listdir(dist_dir)
+    assert len(dist_files) == 1
+    dist_name = dist_files[0]
+    tarpath = os.path.join(dist_dir, dist_name)
+    shutil.copy(tarpath, pypi_package)
+
     # add an index html page
     index_html = os.path.join(pypi_package, "index.html")
     with open(index_html, "w", encoding="utf-8") as f:
-        f.write(HTML_TEMPLATE.format(name=distname, version=version))
-
-    # copy generated tarfile to pypi package
-    dist_dir = os.path.join(tmpdir, "dist")
-    for tar in os.listdir(dist_dir):
-        tarpath = os.path.join(dist_dir, tar)
-        shutil.copy(tarpath, pypi_package)
+        f.write(HTML_TEMPLATE.format(name=name, distname=dist_name))
 
 
 @pytest.fixture

Reply via email to