[Checkins] SVN: z3c.autoinclude/trunk/src/z3c/autoinclude/utils.py another minor refactor: switch distributionForPackage and distributionForDottedName so that the latter, not the former, is the 'core' function; this reduces the number of times we resolve and unresolve a package

Ethan Jucovy ejucovy at openplans.org
Mon Apr 21 12:17:18 EDT 2008


Log message for revision 85538:
  another minor refactor: switch distributionForPackage and distributionForDottedName so that the latter, not the former, is the 'core' function; this reduces the number of times we resolve and unresolve a package

Changed:
  U   z3c.autoinclude/trunk/src/z3c/autoinclude/utils.py

-=-
Modified: z3c.autoinclude/trunk/src/z3c/autoinclude/utils.py
===================================================================
--- z3c.autoinclude/trunk/src/z3c/autoinclude/utils.py	2008-04-21 16:13:37 UTC (rev 85537)
+++ z3c.autoinclude/trunk/src/z3c/autoinclude/utils.py	2008-04-21 16:17:17 UTC (rev 85538)
@@ -59,6 +59,9 @@
 
 def distributionForPackage(package):
     package_dottedname = package.__name__
+    return distributionForDottedName(package_dottedname)
+
+def distributionForDottedName(package_dottedname):
     valid_dists_for_package = []
     for path in sys.path:
         dists = find_distributions(path, True)
@@ -76,8 +79,6 @@
     assert len(valid_dists_for_package) == 1, "Multiple distributions found for package %s; z3c.autoinclude refuses to guess." % package_dottedname
     return valid_dists_for_package[0]
 
-def distributionForDottedName(dotted_name):
-    return distributionForPackage(resolve(dotted_name))
 
 def namespaceDottedNames(dist):
     """



More information about the Checkins mailing list