mirror of
https://github.com/clearml/clearml
synced 2025-04-29 10:43:16 +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 os
|
||||||
import codecs
|
import codecs
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
from .reqs import project_import_modules, is_std_or_local_lib, is_base_module
|
from .reqs import project_import_modules, is_std_or_local_lib, is_base_module
|
||||||
from .utils import lines_diff
|
from .utils import lines_diff
|
||||||
from .log import logger
|
from .log import logger
|
||||||
@ -104,7 +106,9 @@ class GenerateReqs(object):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# if this is a folder of our project, we can safely ignore it
|
# 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
|
continue
|
||||||
|
|
||||||
relpath = os.path.relpath(self._local_mods[name], self._project_path)
|
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):
|
if isinstance(module_info[0], FileType):
|
||||||
module_info[0].close() # noqa
|
module_info[0].close() # noqa
|
||||||
mpath = module_info[1] # noqa
|
mpath = module_info[1] # noqa
|
||||||
|
# make sure we remove built-in modules
|
||||||
|
if mpath and not os.path.exists(mpath):
|
||||||
|
mpath = None
|
||||||
else:
|
else:
|
||||||
module_info = None
|
module_info = None
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user