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
This commit is contained in:
Kirill Zaitsev 2016-09-21 23:19:30 +03:00
parent 16c3d43065
commit f691f3067e
2 changed files with 11 additions and 0 deletions

View File

@ -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)

View File

@ -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.