Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trying to keep up pip-accel and py2deb with the latest version of pip #27

Open
artynet opened this issue Apr 1, 2020 · 0 comments
Open

Comments

@artynet
Copy link

artynet commented Apr 1, 2020

Hello @xolox ,

I am embarking myself in updating the underlying pip engine in pip-accel and py2deb. So far, I have whipped up this patch :

diff --git a/pip_accel/__init__.py b/pip_accel/__init__.py
index 5dc39f2..33d7f2d 100644
--- a/pip_accel/__init__.py
+++ b/pip_accel/__init__.py
@@ -70,13 +70,13 @@ from pip_accel.utils import (
 
 # External dependencies.
 from humanfriendly import concatenate, Timer, pluralize
-from pip import basecommand as pip_basecommand_module
-from pip import index as pip_index_module
-from pip import wheel as pip_wheel_module
-from pip.commands.download import DownloadCommand
-from pip.commands.install import InstallCommand
-from pip.exceptions import DistributionNotFound
-from pip.req import InstallRequirement
+from pip._internal.cli import base_command as pip_basecommand_module
+from pip._internal.index import package_finder as pip_index_module
+from pip._internal.models import wheel as pip_wheel_module
+from pip._internal.commands.download import DownloadCommand
+from pip._internal.commands.install import InstallCommand
+from pip._internal.exceptions import DistributionNotFound
+from pip._internal.req import InstallRequirement
 
 # Semi-standard module versioning.
 __version__ = '0.43'
@@ -391,7 +391,7 @@ class PipAccelerator(object):
         """
         unpack_timer = Timer()
         logger.info("Unpacking distribution(s) ..")
-        with PatchedAttribute(pip_basecommand_module, 'PackageFinder', CustomPackageFinder):
+        with PatchedAttribute(pip_index_module, 'PackageFinder', CustomPackageFinder):
             requirements = self.get_pip_requirement_set(arguments, use_remote_index=False, use_wheels=use_wheels)
             logger.info("Finished unpacking %s in %s.", pluralize(len(requirements), "distribution"), unpack_timer)
             return requirements
@@ -722,7 +722,7 @@ class SetupRequiresPatch(object):
         """Enable caching of setup requirements (by patching the ``run_egg_info()`` method)."""
         if self.patch is None:
             created_links = self.created_links
-            original_method = InstallRequirement.run_egg_info
+            original_method = InstallRequirement.metadata
             shared_directory = self.config.eggs_cache
 
             def run_egg_info_wrapper(self, *args, **kw):
@@ -743,7 +743,7 @@ class SetupRequiresPatch(object):
                 return original_method(self, *args, **kw)
 
             # Install the wrapper method for the duration of the context manager.
-            self.patch = PatchedAttribute(InstallRequirement, 'run_egg_info', run_egg_info_wrapper)
+            self.patch = PatchedAttribute(InstallRequirement, 'metadata', run_egg_info_wrapper)
             self.patch.__enter__()
 
     def __exit__(self, exc_type=None, exc_value=None, traceback=None):
diff --git a/pip_accel/req.py b/pip_accel/req.py
index ad2f61b..ae8a1a9 100644
--- a/pip_accel/req.py
+++ b/pip_accel/req.py
@@ -38,7 +38,7 @@ from pip_accel.utils import hash_files
 
 # External dependencies.
 from cached_property import cached_property
-from pip.req import InstallRequirement
+from pip._internal.req import InstallRequirement
 
 # The following package(s) are usually bundled with pip but may be unbundled
 # by redistributors and pip-accel should handle this gracefully.
diff --git a/pip_accel/utils.py b/pip_accel/utils.py
index 4b168c9..f14b53a 100644
--- a/pip_accel/utils.py
+++ b/pip_accel/utils.py
@@ -25,7 +25,7 @@ from pip_accel.compat import pathname2url, urljoin, WINDOWS
 
 # External dependencies.
 from humanfriendly import parse_path
-from pip.commands.uninstall import UninstallCommand
+from pip._internal.commands.uninstall import UninstallCommand
 
 # The following package(s) are usually bundled with pip but may be unbundled
 # by redistributors and pip-accel should handle this gracefully.
diff --git a/requirements.txt b/requirements.txt
index c344326..a579c41 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,5 +1,5 @@
 cached-property >= 0.1.5
 coloredlogs >= 3.0
 humanfriendly >= 1.44.7
-pip >= 8.1, < 8.2
+pip
 setuptools >= 7.0

but then, py2deb returns this error :

Traceback (most recent call last):
  File "/home/artynet/.local/lib/python3.7/site-packages/py2deb/cli.py", line 200, in main
    archives, relationships = converter.convert(arguments)
  File "/home/artynet/.local/lib/python3.7/site-packages/py2deb/converter.py", line 735, in convert
    self.packages_to_convert = list(self.get_source_distributions(pip_install_arguments))
  File "/home/artynet/.local/lib/python3.7/site-packages/py2deb/converter.py", line 792, in get_source_distributions
    for requirement in self.pip_accel.get_requirements(arguments):
  File "/home/artynet/.local/lib/python3.7/site-packages/pip_accel/__init__.py", line 299, in get_requirements
    return self.unpack_source_dists(arguments, use_wheels=use_wheels)
  File "/home/artynet/.local/lib/python3.7/site-packages/pip_accel/__init__.py", line 395, in unpack_source_dists
    requirements = self.get_pip_requirement_set(arguments, use_remote_index=False, use_wheels=use_wheels)
  File "/home/artynet/.local/lib/python3.7/site-packages/pip_accel/__init__.py", line 503, in get_pip_requirement_set
    command = DownloadCommand()
  File "/home/artynet/.local/lib/python3.7/site-packages/pip/_internal/commands/download.py", line 41, in __init__
    super(DownloadCommand, self).__init__(*args, **kw)
TypeError: __init__() missing 2 required positional arguments: 'name' and 'summary'

basically I can't figure out the right function the get the egg info. Any help would be appreciated...thanks in advance..

Arturo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant