[Python-checkins] python/nondist/sandbox/setuptools easy_install.py, 1.4, 1.5
pje@users.sourceforge.net
pje at users.sourceforge.net
Sun May 29 09:13:45 CEST 2005
Update of /cvsroot/python/python/nondist/sandbox/setuptools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13044
Modified Files:
easy_install.py
Log Message:
Add support for using Installer subclasses, especially ones with support
for searching a package database.
Index: easy_install.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/easy_install.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- easy_install.py 29 May 2005 06:41:14 -0000 1.4
+++ easy_install.py 29 May 2005 07:13:43 -0000 1.5
@@ -235,14 +235,14 @@
"Not a URL, existing file, or requirement spec: %r" %
(spec,)
)
+
# process a Requirement
dist = AvailableDistributions().best_match(spec,[])
if dist is not None and dist.path.endswith('.egg'):
return dist.path
- # TODO: search here for a distro to download
+ return self.download(self._find_package(spec))
- raise DistributionNotFound(spec)
def install_eggs(self, dist_filename):
# .egg dirs or files are already built, so just return them
@@ -351,10 +351,10 @@
sys.argv[:] = save_argv
-
-
-
-
+ def _find_package(self, req):
+ # TODO: search here for a distro to download, matching Requirement
+ # 'req' and return the package URL or filename
+ raise DistributionNotFound(spec)
@@ -492,7 +492,7 @@
URL_SCHEME = re.compile('([-+.a-z0-9]{2,}):',re.I).match
-def main(argv):
+def main(argv, factory=Installer):
from optparse import OptionParser
parser = OptionParser(usage = "usage: %prog [options] url [url...]")
@@ -514,7 +514,7 @@
raise RuntimeError("No urls, filenames, or requirements specified")
for spec in args:
- inst = Installer(options.instdir, options.zip_ok, options.multi)
+ inst = factory(options.instdir, options.zip_ok, options.multi)
try:
print "Downloading", spec
downloaded = inst.download(spec)
More information about the Python-checkins
mailing list