Ignore local modules imported from a folder inside the git project

This commit is contained in:
allegroai 2020-04-01 19:01:21 +03:00
parent 172ed62d41
commit 6de3d4b6fd

View File

@ -52,6 +52,12 @@ class GenerateReqs(object):
# add local modules, so we know what is used but not installed.
for name in self._local_mods:
if name in modules:
# if this is a folder of our project, we can safely ignore it
if os.path.commonpath([os.path.realpath(self._project_path)]) == \
os.path.commonpath([os.path.realpath(self._project_path),
os.path.realpath(self._local_mods[name])]):
continue
relpath = os.path.relpath(self._local_mods[name], self._project_path)
if not relpath.startswith('.'):
relpath = '.' + os.path.sep + relpath