summaryrefslogtreecommitdiff
path: root/easy_install.py
diff options
context:
space:
mode:
authorpje <pje@6015fed2-1504-0410-9fe1-9d1591cc4771>2005-05-29 07:13:43 +0000
committerpje <pje@6015fed2-1504-0410-9fe1-9d1591cc4771>2005-05-29 07:13:43 +0000
commit837b7fb14b019389f588a742129851186d42b4ba (patch)
treecb00d18b185baf146dab63de4a8952713764724a /easy_install.py
parent0767aa6560c9c99db95fe98db54ed94b58ae2dbe (diff)
downloadpython-setuptools-837b7fb14b019389f588a742129851186d42b4ba.tar.gz
Add support for using Installer subclasses, especially ones with support
for searching a package database. git-svn-id: http://svn.python.org/projects/sandbox/trunk/setuptools@41023 6015fed2-1504-0410-9fe1-9d1591cc4771
Diffstat (limited to 'easy_install.py')
-rwxr-xr-xeasy_install.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/easy_install.py b/easy_install.py
index 36482fe..eb294d0 100755
--- a/easy_install.py
+++ b/easy_install.py
@@ -235,14 +235,14 @@ class Installer:
"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 @@ class Installer:
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 @@ class PthDistributions(AvailableDistributions):
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 @@ def main(argv):
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)