diff options
author | PJ Eby <distutils-sig@python.org> | 2005-07-18 02:06:30 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2005-07-18 02:06:30 +0000 |
commit | f7288a7f76db04584c4fbb43d86adfda29285e90 (patch) | |
tree | b2e959367f8882dfc7c5f74e8aec4a7e81f3b641 | |
parent | c7214855992b9657d6a490f46764ffaf4089c1cb (diff) | |
download | python-setuptools-git-f7288a7f76db04584c4fbb43d86adfda29285e90.tar.gz |
Massive API refactoring; see setuptools.txt changelog for details. Also,
add ``#egg=project-version`` link support, and docs on how to make your
package available for EasyInstall to find.
--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041136
-rwxr-xr-x | EasyInstall.txt | 2 | ||||
-rwxr-xr-x | ez_setup.py | 2 | ||||
-rw-r--r-- | pkg_resources.py | 2 | ||||
-rwxr-xr-x | setup.cfg | 3 | ||||
-rwxr-xr-x | setup.py | 2 | ||||
-rw-r--r-- | setuptools/__init__.py | 2 | ||||
-rwxr-xr-x | setuptools/command/easy_install.py | 50 |
7 files changed, 32 insertions, 31 deletions
diff --git a/EasyInstall.txt b/EasyInstall.txt index 33e23f09..39fbcd8a 100755 --- a/EasyInstall.txt +++ b/EasyInstall.txt @@ -67,7 +67,7 @@ version, and automatically downloading, building, and installing it:: **Example 2**. Install or upgrade a package by name and version by finding links on a given "download page":: - easy_install -f http://peak.telecommunity.com/dist "setuptools>=0.5a13" + easy_install -f http://peak.telecommunity.com/dist "setuptools>=0.6a0" **Example 3**. Download a source distribution from a specified URL, automatically building and installing it:: diff --git a/ez_setup.py b/ez_setup.py index bc78d5e4..8afb971c 100755 --- a/ez_setup.py +++ b/ez_setup.py @@ -14,7 +14,7 @@ the appropriate options to ``use_setuptools()``. This file can also be run as a script to install or upgrade setuptools. """ -DEFAULT_VERSION = "0.5a13" +DEFAULT_VERSION = "0.6a0" DEFAULT_URL = "http://www.python.org/packages/source/s/setuptools/" import sys, os diff --git a/pkg_resources.py b/pkg_resources.py index 92c7b14f..3151b063 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -232,7 +232,7 @@ class WorkingSet(object): """ self.entry_keys.setdefault(entry, []) self.entries.append(entry) - for dist in find_distributions(entry, False): + for dist in find_distributions(entry, True): self.add(dist, entry) @@ -1,4 +1,5 @@ [aliases] -source = register sdist binary binary = bdist_egg upload --show-response +develop = develop +source = register sdist binary @@ -15,7 +15,7 @@ def get_description(): f.close() return ''.join(lines) -VERSION = "0.5a13" +VERSION = "0.6a0" from setuptools import setup, find_packages diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 36c1e3d8..05c4a73e 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -7,7 +7,7 @@ from distutils.core import Command as _Command from distutils.util import convert_path import os.path -__version__ = '0.5a13' +__version__ = '0.6a0' __all__ = [ 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', 'find_packages' diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index e3b40a24..95fa30a3 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -419,7 +419,7 @@ class easy_install(Command): options = match.group(1) or '' if options: options = ' '+options - spec = dist.as_requirement() + spec = str(dist.as_requirement()) executable = os.path.normpath(sys.executable) if dev_path: @@ -789,7 +789,7 @@ PYTHONPATH, or by being added to sys.path by your code.) self.shadow_path.remove(d.location) if not self.multi_version: - if dist.location in map(normalize_path,self.pth_file.paths): + if dist.location in self.pth_file.paths: log.info( "%s is already the active version in easy-install.pth", dist @@ -802,10 +802,10 @@ PYTHONPATH, or by being added to sys.path by your code.) self.pth_file.save() - if dist.project_name=='setuptools': + if dist.key=='setuptools': # 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 = open(os.path.join(self.install_dir,'setuptools.pth'), 'wt') f.write(dist.location+'\n') f.close() @@ -1027,6 +1027,7 @@ class PthDistributions(AvailableDistributions): """A .pth file with Distribution paths in it""" dirty = False + def __init__(self, filename): self.filename = filename; self._load() AvailableDistributions.__init__( @@ -1035,22 +1036,34 @@ class PthDistributions(AvailableDistributions): def _load(self): self.paths = [] + seen = {} if os.path.isfile(self.filename): - self.paths = [line.rstrip() for line in open(self.filename,'rt')] - while self.paths and not self.paths[-1].strip(): self.paths.pop() - # delete non-existent paths, in case somebody deleted a package - # manually: - for line in list(yield_lines(self.paths)): - if not os.path.exists(line): - self.paths.remove(line); self.dirty = True - + for line in open(self.filename,'rt'): + path = line.rstrip() + self.paths.append(path) + if not path.strip() or path.strip().startswith('#'): + continue + # skip non-existent paths, in case somebody deleted a package + # manually, and duplicate paths as well + path = self.paths[-1] = normalize_path(path) + if not os.path.exists(path) or path in seen: + self.paths.pop() # skip it + self.dirty = True # we cleaned up, so we're dirty now :) + continue + seen[path] = 1 + + while self.paths and not self.paths[-1].strip(): self.paths.pop() + def save(self): """Write changed .pth file back to disk""" if self.dirty: + log.debug("Saving %s", self.filename) data = '\n'.join(self.paths+['']) f = open(self.filename,'wt'); f.write(data); f.close() self.dirty = False + + def add(self,dist): """Add `dist` to the distribution map""" if dist.location not in self.paths: @@ -1092,16 +1105,3 @@ def main(argv, **kw): - - - - - - - - - - - - - |