diff options
author | PJ Eby <distutils-sig@python.org> | 2005-07-17 19:54:38 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2005-07-17 19:54:38 +0000 |
commit | 61a0e7109e42e844dcda2637fa3bbf5d1f897938 (patch) | |
tree | 0a155b14856bbb41c70d7fae6b0528ebcc6cf7ca /setuptools | |
parent | 63d507adccf8207a40e2b22a8c11f79efb83f56a (diff) | |
download | external_python_setuptools-61a0e7109e42e844dcda2637fa3bbf5d1f897938.tar.gz external_python_setuptools-61a0e7109e42e844dcda2637fa3bbf5d1f897938.tar.bz2 external_python_setuptools-61a0e7109e42e844dcda2637fa3bbf5d1f897938.zip |
The ``path`` attribute of ``Distribution`` objects is now ``location``,
because it isn't necessarily a filesystem path (and hasn't been for some
time now). ``Distribution`` objects now have an ``as_requirement()``
method that returns a ``Requirement`` for the distribution's project name
and version.
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041134
Diffstat (limited to 'setuptools')
-rwxr-xr-x | setuptools/command/easy_install.py | 34 | ||||
-rwxr-xr-x | setuptools/package_index.py | 8 |
2 files changed, 21 insertions, 21 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index b096a48e..a9b769e3 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1,6 +1,5 @@ #!python """\ - Easy Install ------------ @@ -17,7 +16,8 @@ from setuptools import Command from setuptools.sandbox import run_setup from distutils import log, dir_util from distutils.sysconfig import get_python_lib -from distutils.errors import DistutilsArgError, DistutilsOptionError, DistutilsError +from distutils.errors import DistutilsArgError, DistutilsOptionError, \ + DistutilsError from setuptools.archive_util import unpack_archive from setuptools.package_index import PackageIndex, parse_bdist_wininst from setuptools.package_index import URL_SCHEME @@ -350,7 +350,7 @@ class easy_install(Command): self.install_egg_scripts(dist) log.warn(self.installation_report(dist, *info)) if requirement is None: - requirement = Requirement.parse('%s==%s'%(dist.project_name,dist.version)) + requirement = dist.as_requirement() if dist in requirement: log.info("Processing dependencies for %s", requirement) try: @@ -419,7 +419,7 @@ class easy_install(Command): options = match.group(1) or '' if options: options = ' '+options - spec = '%s==%s' % (dist.project_name,dist.version) + spec = dist.as_requirement() executable = os.path.normpath(sys.executable) if dev_path: @@ -547,7 +547,7 @@ class easy_install(Command): ) # Convert the .exe to an unpacked egg - egg_path = dist.path = os.path.join(tmpdir, dist.egg_name()+'.egg') + egg_path = dist.location = os.path.join(tmpdir, dist.egg_name()+'.egg') egg_tmp = egg_path+'.tmp' pkg_inf = os.path.join(egg_tmp, 'EGG-INFO', 'PKG-INFO') ensure_directory(pkg_inf) # make sure EGG-INFO dir exists @@ -718,7 +718,7 @@ Note also that the installation directory must be on sys.path at runtime for this to work. (e.g. by being the application's script directory, by being on PYTHONPATH, or by being added to sys.path by your code.) """ - eggloc = dist.path + eggloc = dist.location name = dist.project_name version = dist.version return msg % locals() @@ -782,14 +782,14 @@ PYTHONPATH, or by being added to sys.path by your code.) return for d in self.pth_file.get(dist.key,()): # drop old entries - if self.multi_version or normalize(d.path) != normalize(dist.path): + if self.multi_version or normalize(d.location) != normalize(dist.location): log.info("Removing %s from easy-install.pth file", d) self.pth_file.remove(d) - if normalize(d.path) in self.shadow_path: - self.shadow_path.remove(d.path) + if normalize(d.location) in self.shadow_path: + self.shadow_path.remove(d.location) if not self.multi_version: - if normalize(dist.path) in map(normalize,self.pth_file.paths): + if normalize(dist.location) in map(normalize,self.pth_file.paths): log.info( "%s is already the active version in easy-install.pth", dist @@ -797,8 +797,8 @@ PYTHONPATH, or by being added to sys.path by your code.) else: log.info("Adding %s to easy-install.pth file", dist) self.pth_file.add(dist) # add new entry - if normalize(dist.path) not in self.shadow_path: - self.shadow_path.append(normalize(dist.path)) + if normalize(dist.location) not in self.shadow_path: + self.shadow_path.append(normalize(dist.location)) self.pth_file.save() @@ -806,7 +806,7 @@ PYTHONPATH, or by being added to sys.path by your code.) # Ensure that setuptools itself never becomes unavailable! # XXX should this check for latest version? f = open(os.path.join(self.install_dir,'setuptools.pth'), 'w') - f.write(dist.path+'\n') + f.write(dist.location+'\n') f.close() @@ -1051,14 +1051,14 @@ class PthDistributions(AvailableDistributions): def add(self,dist): """Add `dist` to the distribution map""" - if dist.path not in self.paths: - self.paths.append(dist.path); self.dirty = True + if dist.location not in self.paths: + self.paths.append(dist.location); self.dirty = True AvailableDistributions.add(self,dist) def remove(self,dist): """Remove `dist` from the distribution map""" - while dist.path in self.paths: - self.paths.remove(dist.path); self.dirty = True + while dist.location in self.paths: + self.paths.remove(dist.location); self.dirty = True AvailableDistributions.remove(self,dist) diff --git a/setuptools/package_index.py b/setuptools/package_index.py index f553c2da..4c2d7616 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -52,10 +52,8 @@ def distros_for_filename(url_or_path, basename, metadata=None): if basename.endswith('.egg.zip'): basename = basename[:-4] # strip the .zip - if basename.endswith('.egg'): - dist = Distribution.from_filename(basename, metadata) - dist.path = url_or_path - return [dist] # only one, unambiguous interpretation + if basename.endswith('.egg'): # only one, unambiguous interpretation + return [Distribution.from_location(url_or_path, basename, metadata)] if basename.endswith('.exe'): win_base, py_ver = parse_bdist_wininst(basename) @@ -80,6 +78,8 @@ def distros_for_filename(url_or_path, basename, metadata=None): + + def interpret_distro_name(url_or_path, basename, metadata, py_version=None, distro_type=SOURCE_DIST, platform=None ): |