mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 01:57:13 +02:00
Added workaround for Python SemVer package's issue 61 with caret range and pre-releases
This commit is contained in:
@ -16,6 +16,7 @@ PlatformIO 3.0
|
|||||||
(`issue #1665 <https://github.com/platformio/platformio-core/issues/1665>`_)
|
(`issue #1665 <https://github.com/platformio/platformio-core/issues/1665>`_)
|
||||||
* Handle "architectures" data from "library.properties" manifest in
|
* Handle "architectures" data from "library.properties" manifest in
|
||||||
`lib_compat_mode = strict <http://docs.platformio.org/en/page/librarymanager/ldf.html#compatibility-mode>`__
|
`lib_compat_mode = strict <http://docs.platformio.org/en/page/librarymanager/ldf.html#compatibility-mode>`__
|
||||||
|
* Added workaround for Python SemVer package's `issue #61 <https://github.com/rbarrois/python-semanticversion/issues/61>`_ with caret range and pre-releases
|
||||||
* Replaced conflicted "env" pattern by "sysenv" for `"platformio.ini" Dynamic Variables" <http://docs.platformio.org/page/projectconf/dynamic_variables.html>`__
|
* Replaced conflicted "env" pattern by "sysenv" for `"platformio.ini" Dynamic Variables" <http://docs.platformio.org/page/projectconf/dynamic_variables.html>`__
|
||||||
(`issue #1705 <https://github.com/platformio/platformio-core/issues/1705>`_)
|
(`issue #1705 <https://github.com/platformio/platformio-core/issues/1705>`_)
|
||||||
* Removed "date&time" when processing project with `platformio run <http://docs.platformio.org/page/userguide/cmd_run.html>`__ command
|
* Removed "date&time" when processing project with `platformio run <http://docs.platformio.org/page/userguide/cmd_run.html>`__ command
|
||||||
|
2
docs
2
docs
Submodule docs updated: ae2968e52a...0b8ac5fbf7
@ -90,7 +90,8 @@ class PkgRepoMixin(object):
|
|||||||
reqspec = None
|
reqspec = None
|
||||||
if requirements:
|
if requirements:
|
||||||
try:
|
try:
|
||||||
reqspec = semantic_version.Spec(requirements)
|
reqspec = self.parse_semver_spec(
|
||||||
|
requirements, raise_exception=True)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -98,8 +99,8 @@ class PkgRepoMixin(object):
|
|||||||
if not self.is_system_compatible(v.get("system")):
|
if not self.is_system_compatible(v.get("system")):
|
||||||
continue
|
continue
|
||||||
if "platformio" in v.get("engines", {}):
|
if "platformio" in v.get("engines", {}):
|
||||||
if PkgRepoMixin.PIO_VERSION not in semantic_version.Spec(
|
if PkgRepoMixin.PIO_VERSION not in self.parse_semver_spec(
|
||||||
v['engines']['platformio']):
|
v['engines']['platformio'], raise_exception=True):
|
||||||
continue
|
continue
|
||||||
specver = semantic_version.Version(v['version'])
|
specver = semantic_version.Version(v['version'])
|
||||||
if reqspec and specver not in reqspec:
|
if reqspec and specver not in reqspec:
|
||||||
@ -224,7 +225,20 @@ class PkgInstallerMixin(object):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def parse_semver_spec(value, raise_exception=False):
|
def parse_semver_spec(value, raise_exception=False):
|
||||||
try:
|
try:
|
||||||
return semantic_version.Spec(value)
|
# Workaround for ^ issue and pre-releases
|
||||||
|
# https://github.com/rbarrois/python-semanticversion/issues/61
|
||||||
|
requirements = []
|
||||||
|
for item in str(value).split(","):
|
||||||
|
item = item.strip()
|
||||||
|
if not item:
|
||||||
|
continue
|
||||||
|
if item.startswith("^"):
|
||||||
|
major = semantic_version.Version.coerce(item[1:]).major
|
||||||
|
requirements.append(">=%s" % major)
|
||||||
|
requirements.append("<%s" % (int(major) + 1))
|
||||||
|
else:
|
||||||
|
requirements.append(item)
|
||||||
|
return semantic_version.Spec(*requirements)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
if raise_exception:
|
if raise_exception:
|
||||||
raise e
|
raise e
|
||||||
@ -480,8 +494,8 @@ class PkgInstallerMixin(object):
|
|||||||
"Package version %s doesn't satisfy requirements %s" %
|
"Package version %s doesn't satisfy requirements %s" %
|
||||||
(tmp_manifest['version'], requirements))
|
(tmp_manifest['version'], requirements))
|
||||||
try:
|
try:
|
||||||
assert tmp_semver and tmp_semver in semantic_version.Spec(
|
assert tmp_semver and tmp_semver in self.parse_semver_spec(
|
||||||
requirements), mismatch_error
|
requirements, raise_exception=True), mismatch_error
|
||||||
except (AssertionError, ValueError):
|
except (AssertionError, ValueError):
|
||||||
assert tmp_manifest['version'] == requirements, mismatch_error
|
assert tmp_manifest['version'] == requirements, mismatch_error
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user