Merge pull request #171 from yvanzo/fix-update-version

Fix update version to make sub-version numbers without leading 0
This commit is contained in:
Aurélien Mino 2018-02-18 00:37:54 +01:00 committed by GitHub
commit 5fd620a5fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Display shortcut for relationships on MusicBrainz // @name Display shortcut for relationships on MusicBrainz
// @description Display icon shortcut for relationships of release-group, release, recording and work: e.g. Amazon, Discogs, Wikipedia, ... links. This allows to access some relationships without opening the entity page. // @description Display icon shortcut for relationships of release-group, release, recording and work: e.g. Amazon, Discogs, Wikipedia, ... links. This allows to access some relationships without opening the entity page.
// @version 2018.02.11.0 // @version 2018.2.17.1
// @author Aurelien Mino <aurelien.mino@gmail.com> // @author Aurelien Mino <aurelien.mino@gmail.com>
// @licence GPL (http://www.gnu.org/copyleft/gpl.html) // @licence GPL (http://www.gnu.org/copyleft/gpl.html)
// @downloadURL https://raw.github.com/murdos/musicbrainz-userscripts/master/mb_relationship_shortcuts.user.js // @downloadURL https://raw.github.com/murdos/musicbrainz-userscripts/master/mb_relationship_shortcuts.user.js

View file

@ -26,10 +26,10 @@ To test without modifying file, use stdin:
def make_version_line(old_value='0.0.0.0', spacing=' '*8, eol="\n"): def make_version_line(old_value='0.0.0.0', spacing=' '*8, eol="\n"):
prev_version = [int(x) for x in old_value.split('.')] prev_version = [int(x) for x in old_value.split('.')]
now = datetime.datetime.utcnow() now = datetime.datetime.utcnow()
version = [now.year, now.month, now.day, 0] version = [now.year, now.month, now.day, 1]
if prev_version[:3] == version[:3]: if prev_version[:3] == version[:3]:
version[3] = prev_version[3] + 1 version[3] = prev_version[3] + 1
version_str = '%04d.%02d.%02d.%d' % tuple(version) version_str = '%04d.%d.%d.%d' % tuple(version)
return ('// @version' + spacing + version_str + eol, version_str) return ('// @version' + spacing + version_str + eol, version_str)