#19 WIP: Don't fail if the version of a whl (pip/setuptools/wheel) is a pre-release
Closed 4 years ago by pviktori. Opened 4 years ago by churchyard.
rpms/ churchyard/python-virtualenv relaxed_wheel_version  into  master

file modified
+8 -2
@@ -1,6 +1,6 @@ 

  Name:           python-virtualenv

  Version:        16.7.10

- Release:        1%{?dist}

+ Release:        2%{?dist}

  Summary:        Tool to create isolated Python environments

  

  License:        MIT
@@ -8,7 +8,10 @@ 

  Source0:        %{pypi_source virtualenv}

  

  # Add /usr/share/python-wheels to file_search_dirs

- Patch1: rpm-wheels.patch

+ Patch1:         rpm-wheels.patch

+ 

+ # Don't fail if the version of a whl (pip/setuptools/wheel) is a pre-release

+ Patch2:         relaxed-wheel-version.patch

  

  BuildArch:      noarch

  BuildRequires:  git-core
@@ -140,6 +143,9 @@ 

  

  

  %changelog

+ * Mon Apr 27 2020 Miro Hrončok <mhroncok@redhat.com> - 16.7.10-2

+ - Don't fail if the version of a whl (pip/setuptools/wheel) is a pre-release

+ 

  * Tue Feb 25 2020 Miro Hrončok <mhroncok@redhat.com> - 16.7.10-1

  - Update to 16.7.10

  - Explicitly require setuptools < 44 with Python 3.4

@@ -0,0 +1,31 @@ 

+ diff --git a/virtualenv.py b/virtualenv.py

+ index 3085d1d..b532cfd 100755

+ --- a/virtualenv.py

+ +++ b/virtualenv.py

+ @@ -971,6 +971,17 @@ def filter_install_output(line):

+      return Logger.DEBUG

+  

+  

+ +def relaxed_int(text):

+ +    """Converts "10" to 10, "10a1" to 10, but fails with "a10"."""

+ +    try:

+ +        return int(text)

+ +    except ValueError as e:

+ +        try:

+ +            return int(re.search(r'^\d+', text).group())

+ +        except AttributeError:  # NoneType object has no attribute group

+ +            raise e

+ +

+ +

+  def find_wheels(projects, search_dirs):

+      """Find wheels from which we can import PROJECTS.

+  

+ @@ -992,7 +1003,7 @@ def find_wheels(projects, search_dirs):

+                  versions = list(

+                      reversed(

+                          sorted(

+ -                            [(tuple(int(i) for i in os.path.basename(f).split("-")[1].split(".")), f) for f in files]

+ +                            [(tuple(relaxed_int(i) for i in os.path.basename(f).split("-")[1].split(".")), f) for f in files]

+                          )

+                      )

+                  )

Build failed.

I think we should close this and not propose this to upstream.

  • we are currently unlikely to actually ship pip/setuptools prerelease
  • we need to update to virtualenv 20, not kick the legacy horse

If we ever need this again, we'll have it here in this closed PR.

Thoughts?

Sounds good.

I guess upstream would want a more robust solution, and that'll open worm cans like putting packaging in stdlib.

Pull-Request has been closed by pviktori

4 years ago