[Python-checkins] python/nondist/sandbox/setuptools/setuptools/command easy_install.py, 1.14, 1.15
pje@users.sourceforge.net
pje at users.sourceforge.net
Mon Jul 18 04:06:35 CEST 2005
- Previous message: [Python-checkins] python/nondist/sandbox/setuptools/setuptools __init__.py, 1.20, 1.21
- Next message: [Python-checkins] python/nondist/sandbox/setuptools EasyInstall.txt, 1.44, 1.45 ez_setup.py, 1.20, 1.21 pkg_resources.py, 1.46, 1.47 setup.cfg, 1.1, 1.2 setup.py, 1.31, 1.32
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10165/setuptools/command
Modified Files:
easy_install.py
Log Message:
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.
Index: easy_install.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/easy_install.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- easy_install.py 18 Jul 2005 01:39:45 -0000 1.14
+++ easy_install.py 18 Jul 2005 02:06:30 -0000 1.15
@@ -419,7 +419,7 @@
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 @@
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 @@
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 @@
"""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 @@
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 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- Previous message: [Python-checkins] python/nondist/sandbox/setuptools/setuptools __init__.py, 1.20, 1.21
- Next message: [Python-checkins] python/nondist/sandbox/setuptools EasyInstall.txt, 1.44, 1.45 ez_setup.py, 1.20, 1.21 pkg_resources.py, 1.46, 1.47 setup.cfg, 1.1, 1.2 setup.py, 1.31, 1.32
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-checkins
mailing list