diff options
author | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2010-09-06 08:47:10 +0200 |
---|---|---|
committer | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2010-09-06 08:47:10 +0200 |
commit | 85c90a919ba536992731b243416c84a95ee17934 (patch) | |
tree | b44f01e1facd6eccdefb81ff3981725dd545a891 | |
parent | 78d2a2106ce3204abbf4854d22ab4360a52a57a5 (diff) | |
parent | dcb2a720b50eb39d0f07d3d3c398808d382956de (diff) | |
download | pylint-git-85c90a919ba536992731b243416c84a95ee17934.tar.gz |
merge
-rw-r--r-- | lint.py | 2 | ||||
-rw-r--r-- | pyreverse/main.py | 20 |
2 files changed, 14 insertions, 8 deletions
@@ -212,7 +212,7 @@ This is used by the global evaluation report (R0004).'}), 'with the given id(s). You can either give multiple identifier' ' separated by comma (,) or put this option multiple time ' '(only on the command line, not in the configuration file ' - 'where it should appears only once).'}), + 'where it should appear only once).'}), ) option_groups = ( diff --git a/pyreverse/main.py b/pyreverse/main.py index 6ea8db385..da80bd63a 100644 --- a/pyreverse/main.py +++ b/pyreverse/main.py @@ -19,9 +19,9 @@ create UML diagrams for classes and modules in <packages> """ -import sys +import sys, os from logilab.common.configuration import ConfigurationMixIn -from logilab.astng.manager import astng_wrapper, ASTNGManager +from logilab.astng.manager import ASTNGManager from logilab.astng.inspector import Linker from pylint.pyreverse.diadefslib import DiadefsHandler @@ -84,7 +84,6 @@ this disables -f values")), #( ('quiet', #dict(help='run quietly', action='store_true', short='q')), ) - class PyreverseCommand(ConfigurationMixIn): """base class providing common behaviour for pyreverse commands""" @@ -103,10 +102,17 @@ class PyreverseCommand(ConfigurationMixIn): if not args: print self.help() return - project = self.manager.project_from_files(args, astng_wrapper) - linker = Linker(project, tag=True) - handler = DiadefsHandler(self.config) - diadefs = handler.get_diadefs(project, linker) + # insert current working directory to the python path to recognize + # dependencies to local modules even if cwd is not in the PYTHONPATH + sys.path.insert(0, os.getcwd()) + try: + project = self.manager.project_from_files(args) + linker = Linker(project, tag=True) + handler = DiadefsHandler(self.config) + diadefs = handler.get_diadefs(project, linker) + finally: + sys.path.pop(0) + if self.config.output_format == "vcg": writer.VCGWriter(self.config).write(diadefs) else: |