mirror of
https://github.com/ytdl-org/ytdl-nightly.git
synced 2025-01-05 11:27:21 +01:00
9235c3f7e8
* make Build callable but not scheduled * make Build receive commit SHA from caller * make Rebase pass commit SHA to Build * Don't set GH output from update-version.py * No rebase is still success * Allow scheduled Rebase to invoke Build
34 lines
896 B
Python
34 lines
896 B
Python
#!/usr/bin/env python3
|
|
from __future__ import unicode_literals
|
|
from datetime import datetime
|
|
import sys
|
|
|
|
|
|
with open('youtube_dl/version.py', 'rt') as f:
|
|
exec(compile(f.read(), 'youtube_dl/version.py', 'exec'))
|
|
old_version = locals()['__version__']
|
|
|
|
old_version_list = old_version.split('.')
|
|
|
|
old_ver = '.'.join(old_version_list[:3])
|
|
old_rev = old_version_list[3] if len(old_version_list) > 3 else ''
|
|
|
|
ver = datetime.utcnow().strftime("%Y.%m.%d")
|
|
|
|
rev = (sys.argv[1:] or [''])[0] # Use first argument, if present as revision number
|
|
if not rev:
|
|
rev = str(int(old_rev or 0) + 1) if old_ver == ver else ''
|
|
|
|
VERSION = '.'.join((ver, rev)) if rev else ver
|
|
|
|
VERSION_FILE = '''# Autogenerated by devscripts/update-version.py
|
|
from __future__ import unicode_literals
|
|
|
|
__version__ = {!r}
|
|
'''.format(VERSION)
|
|
|
|
with open('youtube_dl/version.py', 'wt') as f:
|
|
f.write(VERSION_FILE)
|
|
|
|
print(VERSION)
|