diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2019-01-25 15:49:59 -0500 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2019-01-25 15:49:59 -0500 |
| commit | 992aa3dfba57de594544b8df6f8adb5e8d451ab2 (patch) | |
| tree | ff8aa7bc91f9dd1a513025cc0d0b184d2c361080 /setuptools/command/develop.py | |
| parent | 2c897b5b877d401e13b661f2a0a14e99a1aabdc8 (diff) | |
| parent | 9b777b7599c1379d06f6a250410adba2607bfc4f (diff) | |
| download | external_python_setuptools-992aa3dfba57de594544b8df6f8adb5e8d451ab2.tar.gz external_python_setuptools-992aa3dfba57de594544b8df6f8adb5e8d451ab2.tar.bz2 external_python_setuptools-992aa3dfba57de594544b8df6f8adb5e8d451ab2.zip | |
Merge branch 'master' into fix_889_and_non-ascii_in_setup.cfg_take_2
Diffstat (limited to 'setuptools/command/develop.py')
| -rw-r--r--[-rwxr-xr-x] | setuptools/command/develop.py | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py index 85b23c60..009e4f93 100755..100644 --- a/setuptools/command/develop.py +++ b/setuptools/command/develop.py @@ -7,11 +7,13 @@ import io from setuptools.extern import six -from pkg_resources import Distribution, PathMetadata, normalize_path +import pkg_resources from setuptools.command.easy_install import easy_install from setuptools import namespaces import setuptools +__metaclass__ = type + class develop(namespaces.DevelopInstaller, easy_install): """Set up package for development""" @@ -63,9 +65,9 @@ class develop(namespaces.DevelopInstaller, easy_install): if self.egg_path is None: self.egg_path = os.path.abspath(ei.egg_base) - target = normalize_path(self.egg_base) - egg_path = normalize_path(os.path.join(self.install_dir, - self.egg_path)) + target = pkg_resources.normalize_path(self.egg_base) + egg_path = pkg_resources.normalize_path( + os.path.join(self.install_dir, self.egg_path)) if egg_path != target: raise DistutilsOptionError( "--egg-path must be a relative path from the install" @@ -73,9 +75,9 @@ class develop(namespaces.DevelopInstaller, easy_install): ) # Make a distribution for the package's source - self.dist = Distribution( + self.dist = pkg_resources.Distribution( target, - PathMetadata(target, os.path.abspath(ei.egg_info)), + pkg_resources.PathMetadata(target, os.path.abspath(ei.egg_info)), project_name=ei.egg_name ) @@ -95,11 +97,14 @@ class develop(namespaces.DevelopInstaller, easy_install): path_to_setup = egg_base.replace(os.sep, '/').rstrip('/') if path_to_setup != os.curdir: path_to_setup = '../' * (path_to_setup.count('/') + 1) - resolved = normalize_path(os.path.join(install_dir, egg_path, path_to_setup)) - if resolved != normalize_path(os.curdir): + resolved = pkg_resources.normalize_path( + os.path.join(install_dir, egg_path, path_to_setup) + ) + if resolved != pkg_resources.normalize_path(os.curdir): raise DistutilsOptionError( "Can't get a consistent path to setup script from" - " installation directory", resolved, normalize_path(os.curdir)) + " installation directory", resolved, + pkg_resources.normalize_path(os.curdir)) return path_to_setup def install_for_development(self): @@ -110,7 +115,7 @@ class develop(namespaces.DevelopInstaller, easy_install): self.reinitialize_command('build_py', inplace=0) self.run_command('build_py') bpy_cmd = self.get_finalized_command("build_py") - build_path = normalize_path(bpy_cmd.build_lib) + build_path = pkg_resources.normalize_path(bpy_cmd.build_lib) # Build extensions self.reinitialize_command('egg_info', egg_base=build_path) @@ -124,7 +129,8 @@ class develop(namespaces.DevelopInstaller, easy_install): self.egg_path = build_path self.dist.location = build_path # XXX - self.dist._provider = PathMetadata(build_path, ei_cmd.egg_info) + self.dist._provider = pkg_resources.PathMetadata( + build_path, ei_cmd.egg_info) else: # Without 2to3 inplace works fine: self.run_command('egg_info') @@ -190,12 +196,13 @@ class develop(namespaces.DevelopInstaller, easy_install): return easy_install.install_wrapper_scripts(self, dist) -class VersionlessRequirement(object): +class VersionlessRequirement: """ Adapt a pkg_resources.Distribution to simply return the project name as the 'requirement' so that scripts will work across multiple versions. + >>> from pkg_resources import Distribution >>> dist = Distribution(project_name='foo', version='1.0') >>> str(dist.as_requirement()) 'foo==1.0' |
