Example #1
0
def test_versioninfo(tmp_path):
    from PyInstaller.utils.win32.versioninfo import VSVersionInfo, \
        FixedFileInfo, StringFileInfo, StringTable, StringStruct, \
        VarFileInfo, VarStruct

    vsinfo = VSVersionInfo(
        ffi=FixedFileInfo(filevers=(1, 2, 3, 4),
                          prodvers=(5, 6, 7, 8),
                          mask=0x3f,
                          flags=0x1,
                          OS=0x40004,
                          fileType=0x42,
                          subtype=0x42,
                          date=(0, 0)),
        kids=[
            StringFileInfo([
                StringTable(
                    '040904b0',
                    [StringStruct('FileDescription', 'versioninfo test')])
            ]),
            VarFileInfo([VarStruct('Translation', [1033, 1200])])
        ])

    file = str(tmp_path / 'versioninfo')
    save_py_data_struct(file, vsinfo)

    assert vsinfo == load_py_data_struct(file)
Example #2
0
def windows_set_version(exe, version):
    version_list = version_to_list(version)
    suffix = '_x86' if ARCH == '32' else ''
    SetVersion(exe, 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', 'yt-dlp%s Command Line Interface.' % suffix),
                StringStruct('CompanyName', 'https://github.com/yt-dlp'),
                StringStruct('FileDescription', 'yt-dlp%s' % (' (32 Bit)' if ARCH == '32' else '')),
                StringStruct('FileVersion', version),
                StringStruct('InternalName', f'yt-dlp{suffix}'),
                StringStruct('LegalCopyright', '[email protected] | UNLICENSE'),
                StringStruct('OriginalFilename', f'yt-dlp{suffix}.exe'),
                StringStruct('ProductName', f'yt-dlp{suffix}'),
                StringStruct(
                    'ProductVersion', f'{version}{suffix} on Python {platform.python_version()}'),
            ])]), VarFileInfo([VarStruct('Translation', [0, 1200])])
        ]
    ))
Example #3
0
exec(compile(open('yt_dlp/version.py').read(), 'yt_dlp/version.py', 'exec'))
VERSION = locals()['__version__']

VERSION_LIST = VERSION.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',
                             'yt-dlp%s Command Line Interface.' % _x86),
                StringStruct('CompanyName', 'https://github.com/yt-dlp'),
                StringStruct('FileDescription', FILE_DESCRIPTION),
                StringStruct('FileVersion', VERSION),
                StringStruct('InternalName', 'yt-dlp%s' % _x86),
                StringStruct(
                    'LegalCopyright',
Example #4
0
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", "*****@*****.**"),
                    StringStruct("FileDescription", FILE_DESCRIPTION),
                    StringStruct("FileVersion", version),
                    StringStruct("InternalName", "youtube-dlc_x86"),
Example #5
0
class BuildPyinstallerBin(Command):
    description = "Build the executable"
    user_options = []
    version_file = None
    if pyi_compat and pyi_compat.is_win:
        version_file = VSVersionInfo(
            ffi=FixedFileInfo(
                filevers=version2tuple(),
                prodvers=version2tuple(),
                mask=0x3F,
                flags=0x0,
                OS=0x4,
                fileType=0x1,
                subtype=0x0,
                date=(0, 0),
            ),
            kids=[
                VarFileInfo([VarStruct("Translation", [0, 1200])]),
                StringFileInfo(
                    [
                        StringTable(
                            "000004b0",
                            [
                                StringStruct("CompanyName", __maintainer_contact__),
                                StringStruct("FileDescription", DESCRIPTION),
                                StringStruct("FileVersion", version2str()),
                                StringStruct("InternalName", "youtube-dl-gui.exe"),
                                StringStruct(
                                    "LegalCopyright",
                                    __projecturl__ + "LICENSE",
                                ),
                                StringStruct("OriginalFilename", "youtube-dl-gui.exe"),
                                StringStruct("ProductName", __appname__),
                                StringStruct("ProductVersion", version2str()),
                            ],
                        )
                    ]
                ),
            ],
        )

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self, version=version_file):
        """Run pyinstaller"""
        if on_windows():
            path_sep = ";"
        else:
            path_sep = ":"
        
        spawn(
            [
                "pyinstaller",
                "-w",
                "-F",
                "--icon=UI/images/icon.ico",
                "--add-data=UI/images"+path_sep+"UI/images",
                "--name=youtube-dl-gui",
                "main.py",
            ],
            dry_run=self.dry_run)

        if version:
            time.sleep(3)
            SetVersion("./dist/youtube-dl-gui.exe", version)
