[Zope3-checkins] SVN: Zope3/trunk/src/zope/dependencytool/ rename
an instance variable to make more sense
Fred L. Drake, Jr.
fred at zope.com
Wed May 19 17:52:56 EDT 2004
Log message for revision 24836:
rename an instance variable to make more sense
-=-
Modified: Zope3/trunk/src/zope/dependencytool/dependency.py
===================================================================
--- Zope3/trunk/src/zope/dependencytool/dependency.py 2004-05-19 21:41:00 UTC (rev 24835)
+++ Zope3/trunk/src/zope/dependencytool/dependency.py 2004-05-19 21:52:56 UTC (rev 24836)
@@ -20,19 +20,19 @@
class Dependency(object):
"""Object representing a dependency."""
- def __init__(self, path, file, lineno):
+ def __init__(self, name, file, lineno):
"""Initialize a Dependency instance.
- path -- dotted name of the module
+ name -- dotted name of the module
file -- full path of a source file that depends on the module
- named by path
+ named by `name`
lineno -- line number within file where the dependency was
identified (import or ZCML reference)
"""
- self.path = path
+ self.name = name
self.occurences = [(file, lineno)]
def addOccurence(self, file, lineno):
@@ -40,9 +40,9 @@
self.occurences.append((file, lineno))
def isSubPackageOf(self, dep):
- """Return True if this dependency's path is a sub-package of dep."""
- return self.path.startswith(dep.path + ".")
+ """Return True if this dependency's module is a sub-package of dep."""
+ return self.name.startswith(dep.name + ".")
def __cmp__(self, other):
"""Compare dependecies by module name."""
- return cmp(self.path, other.path)
+ return cmp(self.name, other.name)
Modified: Zope3/trunk/src/zope/dependencytool/finddeps.py
===================================================================
--- Zope3/trunk/src/zope/dependencytool/finddeps.py 2004-05-19 21:41:00 UTC (rev 24835)
+++ Zope3/trunk/src/zope/dependencytool/finddeps.py 2004-05-19 21:52:56 UTC (rev 24836)
@@ -139,7 +139,7 @@
filteredDeps = []
for dep in deps:
try:
- module = __import__(dep.path)
+ module = __import__(dep.name)
except ImportError:
continue
# built-ins (like sys) do not have a file associated
@@ -161,7 +161,7 @@
# Filter relative imports
filteredDeps = []
for dep in deps:
- module = dep.path.split('.')[0]
+ module = dep.name.split('.')[0]
modulePath = os.path.join(path, module)
if not (os.path.exists(modulePath)
or os.path.exists(modulePath+'.py')):
@@ -172,7 +172,7 @@
dottedName = makeDottedName(path)
filteredDeps = []
for dep in deps:
- if not dep.path.startswith(dottedName):
+ if not dep.name.startswith(dottedName):
filteredDeps.append(dep)
return filteredDeps
@@ -199,10 +199,10 @@
"""Remove entries that appear multiple times"""
uniqueDeps = {}
for dep in deps:
- if not dep.path in uniqueDeps.keys():
- uniqueDeps[dep.path] = dep
+ if not dep.name in uniqueDeps.keys():
+ uniqueDeps[dep.name] = dep
else:
- uniqueDeps[dep.path].addOccurence(*dep.occurences[0])
+ uniqueDeps[dep.name].addOccurence(*dep.occurences[0])
return uniqueDeps.values()
@@ -269,10 +269,10 @@
newdeps = getCleanedDependencies(path)
for dep in newdeps:
- if dep.path not in paths:
+ if dep.name not in paths:
deps.append(dep)
- paths.append(dep.path)
- modulePath = __import__(dep.path).__file__
+ paths.append(dep.name)
+ modulePath = __import__(dep.name).__file__
dirname, basename = os.path.split(modulePath)
if basename in ('__init__.py', '__init__.pyc', '__init__.pyo'):
modulePath = os.path.join(dirname, '')
@@ -294,9 +294,9 @@
print "Module: " + path
print '='*(8+len(path))
for dep in deps:
- print dep.path
+ print dep.name
if long:
- print '-'*len(dep.path)
+ print '-'*len(dep.name)
for file, lineno in dep.occurences:
file = stripZopePrefix(file)
if len(file) >= 69:
More information about the Zope3-Checkins
mailing list