From 1c5b08de59b2c5b4f48637a086450d7c1d73977a Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 24 Jun 2017 15:45:48 +0300 Subject: [PATCH] Fixed cloning a package (library) from a private Git repository with custom user name and SSH port // Resolve #925 --- HISTORY.rst | 3 +++ platformio/managers/package.py | 8 ++++---- tests/test_managers.py | 5 +++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index c4d0bdb1..45f024b5 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -50,6 +50,9 @@ PlatformIO 3.0 * Fixed issue when `Library Dependency Finder (LDF) `__ does not handle custom ``src_dir`` (`issue #942 `_) +* Fixed cloning a package (library) from a private Git repository with + custom user name and SSH port + (`issue #925 `_) ------- diff --git a/platformio/managers/package.py b/platformio/managers/package.py index 4e416392..db207594 100644 --- a/platformio/managers/package.py +++ b/platformio/managers/package.py @@ -503,10 +503,10 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin): url_marker = "://" req_conditions = [ - not requirements, "@" in text, - (url_marker != "git@" and "://git@" not in text) or - text.count("@") > 1 - ] + not requirements, + "@" in text, + not url_marker.startswith("git") + ] # yapf: disable if all(req_conditions): text, requirements = text.rsplit("@", 1) if text.isdigit(): diff --git a/tests/test_managers.py b/tests/test_managers.py index e0d0b7a9..1f58e03e 100644 --- a/tests/test_managers.py +++ b/tests/test_managers.py @@ -127,6 +127,11 @@ def test_pkg_input_parser(): "git+ssh://git@gitlab.private-server.com/user/package#1.2.0", ("package", None, "git+ssh://git@gitlab.private-server.com/user/package#1.2.0") + ], + [ + "git+ssh://user@gitlab.private-server.com:1234/package#1.2.0", + ("package", None, + "git+ssh://user@gitlab.private-server.com:1234/package#1.2.0") ] ] for params, result in items: