diff --git a/git.py b/git.py index 22360a09c15ed7fec2eb39947114196d10edc3d4..11f4651720e2344d9b994f500511b213503e3916 100644 --- a/git.py +++ b/git.py @@ -3,7 +3,7 @@ import os import time import yaml -from ammsml.utils.path import unfrackpath +from ammsml.utils.path import unfrackpath, resolve_path __all__ = ['gitinfo'] @@ -59,10 +59,10 @@ def gitinfo(path=None): # for use in ammsml basedir = os.path.join(os.path.dirname(__file__)) else: - basedir = unfrackpath(path) - - repo_path = os.path.join(basedir, '.git') - print("repo_path", repo_path) + basedir = path + # print('basedir', basedir) + repo_path = unfrackpath(os.path.join(basedir, '.git')) + # print("repo_path", repo_path) result = _git_repo_info(repo_path) submodules = os.path.join(basedir, '.gitmodules') @@ -90,12 +90,16 @@ if __name__ == '__main__': """ print('Testing Git\n===========') print('None', __file__) + print('path', __file__) print(gitinfo(), '\n---------') - testdir = unfrackpath(os.path.join(os.path.dirname(__file__), '..', 'config')) - print('path', testdir) - print(gitinfo(testdir), '\n---------') + testdir1 = resolve_path(os.path.join(os.path.dirname(__file__), '..', 'config')) + print('path', os.path.join(os.path.dirname(__file__), '..', 'config')) + print('path', testdir1) + print(gitinfo(testdir1), '\n---------') - testdir = unfrackpath(os.path.join(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'file_utils'))) - print('path', testdir) - print(gitinfo(testdir), '\n---------') + testdir2 = resolve_path(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'python', 'file_utils')) + print(os.path.dirname(__file__)) + print('path', os.path.join(os.path.dirname(__file__), '..', '..', '..', 'python', 'file_utils')) + print('path', testdir2) + print(gitinfo(testdir2), '\n---------') diff --git a/path.py b/path.py index defe961acbfd25d00fe13b0a3bcb135e71f5805e..dbd47ae191fadc2620dd08aa283337c76fee89cf 100644 --- a/path.py +++ b/path.py @@ -50,7 +50,7 @@ def unfrackpath(path, follow=True, basedir=None): """ b_basedir = to_text(basedir) - if b_basedir is None: + if b_basedir == 'None': b_basedir = to_text(os.getcwd()) elif os.path.isfile(b_basedir): b_basedir = os.path.dirname(b_basedir)