Upload hf_env/lib/python3.14/site-packages/pip/_internal/distributions/__init__.py with huggingface_hub
Browse files
hf_env/lib/python3.14/site-packages/pip/_internal/distributions/__init__.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pip._internal.distributions.base import AbstractDistribution
|
| 2 |
+
from pip._internal.distributions.sdist import SourceDistribution
|
| 3 |
+
from pip._internal.distributions.wheel import WheelDistribution
|
| 4 |
+
from pip._internal.req.req_install import InstallRequirement
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def make_distribution_for_install_requirement(
|
| 8 |
+
install_req: InstallRequirement,
|
| 9 |
+
) -> AbstractDistribution:
|
| 10 |
+
"""Returns a Distribution for the given InstallRequirement"""
|
| 11 |
+
# Editable requirements will always be source distributions. They use the
|
| 12 |
+
# legacy logic until we create a modern standard for them.
|
| 13 |
+
if install_req.editable:
|
| 14 |
+
return SourceDistribution(install_req)
|
| 15 |
+
|
| 16 |
+
# If it's a wheel, it's a WheelDistribution
|
| 17 |
+
if install_req.is_wheel:
|
| 18 |
+
return WheelDistribution(install_req)
|
| 19 |
+
|
| 20 |
+
# Otherwise, a SourceDistribution
|
| 21 |
+
return SourceDistribution(install_req)
|