Commit f7288a7f authored by PJ Eby's avatar PJ Eby

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
parent c7214855
......@@ -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::
......
......@@ -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
......
......@@ -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)
......
[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
......
......@@ -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'
......
......@@ -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:
......@@ -1085,19 +1098,6 @@ def main(argv, **kw):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment