mirror of
https://github.com/clearml/clearml
synced 2025-03-03 18:52:12 +00:00
Fix Python2 pigar compatibility
This commit is contained in:
parent
cab63faef3
commit
08f01967ce
@ -5,6 +5,8 @@ from __future__ import print_function, division, absolute_import
|
||||
import os
|
||||
import codecs
|
||||
|
||||
import six
|
||||
|
||||
from .reqs import project_import_modules, is_std_or_local_lib, is_base_module
|
||||
from .utils import lines_diff
|
||||
from .log import logger
|
||||
@ -104,7 +106,9 @@ class GenerateReqs(object):
|
||||
continue
|
||||
|
||||
# if this is a folder of our project, we can safely ignore it
|
||||
if os.path.commonpath([project_path]) == os.path.commonpath([project_path, mod_path]):
|
||||
if (six.PY3 and os.path.commonpath([project_path]) == os.path.commonpath([project_path, mod_path])) or \
|
||||
(six.PY2 and
|
||||
os.path.commonprefix([project_path]) == os.path.commonprefix([project_path, mod_path])):
|
||||
continue
|
||||
|
||||
relpath = os.path.relpath(self._local_mods[name], self._project_path)
|
||||
|
@ -303,6 +303,9 @@ def is_std_or_local_lib(name):
|
||||
if isinstance(module_info[0], FileType):
|
||||
module_info[0].close() # noqa
|
||||
mpath = module_info[1] # noqa
|
||||
# make sure we remove built-in modules
|
||||
if mpath and not os.path.exists(mpath):
|
||||
mpath = None
|
||||
else:
|
||||
module_info = None
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user