aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/package_index.py
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2005-07-24 02:41:44 +0000
committerPJ Eby <distutils-sig@python.org>2005-07-24 02:41:44 +0000
commitbaaa492f8f3100a24d723a7bb6c1d4c13295d5fb (patch)
treee8cc9c962a720f5f1a056498211355ccda534888 /setuptools/package_index.py
parent20851ca9363b0fded18d42c3bd0f2dd2105f5093 (diff)
downloadexternal_python_setuptools-baaa492f8f3100a24d723a7bb6c1d4c13295d5fb.tar.gz
external_python_setuptools-baaa492f8f3100a24d723a7bb6c1d4c13295d5fb.tar.bz2
external_python_setuptools-baaa492f8f3100a24d723a7bb6c1d4c13295d5fb.zip
Implement --editable option, which allows you to just download and extract
(or check out from Subversion) one or more source distributions, without actually building or installing them (or their dependencies). --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041147
Diffstat (limited to 'setuptools/package_index.py')
-rwxr-xr-xsetuptools/package_index.py48
1 files changed, 24 insertions, 24 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index 7c4fa49d..d5013795 100755
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -318,7 +318,7 @@ class PackageIndex(AvailableDistributions):
(spec,)
)
- return self.fetch(spec, tmpdir, force_scan)
+ return self.fetch(spec, tmpdir)
@@ -326,7 +326,7 @@ class PackageIndex(AvailableDistributions):
- def fetch(self, requirement, tmpdir, force_scan=False):
+ def fetch(self, requirement, tmpdir, force_scan=False, source=False):
"""Obtain a file suitable for fulfilling `requirement`
`requirement` must be a ``pkg_resources.Requirement`` instance.
@@ -336,35 +336,35 @@ class PackageIndex(AvailableDistributions):
the return value is the same as if you had called the ``download()``
method with the matching distribution's URL. If no matching
distribution is found, returns ``None``.
- """
+ If the `source` flag is set, only source distributions and source
+ checkout links will be considered.
+ """
# process a Requirement
self.info("Searching for %s", requirement)
+ def find(req):
+ for dist in self.get(req.key, ()):
+ if dist in req and (dist.precedence<=SOURCE_DIST or not source):
+ self.info("Best match: %s", dist)
+ return self.download(dist.location, tmpdir)
+
if force_scan:
self.find_packages(requirement)
+ dist = find(requirement)
+ else:
+ dist = find(requirement)
+ if dist is None:
+ self.find_packages(requirement)
+ dist = find(requirement)
- dist = self.best_match(requirement, WorkingSet([])) # XXX
-
- if dist is not None:
- self.info("Best match: %s", dist)
- return self.download(dist.location, tmpdir)
-
- self.warn(
- "No local packages or download links found for %s", requirement
- )
- return None
-
-
-
-
-
-
-
-
-
-
-
+ if dist is None:
+ self.warn(
+ "No local packages or download links found for %s%s",
+ (source and "a source distribution of " or ""),
+ requirement,
+ )
+ return dist
dl_blocksize = 8192