From 998f4ed6e640c16b1d8f4d25653edcbe991ee534 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sat, 16 Sep 2017 00:57:36 +0300 Subject: [PATCH] Use VCS directly with "platform" option in configuration file --- docs | 2 +- platformio/managers/platform.py | 11 ++++++----- tests/test_managers.py | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs b/docs index cfd1df93..2a191b0b 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit cfd1df9393c51956df64142f7035fafd7e0d3fce +Subproject commit 2a191b0bd7625616fb32bd2219fc649b4cb63f80 diff --git a/platformio/managers/platform.py b/platformio/managers/platform.py index de009bf2..839e8a2b 100644 --- a/platformio/managers/platform.py +++ b/platformio/managers/platform.py @@ -210,18 +210,19 @@ class PlatformFactory(object): @classmethod def newPlatform(cls, name, requirements=None): + pm = PlatformManager() platform_dir = None if isdir(name): platform_dir = name - name = PlatformManager().load_manifest(platform_dir)['name'] + name = pm.load_manifest(platform_dir)['name'] elif name.endswith("platform.json") and isfile(name): platform_dir = dirname(name) name = util.load_json(name)['name'] else: - if not requirements and "@" in name: - name, requirements = name.rsplit("@", 1) - platform_dir = PlatformManager().get_package_dir( - name, requirements) + name, requirements, url = pm.parse_pkg_input(name, requirements) + platform_dir = pm.get_package_dir(name, requirements, url) + if platform_dir: + name = pm.load_manifest(platform_dir)['name'] if not platform_dir: raise exception.UnknownPlatform(name if not requirements else diff --git a/tests/test_managers.py b/tests/test_managers.py index 1f58e03e..a26742bc 100644 --- a/tests/test_managers.py +++ b/tests/test_managers.py @@ -25,8 +25,8 @@ def test_pkg_input_parser(): [("PkgName", "!=1.2.3,<2.0"), ("PkgName", "!=1.2.3,<2.0", None)], ["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)], + ["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())