diff options
Diffstat (limited to '')
-rw-r--r-- | debian/changelog | 62 | ||||
-rw-r--r-- | debian/control | 62 | ||||
-rw-r--r-- | debian/copyright | 30 | ||||
-rw-r--r-- | debian/gbp.conf | 2 | ||||
-rw-r--r-- | debian/patches/search-wheels-for-dist-info | 149 | ||||
-rw-r--r-- | debian/patches/series | 3 | ||||
-rw-r--r-- | debian/patches/skip-script-tests | 34 | ||||
-rw-r--r-- | debian/patches/sphinx-default-theme | 24 | ||||
-rw-r--r-- | debian/python-installer-doc.doc-base | 14 | ||||
-rw-r--r-- | debian/python-installer-doc.docs | 2 | ||||
-rwxr-xr-x | debian/rules | 18 | ||||
-rw-r--r-- | debian/source/format | 1 | ||||
-rw-r--r-- | debian/tests/control | 6 | ||||
-rwxr-xr-x | debian/tests/unittests | 13 | ||||
-rw-r--r-- | debian/upstream/metadata | 10 | ||||
-rw-r--r-- | debian/watch | 3 |
16 files changed, 433 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..3006a76 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,62 @@ +python-installer (0.6.0+dfsg1-1) unstable; urgency=medium + + * New upstream release. + * Refresh patches. + * Bump copyright years. + * Update search-wheels-for-dist-info patch to the current state of the PR. + + -- Stefano Rivera <stefanor@debian.org> Mon, 12 Dec 2022 17:00:20 -0400 + +python-installer (0.5.1+dfsg1-3) unstable; urgency=medium + + * Team upload. + * d/control: Building using the pyproject pybuild plugin. + * d/tests: run tests with all supported python versions. + + -- Louis-Philippe VĂ©ronneau <pollo@debian.org> Fri, 02 Dec 2022 12:48:46 -0500 + +python-installer (0.5.1+dfsg1-2) unstable; urgency=medium + + * Patch: Search wheels for .dist-info directories, rather than expecting + them to match the wheel name. (Closes: #1008606) + * Bump Standards-Version to 4.6.1, no changes needed. + * Fix the nodoc build. + + -- Stefano Rivera <stefanor@debian.org> Mon, 17 Oct 2022 16:17:39 +0200 + +python-installer (0.5.1+dfsg1-1) unstable; urgency=medium + + * New upstream release. + + -- Stefano Rivera <stefanor@debian.org> Fri, 11 Mar 2022 10:39:14 -0400 + +python-installer (0.5.0+dfsg1-2) unstable; urgency=medium + + * Upload to unstable. + + -- Stefano Rivera <stefanor@debian.org> Sat, 19 Feb 2022 07:40:09 -0400 + +python-installer (0.5.0+dfsg1-1) experimental; urgency=medium + + * New upstream release. + * Refresh patches. + * Enable docs build now that python3-myst-parser is available. + - Upload to experimental for the new binary package review. + + -- Stefano Rivera <stefanor@debian.org> Fri, 18 Feb 2022 12:10:54 -0400 + +python-installer (0.4.0+dfsg1-2) unstable; urgency=medium + + * Team upload. + * Source-only upload. + + -- Stefano Rivera <stefanor@debian.org> Sun, 12 Dec 2021 14:52:45 -0400 + +python-installer (0.4.0+dfsg1-1) unstable; urgency=medium + + * Initial release. + - build only the python3-installer module package at this stage; a + separate package for the documentation will be added later when all the + required build-dependencies are available in Debian. + + -- Stuart Prescott <stuart@debian.org> Sat, 13 Nov 2021 17:44:44 +1100 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..6257ea5 --- /dev/null +++ b/debian/control @@ -0,0 +1,62 @@ +Source: python-installer +Section: python +Priority: optional +Maintainer: Debian Python Team <team+python@tracker.debian.org> +Uploaders: + Stuart Prescott <stuart@debian.org>, + Stefano Rivera <stefanor@debian.org>, +Homepage: https://github.com/pypa/installer/ +Vcs-Git: https://salsa.debian.org/python-team/packages/python-installer.git +Vcs-Browser: https://salsa.debian.org/python-team/packages/python-installer/ +Build-Depends: + debhelper-compat (= 13), + dh-python (>> 5.20211016~), + dh-sequence-python3, + dh-sequence-sphinxdoc <!nodoc>, + flit, + pybuild-plugin-pyproject, + python3-all, + python3-mock <!nocheck>, + python3-myst-parser <!nodoc>, + python3-pytest <!nocheck>, + python3-setuptools, + python3-sphinx <!nodoc>, + python3-sphinx-argparse <!nodoc>, +Standards-Version: 4.6.1 +Rules-Requires-Root: no + +Package: python3-installer +Architecture: all +Depends: + ${misc:Depends}, + ${python3:Depends}, +Suggests: + python-installer-doc, +Description: Python library for unpacking and installing wheels + "installer" is a low-level library for installing a Python package from a + wheel distribution; the wheel is the basic unit of Python module + distribution to end users. It provides basic functionality and abstractions + for handling wheels and installing packages from wheels, including: + . + * Logic for "unpacking" a wheel (i.e. installation). + * Abstractions for various parts of the unpacking process. + * Extensible simple implementations of the abstractions. + * Platform-independent Python script wrapper generation. + +Package: python-installer-doc +Architecture: all +Section: doc +Depends: + ${sphinxdoc:Depends}, + ${misc:Depends}, +Multi-Arch: foreign +Description: Python library for unpacking and installing wheels (documentation) + "installer" is a low-level library for installing a Python package from a + wheel distribution; the wheel is the basic unit of Python module + distribution to end users. It provides basic functionality and abstractions + for handling wheels and installing packages from wheels, including: + . + * Logic for "unpacking" a wheel (i.e. installation). + * Abstractions for various parts of the unpacking process. + * Extensible simple implementations of the abstractions. + * Platform-independent Python script wrapper generation. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..102a89d --- /dev/null +++ b/debian/copyright @@ -0,0 +1,30 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Files-Excluded: src/installer/_scripts/*.exe + +Files: * +Copyright: 2020-2022, Pradyun Gedam +License: Expat + +Files: debian/* +Copyright: 2021, Stuart Prescott <stuart@debian.org> + 2021-2022, Stefan Rivera <stefanor@debian.org> +License: Expat + +License: Expat + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 0000000..3879982 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,2 @@ +[DEFAULT] +debian-branch=debian/master diff --git a/debian/patches/search-wheels-for-dist-info b/debian/patches/search-wheels-for-dist-info new file mode 100644 index 0000000..0f505d1 --- /dev/null +++ b/debian/patches/search-wheels-for-dist-info @@ -0,0 +1,149 @@ +From: Stefano Rivera <stefanor@debian.org> +Date: Sun, 16 Oct 2022 13:01:21 +0200 +Subject: Search wheels for .dist-info directories + +Some wheels don't use normalized names for their .dist-info directories, +so search the wheel for them. + +Fixes: #134 +Bug-Upstream: https://github.com/pypa/installer/issues/134 +Bug-Debian: https://bugs.debian.org/1008606 +Forwarded: https://github.com/pypa/installer/pull/137 +--- + src/installer/sources.py | 29 ++++++++++++++++++++++++++++- + src/installer/utils.py | 8 ++++++++ + tests/test_sources.py | 17 +++++++++++++++++ + tests/test_utils.py | 22 ++++++++++++++++++++++ + 4 files changed, 75 insertions(+), 1 deletion(-) + +diff --git a/src/installer/sources.py b/src/installer/sources.py +index fa0bc34..e3a7c45 100644 +--- a/src/installer/sources.py ++++ b/src/installer/sources.py +@@ -8,7 +8,7 @@ from contextlib import contextmanager + from typing import BinaryIO, Iterator, List, Tuple, cast + + from installer.records import parse_record_file +-from installer.utils import parse_wheel_filename ++from installer.utils import canonicalize_name, parse_wheel_filename + + WheelContentElement = Tuple[Tuple[str, str, str], BinaryIO, bool] + +@@ -122,6 +122,33 @@ class WheelFile(WheelSource): + with zipfile.ZipFile(path) as f: + yield cls(f) + ++ @property ++ def dist_info_dir(self) -> str: ++ """Name of the dist-info directory.""" ++ if not hasattr(self, "_dist_info_dir"): ++ top_level_directories = { ++ path.split("/", 1)[0] for path in self._zipfile.namelist() ++ } ++ dist_infos = [ ++ name for name in top_level_directories if name.endswith(".dist-info") ++ ] ++ ++ assert ( ++ len(dist_infos) == 1 ++ ), "Wheel doesn't contain exactly one .dist-info directory" ++ dist_info_dir = dist_infos[0] ++ ++ # NAME-VER.dist-info ++ di_dname = dist_info_dir.rsplit("-", 2)[0] ++ norm_di_dname = canonicalize_name(di_dname) ++ norm_file_dname = canonicalize_name(self.distribution) ++ assert ( ++ norm_di_dname == norm_file_dname ++ ), "Wheel .dist-info directory doesn't match wheel filename" ++ ++ self._dist_info_dir = dist_info_dir ++ return self._dist_info_dir ++ + @property + def dist_info_filenames(self) -> List[str]: + """Get names of all files in the dist-info directory.""" +diff --git a/src/installer/utils.py b/src/installer/utils.py +index 7b1404d..cef2bd8 100644 +--- a/src/installer/utils.py ++++ b/src/installer/utils.py +@@ -94,6 +94,14 @@ def parse_metadata_file(contents: str) -> Message: + return feed_parser.close() + + ++def canonicalize_name(name: str) -> str: ++ """Canonicalize a project name according to PEP-503. ++ ++ :param name: The project name to canonicalize ++ """ ++ return re.sub(r"[-_.]+", "-", name).lower() ++ ++ + def parse_wheel_filename(filename: str) -> WheelFilename: + """Parse a wheel filename, into it's various components. + +diff --git a/tests/test_sources.py b/tests/test_sources.py +index a79cc24..8d71496 100644 +--- a/tests/test_sources.py ++++ b/tests/test_sources.py +@@ -92,3 +92,20 @@ class TestWheelFile: + + assert sorted(got_records) == sorted(expected_records) + assert got_files == files ++ ++ def test_finds_dist_info(self, fancy_wheel): ++ denorm = fancy_wheel.rename(fancy_wheel.parent / "Fancy-1.0.0-py3-none-any.whl") ++ # Python 3.7: rename doesn't return the new name: ++ denorm = fancy_wheel.parent / "Fancy-1.0.0-py3-none-any.whl" ++ with WheelFile.open(denorm) as source: ++ assert source.dist_info_filenames ++ ++ def test_requires_dist_info_name_match(self, fancy_wheel): ++ misnamed = fancy_wheel.rename( ++ fancy_wheel.parent / "misnamed-1.0.0-py3-none-any.whl" ++ ) ++ # Python 3.7: rename doesn't return the new name: ++ misnamed = fancy_wheel.parent / "misnamed-1.0.0-py3-none-any.whl" ++ with pytest.raises(AssertionError): ++ with WheelFile.open(misnamed) as source: ++ source.dist_info_filenames +diff --git a/tests/test_utils.py b/tests/test_utils.py +index bfcc089..e4bfb6a 100644 +--- a/tests/test_utils.py ++++ b/tests/test_utils.py +@@ -16,6 +16,7 @@ from installer.utils import ( + construct_record_file, + copyfileobj_with_hashing, + fix_shebang, ++ canonicalize_name, + parse_entrypoints, + parse_metadata_file, + parse_wheel_filename, +@@ -41,6 +42,27 @@ class TestParseMetadata: + assert result.get_all("MULTI-USE-FIELD") == ["1", "2", "3"] + + ++class TestCanonicalizeDistributionName: ++ @pytest.mark.parametrize( ++ "string, expected", ++ [ ++ # Noop ++ ( ++ "package-1", ++ "package-1", ++ ), ++ # PEP 508 canonicalization ++ ( ++ "ABC..12", ++ "abc-12", ++ ), ++ ], ++ ) ++ def test_valid_cases(self, string, expected): ++ got = canonicalize_name(string) ++ assert expected == got, (expected, got) ++ ++ + class TestParseWheelFilename: + @pytest.mark.parametrize( + "string, expected", diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..52c4423 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,3 @@ +sphinx-default-theme +skip-script-tests +search-wheels-for-dist-info diff --git a/debian/patches/skip-script-tests b/debian/patches/skip-script-tests new file mode 100644 index 0000000..64ba208 --- /dev/null +++ b/debian/patches/skip-script-tests @@ -0,0 +1,34 @@ +From: Stefano Rivera <stefanor@debian.org> +Date: Sun, 7 Nov 2021 15:04:10 -0800 +Subject: Skip tests for Windows launchers + +We don't include the bundled simple_launcher .exes in our Debian source +package, for DFSG reasons. They aren't needed outside Windows. + +Forwarded: not-needed +--- + tests/test_scripts.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/tests/test_scripts.py b/tests/test_scripts.py +index 2da6577..6442e19 100644 +--- a/tests/test_scripts.py ++++ b/tests/test_scripts.py +@@ -40,6 +40,8 @@ def _read_launcher_data(section, kind): + return f.read() + + ++@pytest.mark.skip( ++ "Skipped on Debian, we don't include the simple_launcher .exes") + @pytest.mark.parametrize("section", ["console", "gui"]) + @pytest.mark.parametrize("kind", ["win-ia32", "win-amd64", "win-arm"]) + def test_script_generate_launcher(section, kind): +@@ -60,6 +62,8 @@ def test_script_generate_launcher(section, kind): + assert b"baz.qux()" in code + + ++@pytest.mark.skip( ++ "Skipped on Debian, we don't include the simple_launcher .exes") + @pytest.mark.parametrize( + "section, kind", + [("nonexist", "win-ia32"), ("console", "nonexist"), ("nonexist", "nonexist")], diff --git a/debian/patches/sphinx-default-theme b/debian/patches/sphinx-default-theme new file mode 100644 index 0000000..9ceacea --- /dev/null +++ b/debian/patches/sphinx-default-theme @@ -0,0 +1,24 @@ +From: Stuart Prescott <stuart@debian.org> +Date: Thu, 21 Oct 2021 14:40:17 +1100 +Subject: Disable furo theme for documentation + +Furo is not packaged in Debian, yet. + +Forwarded: not-needed +--- + docs/conf.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/docs/conf.py b/docs/conf.py +index 22bbe11..3ff6d4d 100644 +--- a/docs/conf.py ++++ b/docs/conf.py +@@ -24,7 +24,7 @@ extensions = [ + # -- Options for HTML output ----------------------------------------------------------- + # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +-html_theme = "furo" ++#html_theme = "furo" + html_title = project + + # -- Options for Autodoc -------------------------------------------------------------- diff --git a/debian/python-installer-doc.doc-base b/debian/python-installer-doc.doc-base new file mode 100644 index 0000000..9e07719 --- /dev/null +++ b/debian/python-installer-doc.doc-base @@ -0,0 +1,14 @@ +Document: python-installer +Title: Debian python-installer Manual +Author: +Abstract: This is the manual for python-installer. + python-installer will install a Python Wheel (distributable module) on the + local system following a PEP517 build. +Section: Programming/Python + +Format: HTML +Index: /usr/share/doc/python-installer-doc/html/index.html +Files: + /usr/share/doc/python-installer-doc/html/*.html + /usr/share/doc/python-installer-doc/html/_sources/* + /usr/share/doc/python-installer-doc/html/_static/* diff --git a/debian/python-installer-doc.docs b/debian/python-installer-doc.docs new file mode 100644 index 0000000..094cdf4 --- /dev/null +++ b/debian/python-installer-doc.docs @@ -0,0 +1,2 @@ +README.md +build/html/ diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..75cfb14 --- /dev/null +++ b/debian/rules @@ -0,0 +1,18 @@ +#!/usr/bin/make -f + +# export DH_VERBOSE = 1 + +export PYBUILD_NAME = installer + +export PYBUILD_TEST_ARGS = -rsx -v + +%: + dh $@ --buildsystem pybuild + +execute_after_dh_auto_build: +ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS))) + PYTHONPATH=$(CURDIR)/src/ \ + http_proxy=http://127.0.0.1:9 \ + https_proxy=https://127.0.0.1:9 \ + python3 -m sphinx -N -bhtml docs/ build/html +endif diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000..bde3414 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,6 @@ +Tests: unittests +Depends: + python3-all, + python3-installer, + python3-mock, + python3-pytest diff --git a/debian/tests/unittests b/debian/tests/unittests new file mode 100755 index 0000000..d2fecdc --- /dev/null +++ b/debian/tests/unittests @@ -0,0 +1,13 @@ +#!/bin/sh +set -efu + +pys="$(py3versions -s 2> /dev/null)" + +cp -a tests "$AUTOPKGTEST_TMP" + +cd "$AUTOPKGTEST_TMP" + +for py in $pys; do + echo "=== $py ===" + $py -m pytest tests +done diff --git a/debian/upstream/metadata b/debian/upstream/metadata new file mode 100644 index 0000000..d03b8f2 --- /dev/null +++ b/debian/upstream/metadata @@ -0,0 +1,10 @@ +--- +Changelog: https://installer.readthedocs.io/en/latest/changelog/ +Documentation: https://installer.readthedocs.io/en/latest/ +Bug-Database: https://github.com/pypa/installer/issues +Bug-Submit: https://github.com/pypa/installer/issues/new +Registry: + - Name: PyPI + Entry: installer +Repository: https://github.com/pypa/installer.git +Repository-Browse: https://github.com/pypa/installer diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..14448b5 --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=4 +opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/python-installer-$1\.tar\.gz/,dversionmangle=s/.dfsg\d//,repacksuffix=+dfsg1 \ + https://github.com/pypa/installer/tags .*/v?(\d\S+)\.tar\.gz |