mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Backport msi-conformant-version function
This commit is contained in:
parent
0638418d22
commit
825832812b
@ -712,5 +712,27 @@ def versions_report(include_salt_cloud=False):
|
||||
yield line
|
||||
|
||||
|
||||
def msi_conformant_version():
|
||||
'''
|
||||
A msi conformant version consists of up to 4 numbers, each smaller than 256,
|
||||
except the 4th. Therefore, the year must be represented as 'short year'.
|
||||
|
||||
Examples (depend on git checkout):
|
||||
develop 2016.11.0-742-g5ca4d20 16.11.0.742
|
||||
2016.11 (branch) 2016.11.2-78-gce1f01f 16.11.2.78
|
||||
v2016.11.2 (tag) 2016.11.2 16.11.2.0
|
||||
|
||||
Note that the commit count for tags is 0(zero)
|
||||
'''
|
||||
year2 = int(str(__saltstack_version__.major)[2:])
|
||||
month = __saltstack_version__.minor
|
||||
minor = __saltstack_version__.bugfix
|
||||
commi = __saltstack_version__.noc
|
||||
return '{0}.{1}.{2}.{3}'.format(year2, month, minor, commi)
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(__version__)
|
||||
if len(sys.argv) == 2 and sys.argv[1] == 'msi':
|
||||
# Building the msi requires an msi-conformant version
|
||||
print(msi_conformant_version())
|
||||
else:
|
||||
print(__version__)
|
||||
|
Loading…
Reference in New Issue
Block a user