]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
misc/build_helpers/run_trial.py: allow the module argument to specify a leaf module...
authordavid-sarah <david-sarah@jacaranda.org>
Sun, 21 Nov 2010 23:39:57 +0000 (15:39 -0800)
committerdavid-sarah <david-sarah@jacaranda.org>
Sun, 21 Nov 2010 23:39:57 +0000 (15:39 -0800)
misc/build_helpers/run_trial.py

index d448a00f4bb44c93de0402f392500c978f424727..29fce952ea5e9f8b716687ec3a9a60322dd2dc9d 100644 (file)
@@ -52,7 +52,14 @@ if modulename is None:
 __import__(modulename)
 srcfile = sys.modules[modulename].__file__
 srcdir = os.path.dirname(os.path.realpath(srcfile))
-for i in modulename.split('.'):
+
+components = modulename.split('.')
+leaf = os.path.normcase(components[-1])
+if os.path.normcase(os.path.basename(srcfile)) in (leaf + '.py', leaf + '.pyc'):
+    # strip the leaf module name
+    components = components[:-1]
+
+for i in components:
     srcdir = os.path.dirname(srcdir)
 
 if os.path.normcase(srcdir).endswith('.egg'):