Repository: pex-tool/pex

Issue:
Providing a direct reference to a wheel with a local version fails to resolve 
```
pex --version
2.1.105
```

This bug has to do with [local version specifiers](https://peps.python.org/pep-0440/#local-version-identifiers) in wheel file names. In this case I am using the [torch-1.12.1+cpu-cp310-cp310-linux_x86_64.whl](http://download.pytorch.org/whl/cpu/torch-1.12.1%2Bcpu-cp310-cp310-linux_x86_64.whl) wheel.

If I use find links to pull the wheel it works:
```
pex --resolver-version pip-2020-resolver --pip-version 22.2.2 --python '/usr/bin/python3.10' --no-index -f 'https://download.pytorch.org/whl/cpu/torch' 'torch' -f 'https://pypi.org/simple/typing-extensions/' --no-compress             
Python 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
(ins)>>> import torch
(ins)>>> type(torch)
<class 'module'>
(ins)>>> 
```

If I provide a direct reference to the wheel it fails:
```
pex --resolver-version pip-2020-resolver --pip-version 22.2.2 --python '/usr/bin/python3.10' 'http://download.pytorch.org/whl/cpu/torch-1.12.1%2Bcpu-cp310-cp310-linux_x86_64.whl' --no-compress
Python 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
(ins)>>> import torch
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ModuleNotFoundError: No module named 'torch'
(ins)>>> 
```


Note that providing a direct reference to a wheel in general works:
```
pex --resolver-version pip-2020-resolver --pip-version 22.2.2 --python '/usr/bin/python3.10' 'https://github.com/zmanji/pyzstd-wheel-builder/releases/download/v0.0.7/pyzstd-0.15.2-1-cp310-cp310-linux_x86_64.whl'
Python 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
(ins)>>> import pyzstd
(ins)>>> type(pyzstd)
<class 'module'>
```




Discussion:

Resolving patch:
diff --git a/pex/requirements.py b/pex/requirements.py
--- a/pex/requirements.py
+++ b/pex/requirements.py
@@ -8,7 +8,7 @@
 from contextlib import contextmanager
 
 from pex import attrs, dist_metadata, pex_warnings
-from pex.compatibility import urlparse
+from pex.compatibility import unquote, urlparse
 from pex.dist_metadata import (
     MetadataError,
     ProjectNameAndVersion,
@@ -297,7 +297,7 @@ def parse_scheme(scheme):
             )
             |
             (?P<vcs_type>
-                # VCSs: https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support       
+                # VCSs: https://pip.pypa.io/en/stable/reference/pip_install/#vcs-support
                   bzr
                 | git
                 | hg
@@ -481,7 +481,7 @@ def _parse_requirement_line(
         specifier = None  # type: Optional[SpecifierSet]
         if not project_name:
             project_name_and_specifier = _try_parse_project_name_and_specifier_from_path(
-                parsed_url.path
+                unquote(parsed_url.path)
             )
             if project_name_and_specifier is not None:
                 project_name = project_name_and_specifier.project_name


Test patch:
diff --git a/tests/test_requirements.py b/tests/test_requirements.py
--- a/tests/test_requirements.py
+++ b/tests/test_requirements.py
@@ -286,6 +286,9 @@ def test_parse_requirements_stress(chroot):
                 Django@ git+https://github.com/django/django.git\\
                     @fd209f62f1d83233cc634443cfac5ee4328d98b8
                 Django @ file:projects/django-2.3.zip; python_version >= "3.10"
+
+                # Wheel with local version
+                http://download.pytorch.org/whl/cpu/torch-1.12.1%2Bcpu-cp310-cp310-linux_x86_64.whl
                 """
             )
         )
@@ -433,6 +436,11 @@ def test_parse_requirements_stress(chroot):
             specifier="==2.3",
             marker="python_version>='3.10'",
         ),
+        url_req(
+            project_name="torch",
+            url="http://download.pytorch.org/whl/cpu/torch-1.12.1%2Bcpu-cp310-cp310-linux_x86_64.whl",
+            specifier="==1.12.1+cpu",
+        ),
         url_req(
             project_name="numpy",
             url=os.path.realpath("./downloads/numpy-1.9.2-cp34-none-win32.whl"),