From dd3b79dc8e59994ac34ba78c6ec6e71029b93d4a Mon Sep 17 00:00:00 2001 From: J Robert Ray Date: Tue, 16 Jul 2024 10:44:08 -0700 Subject: [PATCH 1/3] Auto reformatting Signed-off-by: J Robert Ray --- packages/spk-convert-pip/spk-convert-pip | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/spk-convert-pip/spk-convert-pip b/packages/spk-convert-pip/spk-convert-pip index 248dc9375d..ce5a969abc 100755 --- a/packages/spk-convert-pip/spk-convert-pip +++ b/packages/spk-convert-pip/spk-convert-pip @@ -45,8 +45,12 @@ def main() -> int: "spk-convert-pip", description="Convert and import packages using pip" ) pip_cmd.add_argument( - "-v", "--verbose", action="count", dest="verbose", default=0, - help="Increase the verbosity of the output" + "-v", + "--verbose", + action="count", + dest="verbose", + default=0, + help="Increase the verbosity of the output", ) pip_cmd.add_argument( "--python-version", default="3.7", help="The version of python to install for" @@ -123,7 +127,14 @@ def main() -> int: ) if args.publish: - cmd = [spk_exe(), "publish", "--allow-existing-with-label", f"{SPK_GENERATED_BY_LABEL}={SPK_GENERATED_BY_VALUE}", "-r", args.target_repo] + cmd = [ + spk_exe(), + "publish", + "--allow-existing-with-label", + f"{SPK_GENERATED_BY_LABEL}={SPK_GENERATED_BY_VALUE}", + "-r", + args.target_repo, + ] if args.force: cmd.append("--force") cmd.extend([spec["pkg"] for spec in specs]) From 35e35147af41b9b61ae2655e1803e01f2045a2fd Mon Sep 17 00:00:00 2001 From: J Robert Ray Date: Tue, 16 Jul 2024 10:45:36 -0700 Subject: [PATCH 2/3] Add pip download timeout Some wheel files are very large and can't be downloaded within the default 10 second timeout window. Signed-off-by: J Robert Ray --- packages/spk-convert-pip/spk-convert-pip | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/spk-convert-pip/spk-convert-pip b/packages/spk-convert-pip/spk-convert-pip index ce5a969abc..e39deb6654 100755 --- a/packages/spk-convert-pip/spk-convert-pip +++ b/packages/spk-convert-pip/spk-convert-pip @@ -199,6 +199,8 @@ class PipImporter: pip_command = [ "pip", "download", + # Allow enough time for larger wheels to download. + "--timeout=1000", f"{req}", "--python-version", self._python_version, From 1ef30d74d4c8022a58e8d7d82d0c548e30c94b9b Mon Sep 17 00:00:00 2001 From: J Robert Ray Date: Tue, 16 Jul 2024 10:53:45 -0700 Subject: [PATCH 3/3] Update pkginfo to 1.10.0 This solves a problem parsing some packages which ends up with `info.name` being `None`. Add an assertion to make the problem more clear in the future if it comes back. Bump package version to 1.4.2 (1.4.1 was used in an internal release at SPI). Signed-off-by: J Robert Ray --- packages/spk-convert-pip/requirements.txt | 5 +++-- packages/spk-convert-pip/spk-convert-pip | 1 + packages/spk-convert-pip/spk-convert-pip.spk.yaml | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/spk-convert-pip/requirements.txt b/packages/spk-convert-pip/requirements.txt index 2453837ee1..24df9fd574 100644 --- a/packages/spk-convert-pip/requirements.txt +++ b/packages/spk-convert-pip/requirements.txt @@ -1,5 +1,6 @@ -pkginfo==1.7.0 +# 1.10.0 is the last version that supports python 3.7 +pkginfo==1.10.0 packaging==20.9 # 0.40.0 latest at time of writing but no implied requirement for exactly this # version. -wheel==0.40.0 \ No newline at end of file +wheel==0.40.0 diff --git a/packages/spk-convert-pip/spk-convert-pip b/packages/spk-convert-pip/spk-convert-pip index e39deb6654..5bf2a7cfe7 100755 --- a/packages/spk-convert-pip/spk-convert-pip +++ b/packages/spk-convert-pip/spk-convert-pip @@ -286,6 +286,7 @@ class PipImporter: def _process_package( self, requester: Requirement, info: pkginfo.Distribution ) -> List[Dict[str, Any]]: + assert info.name, "A package name is required" assert not info.requires, "No support for installation requirements" assert not info.requires_external, "No support for external requirements" assert not info.supported_platforms, "No support for supported platforms field" diff --git a/packages/spk-convert-pip/spk-convert-pip.spk.yaml b/packages/spk-convert-pip/spk-convert-pip.spk.yaml index f1b4e42e51..c3d051a6ed 100644 --- a/packages/spk-convert-pip/spk-convert-pip.spk.yaml +++ b/packages/spk-convert-pip/spk-convert-pip.spk.yaml @@ -1,4 +1,4 @@ -pkg: spk-convert-pip/1.4.0 +pkg: spk-convert-pip/1.4.2 api: v0/package build: script: