diff --git a/.moban.cd/moban.yml b/.moban.cd/moban.yml index 480c0f13..0ff2e3d6 100644 --- a/.moban.cd/moban.yml +++ b/.moban.cd/moban.yml @@ -24,7 +24,7 @@ dependencies: - appdirs>=1.2.0 - crayons>= 0.1.0 - GitPython>=2.0.0 - - giturlparse>=0.9.1 + - git-url-parse>=1.2.2 description: Yet another jinja2 cli command for static text generation scm_host: github.com lint_command: make lint install_test format install update diff --git a/.moban.d/travis.yml b/.moban.d/travis.yml index 741fd994..01e298ba 100644 --- a/.moban.d/travis.yml +++ b/.moban.d/travis.yml @@ -10,7 +10,6 @@ matrix: {%block custom_python_versions%} python: - &pypy2 pypy2.7-6.0 - - 3.8-dev - 3.7 - 3.6 - 3.5 diff --git a/.travis.yml b/.travis.yml index 6706df51..e5734eba 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ notifications: email: false python: - &pypy2 pypy2.7-6.0 - - 3.8-dev - 3.7 - 3.6 - 3.5 diff --git a/min_requirements.txt b/min_requirements.txt index 3f7c2ca6..4e76ef0a 100644 --- a/min_requirements.txt +++ b/min_requirements.txt @@ -4,4 +4,4 @@ lml==0.0.9 appdirs==1.2.0 crayons== 0.1.0 GitPython==2.0.0 -giturlparse==0.9.1 +git-url-parse==1.2.2 diff --git a/moban/repo.py b/moban/repo.py index c614aeeb..02fdd6de 100644 --- a/moban/repo.py +++ b/moban/repo.py @@ -44,14 +44,12 @@ def git_clone(requires): def get_repo_name(repo_url): import giturlparse + from giturlparse.parser import ParserError try: - repo = giturlparse.parse(repo_url) - name = repo.repo - if name.endswith("/"): - name = name[:-1] - return name - except AttributeError: + repo = giturlparse.parse(repo_url.rstrip("/")) + return repo.name + except ParserError: reporter.report_error_message( constants.MESSAGE_INVALID_GIT_URL % repo_url ) diff --git a/requirements.txt b/requirements.txt index 7dd42624..b835604e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,4 @@ lml>=0.0.9 appdirs>=1.2.0 crayons>= 0.1.0 GitPython>=2.0.0 -giturlparse>=0.9.1 +git-url-parse>=1.2.2 diff --git a/setup.py b/setup.py index 75ca297a..d9b773c2 100644 --- a/setup.py +++ b/setup.py @@ -73,7 +73,7 @@ "appdirs>=1.2.0", "crayons>= 0.1.0", "GitPython>=2.0.0", - "giturlparse>=0.9.1", + "git-url-parse>=1.2.2", ] SETUP_COMMANDS = {} diff --git a/tests/test_repo.py b/tests/test_repo.py index aa70beed..1c82e258 100644 --- a/tests/test_repo.py +++ b/tests/test_repo.py @@ -125,14 +125,16 @@ def test_update_existing_with_reference_parameter( def test_get_repo_name(): repos = [ - "https://github.com/sphinx-doc/sphinx", + "https://github.com/repo-abc-def/repo", "https://github.com/abc/repo", "https://github.com/abc/repo.git", "https://github.com/abc/repo/", - "git@github.com:moremoban/moban.git", + "git@github.com:abc/repo.git", + "git@bitbucket.org:abc/repo.git", + "git://github.com/abc/repo.git", ] actual = [get_repo_name(repo) for repo in repos] - expected = ["sphinx", "repo", "repo", "repo", "moban"] + expected = ["repo"] * len(repos) eq_(expected, actual)