From 6de3d4b6fdc2e7b296b3a0fc36d2f165b4bd75b2 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Wed, 1 Apr 2020 19:01:21 +0300 Subject: [PATCH] Ignore local modules imported from a folder inside the git project --- trains/utilities/pigar/__main__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/trains/utilities/pigar/__main__.py b/trains/utilities/pigar/__main__.py index 7508b799..32828bc6 100644 --- a/trains/utilities/pigar/__main__.py +++ b/trains/utilities/pigar/__main__.py @@ -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