mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Merge pull request #584 from msabramo/issue-11
Make _run_setup_py magic use pkg_resources.iter_entry_points
This commit is contained in:
commit
5562a6bb1f
|
@ -245,14 +245,16 @@ class InstallRequirement(object):
|
|||
_run_setup_py = """
|
||||
__file__ = __SETUP_PY__
|
||||
from setuptools.command import egg_info
|
||||
import pkg_resources
|
||||
import os
|
||||
def replacement_run(self):
|
||||
self.mkpath(self.egg_info)
|
||||
installer = self.distribution.fetch_build_egg
|
||||
for ep in egg_info.iter_entry_points('egg_info.writers'):
|
||||
for ep in pkg_resources.iter_entry_points('egg_info.writers'):
|
||||
# require=False is the change we're making:
|
||||
writer = ep.load(require=False)
|
||||
if writer:
|
||||
writer(self, ep.name, egg_info.os.path.join(self.egg_info,ep.name))
|
||||
writer(self, ep.name, os.path.join(self.egg_info,ep.name))
|
||||
self.find_sources()
|
||||
egg_info.egg_info.run = replacement_run
|
||||
exec(compile(open(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
|
||||
|
|
17
tests/packages/HackedEggInfo/setup.py
Executable file
17
tests/packages/HackedEggInfo/setup.py
Executable file
|
@ -0,0 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from setuptools import setup
|
||||
from setuptools.command import egg_info as orig_egg_info
|
||||
|
||||
class egg_info (orig_egg_info.egg_info):
|
||||
def run(self):
|
||||
orig_egg_info.egg_info.run(self)
|
||||
|
||||
|
||||
setup(
|
||||
name = "hackedegginfo",
|
||||
version = '0.0.0',
|
||||
cmdclass = {'egg_info':egg_info },
|
||||
zip_safe = False,
|
||||
)
|
||||
|
|
@ -376,6 +376,16 @@ def test_install_with_pax_header():
|
|||
run_pip('install', 'paxpkg.tar.bz2', cwd=run_from)
|
||||
|
||||
|
||||
def test_install_with_hacked_egg_info():
|
||||
"""
|
||||
test installing a package which defines its own egg_info class
|
||||
"""
|
||||
reset_env()
|
||||
run_from = abspath(join(here, 'packages', 'HackedEggInfo'))
|
||||
result = run_pip('install', '.', cwd=run_from)
|
||||
assert 'Successfully installed hackedegginfo\n' in result.stdout
|
||||
|
||||
|
||||
def test_install_using_install_option_and_editable():
|
||||
"""
|
||||
Test installing a tool using -e and --install-option
|
||||
|
|
Loading…
Reference in a new issue