family-regsiter/build.spec

97 lines
3.2 KiB
RPMSpec
Raw Permalink Normal View History

2021-11-28 11:58:25 +01:00
# -*- mode: python ; coding: utf-8 -*-
from packaging.version import parse
from PyInstaller.building.api import EXE, PYZ
from PyInstaller.building.build_main import Analysis
from PyInstaller.utils.win32.versioninfo import (FixedFileInfo, StringFileInfo,
StringStruct, StringTable,
VarFileInfo, VarStruct,
VSVersionInfo)
import versioneer
# Update Version Hook
# exec(open('updateVersion.py').read())
block_cipher = None
added_files = [
('src/family_register/locale', 'locale'),
]
print(versioneer.get_versions()['dirty'])
release = parse(versioneer.get_version())
release_tuple = (release.major, release.minor, release.micro, 0)
version = 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=release_tuple,
prodvers=release_tuple,
# 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=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('040904B0', [
StringStruct('CompanyName', ''),
StringStruct('FileDescription', 'Family Register'),
StringStruct('FileVersion', f'{release}'),
StringStruct('InternalName', 'family_register'),
StringStruct('LegalCopyright', 'Copyright (c) Philipp Rauch'),
StringStruct('OriginalFilename', 'Family-Register.exe'),
StringStruct('ProductName', 'Family Register'),
StringStruct('ProductVersion', f'{release}')
])
]),
VarFileInfo([
VarStruct('Translation', [1031, 1252]),
VarStruct('Translation', [1033, 1252])
])
])
a = Analysis(['pyinstaller\\run_family_register.py'],
pathex=['build\\lib'],
binaries=[],
datas=added_files,
hiddenimports=["pkg_resources.py2_warn"],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name=f'Family-Register {release}',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
# icon='[logo].ico',
version=version,
)