summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manager.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/manager.py b/manager.py
index 746dd73a..db036f2c 100644
--- a/manager.py
+++ b/manager.py
@@ -123,15 +123,18 @@ class ASTNGManager(OptionsProviderMixIn):
directory = abspath(directory)
return Package(directory, modname, self)
- def astng_from_file(self, filepath, modname=None, fallback=True):
+ def astng_from_file(self, filepath, modname=None, fallback=True, source=False):
"""given a module name, return the astng object"""
try:
filepath = get_source_file(filepath, include_no_ext=True)
source = True
except NoSourceFile:
- source = False
+ pass
if modname is None:
- modname = '.'.join(modpath_from_file(filepath))
+ try:
+ modname = '.'.join(modpath_from_file(filepath))
+ except ImportError:
+ modname = filepath
if modname in self._cache:
return self._cache[modname]
if source:
@@ -141,7 +144,6 @@ class ASTNGManager(OptionsProviderMixIn):
except (SyntaxError, KeyboardInterrupt, SystemExit):
raise
except Exception, ex:
- raise
if __debug__:
print 'error while building astng for', filepath
import traceback