[Checkins] SVN: z3c.dependencychecker/trunk/ Looking for a package directory named after the package name in preference
Reinout van Rees
reinout at vanrees.org
Mon Sep 19 09:10:32 EST 2011
Log message for revision 122841:
Looking for a package directory named after the package name in preference
to the src/ directory.
Changed:
U z3c.dependencychecker/trunk/CHANGES.txt
U z3c.dependencychecker/trunk/src/z3c/dependencychecker/dependencychecker.py
-=-
Modified: z3c.dependencychecker/trunk/CHANGES.txt
===================================================================
--- z3c.dependencychecker/trunk/CHANGES.txt 2011-09-19 10:29:08 UTC (rev 122840)
+++ z3c.dependencychecker/trunk/CHANGES.txt 2011-09-19 14:10:32 UTC (rev 122841)
@@ -4,11 +4,13 @@
1.2 (unreleased)
----------------
-- First attempt at compensating for django-style 'django-something' package
- names with 'django_something' package directories. Dash versus underscore.
- Needs more work.
+- Looking for a package directory named after the package name in preference
+ to the src/ directory.
+- Compensating for django-style 'django-something' package names with
+ 'django_something' package directories. Dash versus underscore.
+
1.1 (2010-01-06)
----------------
Modified: z3c.dependencychecker/trunk/src/z3c/dependencychecker/dependencychecker.py
===================================================================
--- z3c.dependencychecker/trunk/src/z3c/dependencychecker/dependencychecker.py 2011-09-19 10:29:08 UTC (rev 122840)
+++ z3c.dependencychecker/trunk/src/z3c/dependencychecker/dependencychecker.py 2011-09-19 14:10:32 UTC (rev 122841)
@@ -181,7 +181,7 @@
def filter_unneeded(imports, required):
name = name_from_setup()
- imports.append(name) # We always use ourselves, obviously.
+ imports.append(name) # We always use ourselves, obviously.
imports = set(imports)
required = set(required)
setuptools_and_friends = set(
@@ -280,10 +280,16 @@
def determine_path(args):
+ path = None
if len(args) > 0:
path = args[0]
else:
- # Default
+ name = name_from_setup()
+ name = name.replace('-', '_')
+ if name in os.listdir('.'):
+ path = name
+ if path is None:
+ # Fallback.
path = os.path.join(os.getcwd(), 'src')
path = os.path.abspath(path)
if not os.path.isdir(path):
@@ -298,13 +304,13 @@
def main():
- usage = "Usage: %prog [path]\n (path defaults to 'src')"
+ usage = ("Usage: %prog [path]\n" +
+ "(path defaults to package name, fallback is 'src/')")
parser = optparse.OptionParser(usage=usage, version=_version())
(options, args) = parser.parse_args()
path = determine_path(args)
db = importchecker.ImportDatabase(path)
- # TODO: find zcml files
db.findModules()
unused_imports = db.getUnusedImports()
test_imports = db.getImportedModuleNames(tests=True)
@@ -342,7 +348,6 @@
test_required)
print_modules(test_unneeded, "Unneeded test requirements")
-
if install_missing or test_missing or install_unneeded or test_unneeded:
print "Note: requirements are taken from the egginfo dir, so you need"
print "to re-run buildout (or setup.py or whatever) for changes in "
More information about the checkins
mailing list