From 6bb6702fe613bbfaf21497323cbe09aa08c900a8 Mon Sep 17 00:00:00 2001 From: Kirill Zaitsev Date: Wed, 21 Sep 2016 23:19:30 +0300 Subject: [PATCH] Convert =0 version specs to ==0 specs Murano is using semantic_version library for version specs. 2.3.1 version of the library, which is the minimum allowed for newton does not treat '=0' as a valid spec, and requires '==0' (double equal signs). This issue went unnoticed, since there 2.5.0 version of the library allow both version spec, and it has been only discovered when, when tested against packaged version of the library. This commit converts any specs in format =\d.* into ==.d.* format, thus adding compatibility to 2.3.1 library. Closes-Bug: #1626238 Change-Id: I68b50726a8b6547cc768452dcfc197e072a8e104 --- murano/dsl/helpers.py | 6 ++++++ .../notes/spec-semver-library-436b0db35fbd4c37.yaml | 5 +++++ 2 files changed, 11 insertions(+) create mode 100644 releasenotes/notes/spec-semver-library-436b0db35fbd4c37.yaml diff --git a/murano/dsl/helpers.py b/murano/dsl/helpers.py index 57757a8a8..fd0479eb6 100644 --- a/murano/dsl/helpers.py +++ b/murano/dsl/helpers.py @@ -275,6 +275,12 @@ def parse_version_spec(version_spec): if not version_spec: version_spec = '0' version_spec = re.sub('\s+', '', str(version_spec)) + + # NOTE(kzaitsev): semantic_version 2.3.X thinks that '=0' is not + # a valid version spec and only accepts '==0', this regexp adds + # an extra '=' before such specs + version_spec = re.sub(r'^=(\d)', r'==\1', version_spec) + if version_spec[0].isdigit(): version_spec = '==' + str(version_spec) version_spec = semantic_version.Spec(version_spec) diff --git a/releasenotes/notes/spec-semver-library-436b0db35fbd4c37.yaml b/releasenotes/notes/spec-semver-library-436b0db35fbd4c37.yaml new file mode 100644 index 000000000..fd823ae6d --- /dev/null +++ b/releasenotes/notes/spec-semver-library-436b0db35fbd4c37.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - It is now possible to use version specifications like '=0.0.0' when + ``semantic_version`` library version '2.3.1' is installed. Previously + such specifications caused an error and '==0.0.0' had to be used.