mirror of https://github.com/yt-dlp/yt-dlp
Refactor `update-version`, `pyinst.py` and related files
* Refactor update-version * Moved pyinst, update-version and icon into devscripts * pyinst doesn't bump version anymore * Merge pyinst and pyinst32. Usage: `pyinst.py [32|64]` * Add mutagen as requirement * Remove make_win and related filespull/45/head
parent
caa15a7b57
commit
e38df8f9fa
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,69 @@
|
||||
from __future__ import unicode_literals
|
||||
import sys
|
||||
|
||||
from PyInstaller.utils.win32.versioninfo import (
|
||||
VarStruct, VarFileInfo, StringStruct, StringTable,
|
||||
StringFileInfo, FixedFileInfo, VSVersionInfo, SetVersion,
|
||||
)
|
||||
import PyInstaller.__main__
|
||||
|
||||
|
||||
assert len(sys.argv) > 1 and sys.argv[1] in ("32", "64")
|
||||
_x86 = "_x86" if sys.argv[1] == "32" else ""
|
||||
|
||||
FILE_DESCRIPTION = 'Media Downloader%s' % (" (32 Bit)" if _x86 else '')
|
||||
SHORT_URLS = {"32": "git.io/JUGsM", "64": "git.io/JLh7K"}
|
||||
|
||||
|
||||
exec(compile(open('youtube_dlc/version.py').read(), 'youtube_dlc/version.py', 'exec'))
|
||||
VERSION = locals()['__version__']
|
||||
|
||||
VERSION_LIST = VERSION.replace('-', '.').split('.')
|
||||
VERSION_LIST = list(map(int, VERSION_LIST)) + [0] * (4 - len(VERSION_LIST))
|
||||
|
||||
print('Version: %s%s' % (VERSION, _x86))
|
||||
print('Remember to update the version using devscipts\\update-version.py')
|
||||
|
||||
VERSION_FILE = VSVersionInfo(
|
||||
ffi=FixedFileInfo(
|
||||
filevers=VERSION_LIST,
|
||||
prodvers=VERSION_LIST,
|
||||
mask=0x3F,
|
||||
flags=0x0,
|
||||
OS=0x4,
|
||||
fileType=0x1,
|
||||
subtype=0x0,
|
||||
date=(0, 0),
|
||||
),
|
||||
kids=[
|
||||
StringFileInfo([
|
||||
StringTable(
|
||||
"040904B0", [
|
||||
StringStruct("Comments", "Youtube-dlc%s Command Line Interface." % _x86),
|
||||
StringStruct("CompanyName", "pukkandan@gmail.com"),
|
||||
StringStruct("FileDescription", FILE_DESCRIPTION),
|
||||
StringStruct("FileVersion", VERSION),
|
||||
StringStruct("InternalName", "youtube-dlc%s" % _x86),
|
||||
StringStruct(
|
||||
"LegalCopyright",
|
||||
"pukkandan@gmail.com | UNLICENSE",
|
||||
),
|
||||
StringStruct("OriginalFilename", "youtube-dlc%s.exe" % _x86),
|
||||
StringStruct("ProductName", "Youtube-dlc%s" % _x86),
|
||||
StringStruct("ProductVersion", "%s%s | %s" % (VERSION, _x86, SHORT_URLS[sys.argv[1]])),
|
||||
])]),
|
||||
VarFileInfo([VarStruct("Translation", [0, 1200])])
|
||||
]
|
||||
)
|
||||
|
||||
PyInstaller.__main__.run([
|
||||
'--name=youtube-dlc%s' % _x86,
|
||||
'--onefile',
|
||||
'--icon=devscripts/cloud.ico',
|
||||
'--exclude-module=youtube_dl',
|
||||
'--exclude-module=test',
|
||||
'--exclude-module=ytdlp_plugins',
|
||||
'--hidden-import=mutagen',
|
||||
'youtube_dlc/__main__.py',
|
||||
])
|
||||
SetVersion('dist/youtube-dlc%s.exe' % _x86, VERSION_FILE)
|
@ -1 +0,0 @@
|
||||
py -m PyInstaller youtube_dlc\__main__.py --onefile --name youtube-dlc --version-file win\ver.txt --icon win\icon\cloud.ico --upx-exclude=vcruntime140.dll --exclude-module ytdlp_plugins
|
@ -1,92 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
from PyInstaller.utils.win32.versioninfo import (
|
||||
VarStruct, VarFileInfo, StringStruct, StringTable,
|
||||
StringFileInfo, FixedFileInfo, VSVersionInfo, SetVersion,
|
||||
)
|
||||
import PyInstaller.__main__
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
FILE_DESCRIPTION = 'Media Downloader'
|
||||
|
||||
exec(compile(open('youtube_dlc/version.py').read(), 'youtube_dlc/version.py', 'exec'))
|
||||
|
||||
_LATEST_VERSION = locals()['__version__']
|
||||
|
||||
_OLD_VERSION = _LATEST_VERSION.rsplit("-", 1)
|
||||
|
||||
if len(_OLD_VERSION) > 0:
|
||||
old_ver = _OLD_VERSION[0]
|
||||
|
||||
old_rev = ''
|
||||
if len(_OLD_VERSION) > 1:
|
||||
old_rev = _OLD_VERSION[1]
|
||||
|
||||
now = datetime.now()
|
||||
# ver = f'{datetime.today():%Y.%m.%d}'
|
||||
ver = now.strftime("%Y.%m.%d")
|
||||
rev = ''
|
||||
|
||||
if old_ver == ver:
|
||||
if old_rev:
|
||||
rev = int(old_rev) + 1
|
||||
else:
|
||||
rev = 1
|
||||
|
||||
_SEPARATOR = '-'
|
||||
|
||||
version = _SEPARATOR.join(filter(None, [ver, str(rev)]))
|
||||
|
||||
print(version)
|
||||
|
||||
version_list = ver.split(".")
|
||||
_year, _month, _day = [int(value) for value in version_list]
|
||||
_rev = 0
|
||||
if rev:
|
||||
_rev = rev
|
||||
_ver_tuple = _year, _month, _day, _rev
|
||||
|
||||
version_file = VSVersionInfo(
|
||||
ffi=FixedFileInfo(
|
||||
filevers=_ver_tuple,
|
||||
prodvers=_ver_tuple,
|
||||
mask=0x3F,
|
||||
flags=0x0,
|
||||
OS=0x4,
|
||||
fileType=0x1,
|
||||
subtype=0x0,
|
||||
date=(0, 0),
|
||||
),
|
||||
kids=[
|
||||
StringFileInfo(
|
||||
[
|
||||
StringTable(
|
||||
"040904B0",
|
||||
[
|
||||
StringStruct("Comments", "Youtube-dlc Command Line Interface."),
|
||||
StringStruct("CompanyName", "theidel@uni-bremen.de"),
|
||||
StringStruct("FileDescription", FILE_DESCRIPTION),
|
||||
StringStruct("FileVersion", version),
|
||||
StringStruct("InternalName", "youtube-dlc"),
|
||||
StringStruct(
|
||||
"LegalCopyright",
|
||||
"theidel@uni-bremen.de | UNLICENSE",
|
||||
),
|
||||
StringStruct("OriginalFilename", "youtube-dlc.exe"),
|
||||
StringStruct("ProductName", "Youtube-dlc"),
|
||||
StringStruct("ProductVersion", version + " | git.io/JLh7K"),
|
||||
],
|
||||
)
|
||||
]
|
||||
),
|
||||
VarFileInfo([VarStruct("Translation", [0, 1200])])
|
||||
]
|
||||
)
|
||||
|
||||
PyInstaller.__main__.run([
|
||||
'--name=youtube-dlc',
|
||||
'--onefile',
|
||||
'--icon=win/icon/cloud.ico',
|
||||
'youtube_dlc/__main__.py',
|
||||
])
|
||||
SetVersion('dist/youtube-dlc.exe', version_file)
|
@ -1,92 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
from PyInstaller.utils.win32.versioninfo import (
|
||||
VarStruct, VarFileInfo, StringStruct, StringTable,
|
||||
StringFileInfo, FixedFileInfo, VSVersionInfo, SetVersion,
|
||||
)
|
||||
import PyInstaller.__main__
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
FILE_DESCRIPTION = 'Media Downloader 32 Bit Version'
|
||||
|
||||
exec(compile(open('youtube_dlc/version.py').read(), 'youtube_dlc/version.py', 'exec'))
|
||||
|
||||
_LATEST_VERSION = locals()['__version__']
|
||||
|
||||
_OLD_VERSION = _LATEST_VERSION.rsplit("-", 1)
|
||||
|
||||
if len(_OLD_VERSION) > 0:
|
||||
old_ver = _OLD_VERSION[0]
|
||||
|
||||
old_rev = ''
|
||||
if len(_OLD_VERSION) > 1:
|
||||
old_rev = _OLD_VERSION[1]
|
||||
|
||||
now = datetime.now()
|
||||
# ver = f'{datetime.today():%Y.%m.%d}'
|
||||
ver = now.strftime("%Y.%m.%d")
|
||||
rev = ''
|
||||
|
||||
if old_ver == ver:
|
||||
if old_rev:
|
||||
rev = int(old_rev) + 1
|
||||
else:
|
||||
rev = 1
|
||||
|
||||
_SEPARATOR = '-'
|
||||
|
||||
version = _SEPARATOR.join(filter(None, [ver, str(rev)]))
|
||||
|
||||
print(version)
|
||||
|
||||
version_list = ver.split(".")
|
||||
_year, _month, _day = [int(value) for value in version_list]
|
||||
_rev = 0
|
||||
if rev:
|
||||
_rev = rev
|
||||
_ver_tuple = _year, _month, _day, _rev
|
||||
|
||||
version_file = VSVersionInfo(
|
||||
ffi=FixedFileInfo(
|
||||
filevers=_ver_tuple,
|
||||
prodvers=_ver_tuple,
|
||||
mask=0x3F,
|
||||
flags=0x0,
|
||||
OS=0x4,
|
||||
fileType=0x1,
|
||||
subtype=0x0,
|
||||
date=(0, 0),
|
||||
),
|
||||
kids=[
|
||||
StringFileInfo(
|
||||
[
|
||||
StringTable(
|
||||
"040904B0",
|
||||
[
|
||||
StringStruct("Comments", "Youtube-dlc_x86 Command Line Interface."),
|
||||
StringStruct("CompanyName", "theidel@uni-bremen.de"),
|
||||
StringStruct("FileDescription", FILE_DESCRIPTION),
|
||||
StringStruct("FileVersion", version),
|
||||
StringStruct("InternalName", "youtube-dlc_x86"),
|
||||
StringStruct(
|
||||
"LegalCopyright",
|
||||
"theidel@uni-bremen.de | UNLICENSE",
|
||||
),
|
||||
StringStruct("OriginalFilename", "youtube-dlc_x86.exe"),
|
||||
StringStruct("ProductName", "Youtube-dlc_x86"),
|
||||
StringStruct("ProductVersion", version + "_x86 | git.io/JUGsM"),
|
||||
],
|
||||
)
|
||||
]
|
||||
),
|
||||
VarFileInfo([VarStruct("Translation", [0, 1200])])
|
||||
]
|
||||
)
|
||||
|
||||
PyInstaller.__main__.run([
|
||||
'--name=youtube-dlc_x86',
|
||||
'--onefile',
|
||||
'--icon=win/icon/cloud.ico',
|
||||
'youtube_dlc/__main__.py',
|
||||
])
|
||||
SetVersion('dist/youtube-dlc_x86.exe', version_file)
|
@ -1,45 +0,0 @@
|
||||
# UTF-8
|
||||
#
|
||||
# For more details about fixed file info 'ffi' see:
|
||||
# http://msdn.microsoft.com/en-us/library/ms646997.aspx
|
||||
VSVersionInfo(
|
||||
ffi=FixedFileInfo(
|
||||
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
|
||||
# Set not needed items to zero 0.
|
||||
filevers=(16, 9, 2020, 0),
|
||||
prodvers=(16, 9, 2020, 0),
|
||||
# Contains a bitmask that specifies the valid bits 'flags'r
|
||||
mask=0x3f,
|
||||
# Contains a bitmask that specifies the Boolean attributes of the file.
|
||||
flags=0x0,
|
||||
# The operating system for which this file was designed.
|
||||
# 0x4 - NT and there is no need to change it.
|
||||
# OS=0x40004,
|
||||
OS=0x4,
|
||||
# The general type of file.
|
||||
# 0x1 - the file is an application.
|
||||
fileType=0x1,
|
||||
# The function of the file.
|
||||
# 0x0 - the function is not defined for this fileType
|
||||
subtype=0x0,
|
||||
# Creation date and time stamp.
|
||||
date=(0, 0)
|
||||
),
|
||||
kids=[
|
||||
StringFileInfo(
|
||||
[
|
||||
StringTable(
|
||||
u'040904B0',
|
||||
[StringStruct(u'Comments', u'Youtube-dlc Command Line Interface.'),
|
||||
StringStruct(u'CompanyName', u'theidel@uni-bremen.de'),
|
||||
StringStruct(u'FileDescription', u'Media Downloader'),
|
||||
StringStruct(u'FileVersion', u'16.9.2020.0'),
|
||||
StringStruct(u'InternalName', u'youtube-dlc'),
|
||||
StringStruct(u'LegalCopyright', u'theidel@uni-bremen.de | UNLICENSE'),
|
||||
StringStruct(u'OriginalFilename', u'youtube-dlc.exe'),
|
||||
StringStruct(u'ProductName', u'Youtube-dlc'),
|
||||
StringStruct(u'ProductVersion', u'16.9.2020.0 | git.io/JUGsM')])
|
||||
]),
|
||||
VarFileInfo([VarStruct(u'Translation', [0, 1200])])
|
||||
]
|
||||
)
|
Loading…
Reference in New Issue