Example #6
0
class BuildPyinstallerBin(Command):

    description = "Build the executable"
    user_options = []
    version_file = None
    if pyi_compat and pyi_compat.is_win:
        version_file = VSVersionInfo(
            ffi=FixedFileInfo(
                filevers=version2tuple(),
                prodvers=version2tuple(),
                mask=0x3F,
                flags=0x0,
                OS=0x4,
                fileType=0x1,
                subtype=0x0,
                date=(0, 0),
            ),
            kids=[
                VarFileInfo([VarStruct("Translation", [0, 1200])]),
                StringFileInfo([
                    StringTable(
                        "000004b0",
                        [
                            StringStruct("CompanyName",
                                         "*****@*****.**"),
                            StringStruct("FileDescription", DESCRIPTION),
                            StringStruct("FileVersion", version2str()),
                            StringStruct("InternalName", "picta-dl.exe"),
                            StringStruct(
                                "LegalCopyright",
                                "https://github.com/oleksis/picta-dl/LICENSE",
                            ),
                            StringStruct("OriginalFilename", "picta-dl.exe"),
                            StringStruct("ProductName", "Picta-DL"),
                            StringStruct("ProductVersion", version2str()),
                        ],
                    )
                ]),
            ],
        )

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self, version=version_file):
        spawn(
            [
                "pyinstaller",
                "-c",
                "-F",
                "--icon=assets/picta-dl.ico",
                "--exclude-module=test",
                "--name=picta-dl",
                "picta_dl/__main__.py",
            ],
            dry_run=self.dry_run,
        )
        if version:
            time.sleep(3)
            SetVersion("./dist/picta-dl.exe", version)
Example #7
0
run([
    "pslipstream/__main__.py", "-n", NAME, "-i", ["NONE",
                                                  ICON_FILE][bool(ICON_FILE)],
    ["-D", "-F"][ONE_FILE], ["-w", "-c"][CONSOLE],
    *itertools.chain(*[["--add-data", os.pathsep.join(x)]
                       for x in ADDITIONAL_DATA]),
    *itertools.chain(*[["--hidden-import", x]
                       for x in HIDDEN_IMPORTS]), *EXTRA_ARGS
])
"""Set Version Info Structure."""
VERSION_4_TUP = tuple(map(int, ("%s.0" % VERSION).split(".")))
VERSION_4_STR = ".".join(map(str, VERSION_4_TUP))
SetVersion(
    "dist/{0}/{0}.exe".format(NAME),
    VSVersionInfo(
        ffi=FixedFileInfo(filevers=VERSION_4_TUP, prodvers=VERSION_4_TUP),
        kids=[
            StringFileInfo([
                StringTable(
                    "040904B0",  # ?
                    [
                        StringStruct("Comments", NAME),
                        StringStruct("CompanyName", AUTHOR),
                        StringStruct(
                            "FileDescription",
                            "The most informative Home-media backup solution"),
                        StringStruct("FileVersion", VERSION_4_STR),
                        StringStruct("InternalName", NAME),
                        StringStruct("LegalCopyright",
                                     "Copyright (C) 2021 %s" % AUTHOR),
                        StringStruct("OriginalFilename", ""),