Fixed an issue when can not remove update or remove external dev-platform using PlatformIO Home // Resolve #3663

This commit is contained in:
Ivan Kravets
2020-09-09 17:53:04 +03:00
parent de2b5ea905
commit 6987d6c1c6
3 changed files with 16 additions and 7 deletions
+10 -3
View File
@@ -209,6 +209,7 @@ class PackageSpec(object): # pylint: disable=too-many-instance-attributes
raw = raw.strip()
parsers = (
self._parse_local_file,
self._parse_requirements,
self._parse_custom_name,
self._parse_id,
@@ -227,10 +228,16 @@ class PackageSpec(object): # pylint: disable=too-many-instance-attributes
# the leftover is a package name
self.name = raw
def _parse_requirements(self, raw):
if "@" not in raw:
@staticmethod
def _parse_local_file(raw):
if raw.startswith("file://") or not any(c in raw for c in ("/", "\\")):
return raw
if raw.startswith("file://") and os.path.exists(raw[7:]):
if os.path.exists(raw):
return "file://%s" % raw
return raw
def _parse_requirements(self, raw):
if "@" not in raw or raw.startswith("file://"):
return raw
tokens = raw.rsplit("@", 1)
if any(s in tokens[1] for s in (":", "/")):