Fix unable to include SSH user in `lib_deps` repository url // Resolve #830 Resolve #836

This commit is contained in:
Ivan Kravets
2016-12-02 20:47:37 +02:00
parent acf56b28a1
commit 822ba63486
3 changed files with 65 additions and 40 deletions

View File

@ -40,6 +40,8 @@ PlatformIO 3.0
for circular dependencies
* Show vendor version of a package for `platformio platform show <http://docs.platformio.org/en/stable/userguide/platforms/cmd_show.html>`__ command
(`issue #838 <https://github.com/platformio/platformio/issues/838>`_)
* Fixed unable to include SSH user in ``lib_deps`` repository url
(`issue #830 <https://github.com/platformio/platformio/issues/830>`_)
* Fixed issue with ``PATH`` auto-configuring for upload tools
* Fixed ``99-platformio-udev.rules`` checker for Linux OS

View File

@ -170,7 +170,7 @@ class PkgInstallerMixin(object):
break
except Exception as e: # pylint: disable=broad-except
click.secho("Warning! Package Mirror: %s" % e, fg="yellow")
click.secho("Looking for the another mirror...", fg="yellow")
click.secho("Looking for other mirror...", fg="yellow")
if versions is None:
raise exception.UnknownPackage(name)
@ -297,12 +297,15 @@ class BasePkgManager(PkgRepoMixin, PkgInstallerMixin):
def parse_pkg_name( # pylint: disable=too-many-branches
text, requirements=None):
text = str(text)
if not requirements and "@" in text and not text.startswith("git@"):
url_marker = "://"
if not any([
requirements, "@" not in text, text.startswith("git@"),
url_marker in text
]):
text, requirements = text.rsplit("@", 1)
if text.isdigit():
text = "id=" + text
url_marker = "://"
name, url = (None, text)
if "=" in text and not text.startswith("id="):
name, url = text.split("=", 1)

View File

@ -23,43 +23,63 @@ def test_pkg_name_parser():
["PkgName@1.2.3", ("PkgName", "1.2.3", None)],
[("PkgName@1.2.3", "1.2.5"), ("PkgName@1.2.3", "1.2.5", None)],
["id:13", ("id:13", None, None)],
["id:13@~1.2.3", ("id:13", "~1.2.3", None)],
[util.get_home_dir(),
(".platformio", None, "file://" + util.get_home_dir())],
["LocalName=" + util.get_home_dir(),
("LocalName", None, "file://" + util.get_home_dir())],
["https://github.com/user/package.git",
("package", None, "git+https://github.com/user/package.git")],
["https://gitlab.com/user/package.git",
("package", None, "git+https://gitlab.com/user/package.git")],
["https://github.com/user/package/archive/branch.zip",
("branch", None,
"https://github.com/user/package/archive/branch.zip")],
["https://github.com/user/package/archive/branch.tar.gz",
("branch", None,
"https://github.com/user/package/archive/branch.tar.gz")],
["https://developer.mbed.org/users/user/code/package/",
("package", None,
"hg+https://developer.mbed.org/users/user/code/package/")],
["https://github.com/user/package#v1.2.3",
("package", None, "git+https://github.com/user/package#v1.2.3")],
["https://github.com/user/package.git#branch",
("package", None, "git+https://github.com/user/package.git#branch")],
["PkgName=https://github.com/user/package.git#a13d344fg56",
("PkgName", None,
"git+https://github.com/user/package.git#a13d344fg56")],
["PkgName=user/package",
("PkgName", None, "git+https://github.com/user/package")],
["PkgName=user/package#master",
("PkgName", None, "git+https://github.com/user/package#master")],
["git+https://github.com/user/package",
("package", None, "git+https://github.com/user/package")],
["hg+https://example.com/user/package",
("package", None, "hg+https://example.com/user/package")],
["git@github.com:user/package.git",
("package", None, "git@github.com:user/package.git")],
["git@github.com:user/package.git#v1.2.0",
("package", None, "git@github.com:user/package.git#v1.2.0")]
["id:13@~1.2.3", ("id:13", "~1.2.3", None)], [
util.get_home_dir(),
(".platformio", None, "file://" + util.get_home_dir())
], [
"LocalName=" + util.get_home_dir(),
("LocalName", None, "file://" + util.get_home_dir())
], [
"https://github.com/user/package.git",
("package", None, "git+https://github.com/user/package.git")
], [
"https://gitlab.com/user/package.git",
("package", None, "git+https://gitlab.com/user/package.git")
], [
"https://github.com/user/package/archive/branch.zip",
("branch", None,
"https://github.com/user/package/archive/branch.zip")
], [
"https://github.com/user/package/archive/branch.tar.gz",
("branch", None,
"https://github.com/user/package/archive/branch.tar.gz")
], [
"https://developer.mbed.org/users/user/code/package/",
("package", None,
"hg+https://developer.mbed.org/users/user/code/package/")
], [
"https://github.com/user/package#v1.2.3",
("package", None, "git+https://github.com/user/package#v1.2.3")
], [
"https://github.com/user/package.git#branch",
("package", None, "git+https://github.com/user/package.git#branch")
], [
"PkgName=https://github.com/user/package.git#a13d344fg56",
("PkgName", None,
"git+https://github.com/user/package.git#a13d344fg56")
], [
"PkgName=user/package",
("PkgName", None, "git+https://github.com/user/package")
], [
"PkgName=user/package#master",
("PkgName", None, "git+https://github.com/user/package#master")
], [
"git+https://github.com/user/package",
("package", None, "git+https://github.com/user/package")
], [
"hg+https://example.com/user/package",
("package", None, "hg+https://example.com/user/package")
], [
"git@github.com:user/package.git",
("package", None, "git@github.com:user/package.git")
], [
"git@github.com:user/package.git#v1.2.0",
("package", None, "git@github.com:user/package.git#v1.2.0")
], [
"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")
]
]
for params, result in items:
if isinstance(params, tuple):