summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTarek Ziade <tarek@ziade.org>2012-03-13 16:59:45 -0700
committerTarek Ziade <tarek@ziade.org>2012-03-13 16:59:45 -0700
commit4b147eec43fb56c73ca8c2fa7ec15eac34430ea8 (patch)
treebcc250b62811930b5a3b4f0c426cf0d221ec9627
parentdabae8367f0860e94aabdf600b8ca96aada784cf (diff)
downloaddisutils2-4b147eec43fb56c73ca8c2fa7ec15eac34430ea8.tar.gz
switching to use_egg_info by default
-rw-r--r--distutils2/database.py8
-rw-r--r--distutils2/tests/test_database.py49
2 files changed, 35 insertions, 22 deletions
diff --git a/distutils2/database.py b/distutils2/database.py
index 29b0926..9c5e682 100644
--- a/distutils2/database.py
+++ b/distutils2/database.py
@@ -495,7 +495,7 @@ def distinfo_dirname(name, version):
return '-'.join([name, normalized_version]) + file_extension
-def get_distributions(use_egg_info=False, paths=None):
+def get_distributions(use_egg_info=True, paths=None):
"""
Provides an iterator that looks for ``.dist-info`` directories in
``sys.path`` and returns :class:`Distribution` instances for each one of
@@ -522,7 +522,7 @@ def get_distributions(use_egg_info=False, paths=None):
yield dist
-def get_distribution(name, use_egg_info=False, paths=None):
+def get_distribution(name, use_egg_info=True, paths=None):
"""
Scans all elements in ``sys.path`` and looks for all directories
ending with ``.dist-info``. Returns a :class:`Distribution`
@@ -557,7 +557,7 @@ def get_distribution(name, use_egg_info=False, paths=None):
return None
-def obsoletes_distribution(name, version=None, use_egg_info=False):
+def obsoletes_distribution(name, version=None, use_egg_info=True):
"""
Iterates over all distributions to find which distributions obsolete
*name*.
@@ -591,7 +591,7 @@ def obsoletes_distribution(name, version=None, use_egg_info=False):
break
-def provides_distribution(name, version=None, use_egg_info=False):
+def provides_distribution(name, version=None, use_egg_info=True):
"""
Iterates over all distributions to find which distributions provide *name*.
If a *version* is provided, it will be used to filter the results. Scans
diff --git a/distutils2/tests/test_database.py b/distutils2/tests/test_database.py
index c09c349..09db9ef 100644
--- a/distutils2/tests/test_database.py
+++ b/distutils2/tests/test_database.py
@@ -330,7 +330,7 @@ class TestDatabase(support.LoggingCatcher,
found_dists = []
# Verify the fake dists have been found.
- dists = [dist for dist in get_distributions()]
+ dists = [dist for dist in get_distributions(use_egg_info=False)]
for dist in dists:
self.assertIsInstance(dist, Distribution)
if (dist.name in dict(fake_dists) and
@@ -381,10 +381,10 @@ class TestDatabase(support.LoggingCatcher,
# Verify that it does not find egg-info distributions, when not
# instructed to
- self.assertIsNone(get_distribution('bacon'))
- self.assertIsNone(get_distribution('cheese'))
- self.assertIsNone(get_distribution('strawberry'))
- self.assertIsNone(get_distribution('banana'))
+ self.assertIsNone(get_distribution('bacon', use_egg_info=False))
+ self.assertIsNone(get_distribution('cheese', use_egg_info=False))
+ self.assertIsNone(get_distribution('strawberry', use_egg_info=False))
+ self.assertIsNone(get_distribution('banana', use_egg_info=False))
# Now check that it works well in both situations, when egg-info
# is a file and directory respectively.
@@ -418,24 +418,29 @@ class TestDatabase(support.LoggingCatcher,
# Test for looking up distributions by what they provide
checkLists = lambda x, y: self.assertEqual(sorted(x), sorted(y))
- l = [dist.name for dist in provides_distribution('truffles')]
+ l = [dist.name for dist in provides_distribution('truffles',
+ use_egg_info=False)]
checkLists(l, ['choxie', 'towel-stuff'])
- l = [dist.name for dist in provides_distribution('truffles', '1.0')]
+ l = [dist.name for dist in provides_distribution('truffles', '1.0',
+ use_egg_info=False)]
checkLists(l, ['choxie'])
l = [dist.name for dist in provides_distribution('truffles', '1.0',
use_egg_info=True)]
checkLists(l, ['choxie', 'cheese'])
- l = [dist.name for dist in provides_distribution('truffles', '1.1.2')]
+ l = [dist.name for dist in provides_distribution('truffles', '1.1.2',
+ use_egg_info=False)]
checkLists(l, ['towel-stuff'])
- l = [dist.name for dist in provides_distribution('truffles', '1.1')]
+ l = [dist.name for dist in provides_distribution('truffles', '1.1',
+ use_egg_info=False)]
checkLists(l, ['towel-stuff'])
l = [dist.name for dist in provides_distribution('truffles',
- '!=1.1,<=2.0')]
+ '!=1.1,<=2.0',
+ use_egg_info=False)]
checkLists(l, ['choxie'])
l = [dist.name for dist in provides_distribution('truffles',
@@ -443,17 +448,20 @@ class TestDatabase(support.LoggingCatcher,
use_egg_info=True)]
checkLists(l, ['choxie', 'bacon', 'cheese'])
- l = [dist.name for dist in provides_distribution('truffles', '>1.0')]
+ l = [dist.name for dist in provides_distribution('truffles', '>1.0',
+ use_egg_info=False)]
checkLists(l, ['towel-stuff'])
- l = [dist.name for dist in provides_distribution('truffles', '>1.5')]
+ l = [dist.name for dist in provides_distribution('truffles', '>1.5',
+ use_egg_info=False)]
checkLists(l, [])
l = [dist.name for dist in provides_distribution('truffles', '>1.5',
use_egg_info=True)]
checkLists(l, ['bacon'])
- l = [dist.name for dist in provides_distribution('truffles', '>=1.0')]
+ l = [dist.name for dist in provides_distribution('truffles', '>=1.0',
+ use_egg_info=False)]
checkLists(l, ['choxie', 'towel-stuff'])
l = [dist.name for dist in provides_distribution('strawberry', '0.6',
@@ -485,28 +493,33 @@ class TestDatabase(support.LoggingCatcher,
# Test looking for distributions based on what they obsolete
checkLists = lambda x, y: self.assertEqual(sorted(x), sorted(y))
- l = [dist.name for dist in obsoletes_distribution('truffles', '1.0')]
+ l = [dist.name for dist in obsoletes_distribution('truffles', '1.0',
+ use_egg_info=False)]
checkLists(l, [])
l = [dist.name for dist in obsoletes_distribution('truffles', '1.0',
use_egg_info=True)]
checkLists(l, ['cheese', 'bacon'])
- l = [dist.name for dist in obsoletes_distribution('truffles', '0.8')]
+ l = [dist.name for dist in obsoletes_distribution('truffles', '0.8',
+ use_egg_info=False)]
checkLists(l, ['choxie'])
l = [dist.name for dist in obsoletes_distribution('truffles', '0.8',
use_egg_info=True)]
checkLists(l, ['choxie', 'cheese'])
- l = [dist.name for dist in obsoletes_distribution('truffles', '0.9.6')]
+ l = [dist.name for dist in obsoletes_distribution('truffles', '0.9.6',
+ use_egg_info=False)]
checkLists(l, ['choxie', 'towel-stuff'])
l = [dist.name for dist in obsoletes_distribution('truffles',
- '0.5.2.3')]
+ '0.5.2.3',
+ use_egg_info=False)]
checkLists(l, ['choxie', 'towel-stuff'])
- l = [dist.name for dist in obsoletes_distribution('truffles', '0.2')]
+ l = [dist.name for dist in obsoletes_distribution('truffles', '0.2',
+ use_egg_info=False)]
checkLists(l, ['towel-stuff'])
@requires_zlib