Commit 654f9d5b authored by Christof Schulze's avatar Christof Schulze 😎
Browse files

fixed problem with paths (None != 'None')

parent 082afba1
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -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---------')
+1 −1
Original line number Diff line number Diff line
@@ -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)