diff options
author | PJ Eby <distutils-sig@python.org> | 2005-05-29 07:13:43 +0000 |
---|---|---|
committer | PJ Eby <distutils-sig@python.org> | 2005-05-29 07:13:43 +0000 |
commit | 7f1fb72b0cc909fc1b53df18c6e027f0f1d742d7 (patch) | |
tree | cb00d18b185baf146dab63de4a8952713764724a /easy_install.py | |
parent | aeb8585bd48ea399347e58da37b03b871ae92232 (diff) | |
download | python-setuptools-bitbucket-7f1fb72b0cc909fc1b53df18c6e027f0f1d742d7.tar.gz |
Add support for using Installer subclasses, especially ones with support
for searching a package database.
Diffstat (limited to 'easy_install.py')
-rwxr-xr-x | easy_install.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/easy_install.py b/easy_install.py index 36482fe4..eb294d01 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) |