Skip to content

Commit

Permalink
pyreverse - Add project modules to sys.path
Browse files Browse the repository at this point in the history
  • Loading branch information
mbyrnepr2 committed Aug 16, 2021
1 parent 74ea145 commit 850fc17
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pylint/pyreverse/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
create UML diagrams for classes and modules in <packages>
"""
import os
import sys
from typing import Iterable

from pylint.config import ConfigurationMixIn
from pylint.lint.utils import fix_import_path
from pylint.pyreverse import writer
from pylint.pyreverse.diadefslib import DiadefsHandler
from pylint.pyreverse.inspector import Linker, project_from_files
Expand Down Expand Up @@ -212,10 +212,7 @@ def run(self, args):
if not args:
print(self.help())
return 1
# 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:
with fix_import_path(args):
project = project_from_files(
args,
project_name=self.config.project,
Expand All @@ -224,9 +221,7 @@ def run(self, args):
linker = Linker(project, tag=True)
handler = DiadefsHandler(self.config)
diadefs = handler.get_diadefs(project, linker)
finally:
sys.path.pop(0)
writer.DiagramWriter(self.config).write(diadefs)
writer.DiagramWriter(self.config).write(diadefs)
return 0


Expand Down

0 comments on commit 850fc17

Please sign in to comment.