|
|
@ -1,16 +1,13 @@
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from datetime import datetime
|
|
|
|
from datetime import datetime
|
|
|
|
# import urllib.request
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
# response = urllib.request.urlopen('https://blackjack4494.github.io/youtube-dlc/update/LATEST_VERSION')
|
|
|
|
|
|
|
|
# old_version = response.read().decode('utf-8')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exec(compile(open('yt_dlp/version.py').read(), 'yt_dlp/version.py', 'exec'))
|
|
|
|
with open('yt_dlp/version.py', 'rt') as f:
|
|
|
|
|
|
|
|
exec(compile(f.read(), 'yt_dlp/version.py', 'exec'))
|
|
|
|
old_version = locals()['__version__']
|
|
|
|
old_version = locals()['__version__']
|
|
|
|
|
|
|
|
|
|
|
|
old_version_list = old_version.split(".", 4)
|
|
|
|
old_version_list = old_version.split('.')
|
|
|
|
|
|
|
|
|
|
|
|
old_ver = '.'.join(old_version_list[:3])
|
|
|
|
old_ver = '.'.join(old_version_list[:3])
|
|
|
|
old_rev = old_version_list[3] if len(old_version_list) > 3 else ''
|
|
|
|
old_rev = old_version_list[3] if len(old_version_list) > 3 else ''
|
|
|
@ -19,15 +16,23 @@ ver = datetime.utcnow().strftime("%Y.%m.%d")
|
|
|
|
rev = str(int(old_rev or 0) + 1) if old_ver == ver else ''
|
|
|
|
rev = str(int(old_rev or 0) + 1) if old_ver == ver else ''
|
|
|
|
|
|
|
|
|
|
|
|
VERSION = '.'.join((ver, rev)) if rev else ver
|
|
|
|
VERSION = '.'.join((ver, rev)) if rev else ver
|
|
|
|
# VERSION_LIST = [(int(v) for v in ver.split(".") + [rev or 0])]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print('::set-output name=ytdlp_version::' + VERSION)
|
|
|
|
try:
|
|
|
|
|
|
|
|
sp = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'], stdout=subprocess.PIPE)
|
|
|
|
|
|
|
|
GIT_HEAD = sp.communicate()[0].decode().strip() or None
|
|
|
|
|
|
|
|
except Exception:
|
|
|
|
|
|
|
|
GIT_HEAD = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VERSION_FILE = f'''
|
|
|
|
|
|
|
|
# Autogenerated by devscripts/update-version.py
|
|
|
|
|
|
|
|
|
|
|
|
file_version_py = open('yt_dlp/version.py', 'rt')
|
|
|
|
__version__ = {VERSION!r}
|
|
|
|
data = file_version_py.read()
|
|
|
|
|
|
|
|
data = data.replace(old_version, VERSION)
|
|
|
|
|
|
|
|
file_version_py.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file_version_py = open('yt_dlp/version.py', 'wt')
|
|
|
|
RELEASE_GIT_HEAD = {GIT_HEAD!r}
|
|
|
|
file_version_py.write(data)
|
|
|
|
'''.lstrip()
|
|
|
|
file_version_py.close()
|
|
|
|
|
|
|
|
|
|
|
|
with open('yt_dlp/version.py', 'wt') as f:
|
|
|
|
|
|
|
|
f.write(VERSION_FILE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print('::set-output name=ytdlp_version::' + VERSION)
|
|
|
|
|
|
|
|
print(f'\nVersion = {VERSION}, Git HEAD = {GIT_HEAD}')
|
|
|
|