change version
This commit is contained in:
parent
42aa62a1b2
commit
271a352540
@ -1,46 +1,6 @@
|
|||||||
# -*- mode: python ; coding: utf-8 -*-
|
|
||||||
|
|
||||||
block_cipher = None
|
block_cipher = None
|
||||||
|
|
||||||
import os
|
import os
|
||||||
a = Analysis(scripts=['pyinstallerguiwrapper\\__main__.py'],
|
a = Analysis(scripts=['pyinstallerguiwrapper\\__main__.py'], pathex=['pyinstallerguiwrapper', '.'], binaries=[], datas=[], hiddenimports=[], hookspath=[], hooksconfig={}, runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=None, noarchive=False)
|
||||||
pathex=['pyinstallerguiwrapper'],
|
|
||||||
binaries=[],
|
|
||||||
datas=[],
|
|
||||||
hiddenimports=[],
|
|
||||||
hookspath=[],
|
|
||||||
hooksconfig={},
|
|
||||||
runtime_hooks=[],
|
|
||||||
excludes=[],
|
|
||||||
win_no_prefer_redirects=False,
|
|
||||||
win_private_assemblies=False,
|
|
||||||
cipher=None,
|
|
||||||
noarchive=False)
|
|
||||||
|
|
||||||
pyz = PYZ(a.pure, a.zipped_data, cipher=None)
|
pyz = PYZ(a.pure, a.zipped_data, cipher=None)
|
||||||
|
exe = EXE(pyz, a.scripts, [], exclude_binaries=True, name='PyInstallerGUIWrapper', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, runtime_tmpdir=None, console=False, disable_windowed_traceback=False, target_arch=None, codesign_identity=None, entitlements_file=None, icon='pyinstallerguiwrapper.ico')
|
||||||
exe = EXE(pyz,
|
coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, upx_exclude=[], name='PyInstallerGUIWrapper')
|
||||||
a.scripts,
|
|
||||||
[],
|
|
||||||
exclude_binaries=True,
|
|
||||||
name='PyInstallerGUIWrapper',
|
|
||||||
debug=False,
|
|
||||||
bootloader_ignore_signals=False,
|
|
||||||
strip=False,
|
|
||||||
upx=True,
|
|
||||||
runtime_tmpdir=None,
|
|
||||||
console=False,
|
|
||||||
disable_windowed_traceback=False,
|
|
||||||
target_arch=None,
|
|
||||||
codesign_identity=None,
|
|
||||||
entitlements_file=None,
|
|
||||||
icon='pyinstallerguiwrapper.ico')
|
|
||||||
|
|
||||||
coll = COLLECT(exe,
|
|
||||||
a.binaries,
|
|
||||||
a.zipfiles,
|
|
||||||
a.datas,
|
|
||||||
strip=False,
|
|
||||||
upx=True,
|
|
||||||
upx_exclude=[],
|
|
||||||
name='PyInstallerGUIWrapper')
|
|
||||||
|
|||||||
@ -3,15 +3,13 @@
|
|||||||
# Contains build-time information scraped from Git (if available)
|
# Contains build-time information scraped from Git (if available)
|
||||||
# and a helper function to format version strings.
|
# and a helper function to format version strings.
|
||||||
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# --- Version Data (Generated) ---
|
# --- Version Data (Generated) ---
|
||||||
# This section is automatically generated by the build process.
|
__version__ = "v.0.0.0.5-0-g42aa62a-dirty"
|
||||||
__version__ = "v.0.0.0.3-6-g5615fb9-dirty"
|
GIT_COMMIT_HASH = "42aa62a1b267d2efcf706332e47764d07cd0f3a3"
|
||||||
GIT_COMMIT_HASH = "5615fb9f55562cbfe532fe7960dfa519465a69d5"
|
|
||||||
GIT_BRANCH = "master"
|
GIT_BRANCH = "master"
|
||||||
BUILD_TIMESTAMP = "2025-05-14T13:57:54Z"
|
BUILD_TIMESTAMP = "2025-11-14T06:43:47.701136+00:00"
|
||||||
IS_GIT_REPO = True
|
IS_GIT_REPO = True
|
||||||
|
|
||||||
# --- Default Values (for comparison or fallback) ---
|
# --- Default Values (for comparison or fallback) ---
|
||||||
@ -19,7 +17,6 @@ DEFAULT_VERSION = "0.0.0+unknown"
|
|||||||
DEFAULT_COMMIT = "Unknown"
|
DEFAULT_COMMIT = "Unknown"
|
||||||
DEFAULT_BRANCH = "Unknown"
|
DEFAULT_BRANCH = "Unknown"
|
||||||
|
|
||||||
|
|
||||||
# --- Helper Function ---
|
# --- Helper Function ---
|
||||||
def get_version_string(format_string=None):
|
def get_version_string(format_string=None):
|
||||||
"""
|
"""
|
||||||
@ -27,7 +24,7 @@ def get_version_string(format_string=None):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
format_string (str, optional): A format string using placeholders.
|
format_string (str, optional): A format string using placeholders.
|
||||||
Defaults to "{{version}} ({{branch}}/{{commit_short}})" if None.
|
Defaults to "{version} ({branch}/{commit_short})" if None.
|
||||||
Placeholders:
|
Placeholders:
|
||||||
{{version}}: Full version string (e.g., 'v1.0.0-5-gabcdef-dirty')
|
{{version}}: Full version string (e.g., 'v1.0.0-5-gabcdef-dirty')
|
||||||
{{tag}}: Clean tag part if exists (e.g., 'v1.0.0'), else DEFAULT_VERSION.
|
{{tag}}: Clean tag part if exists (e.g., 'v1.0.0'), else DEFAULT_VERSION.
|
||||||
@ -43,43 +40,33 @@ def get_version_string(format_string=None):
|
|||||||
str: The formatted version string, or an error message if formatting fails.
|
str: The formatted version string, or an error message if formatting fails.
|
||||||
"""
|
"""
|
||||||
if format_string is None:
|
if format_string is None:
|
||||||
format_string = "{version} ({branch}/{commit_short})"
|
format_string = "{version} ({branch}/{commit_short})" # Default format
|
||||||
|
|
||||||
replacements = {}
|
replacements = {}
|
||||||
try:
|
try:
|
||||||
replacements["version"] = __version__ if __version__ else DEFAULT_VERSION
|
replacements['version'] = __version__ if __version__ else DEFAULT_VERSION
|
||||||
replacements["commit"] = GIT_COMMIT_HASH if GIT_COMMIT_HASH else DEFAULT_COMMIT
|
replacements['commit'] = GIT_COMMIT_HASH if GIT_COMMIT_HASH else DEFAULT_COMMIT
|
||||||
replacements["commit_short"] = (
|
replacements['commit_short'] = GIT_COMMIT_HASH[:7] if GIT_COMMIT_HASH and len(GIT_COMMIT_HASH) >= 7 else DEFAULT_COMMIT
|
||||||
GIT_COMMIT_HASH[:7]
|
replacements['branch'] = GIT_BRANCH if GIT_BRANCH else DEFAULT_BRANCH
|
||||||
if GIT_COMMIT_HASH and len(GIT_COMMIT_HASH) >= 7
|
replacements['timestamp'] = BUILD_TIMESTAMP if BUILD_TIMESTAMP else "Unknown"
|
||||||
else DEFAULT_COMMIT
|
replacements['timestamp_short'] = BUILD_TIMESTAMP.split('T')[0] if BUILD_TIMESTAMP and 'T' in BUILD_TIMESTAMP else "Unknown"
|
||||||
)
|
replacements['is_git'] = "Git" if IS_GIT_REPO else "Unknown"
|
||||||
replacements["branch"] = GIT_BRANCH if GIT_BRANCH else DEFAULT_BRANCH
|
replacements['dirty'] = "-dirty" if __version__ and __version__.endswith('-dirty') else ""
|
||||||
replacements["timestamp"] = BUILD_TIMESTAMP if BUILD_TIMESTAMP else "Unknown"
|
|
||||||
replacements["timestamp_short"] = (
|
|
||||||
BUILD_TIMESTAMP.split("T")[0]
|
|
||||||
if BUILD_TIMESTAMP and "T" in BUILD_TIMESTAMP
|
|
||||||
else "Unknown"
|
|
||||||
)
|
|
||||||
replacements["is_git"] = "Git" if IS_GIT_REPO else "Unknown"
|
|
||||||
replacements["dirty"] = (
|
|
||||||
"-dirty" if __version__ and __version__.endswith("-dirty") else ""
|
|
||||||
)
|
|
||||||
|
|
||||||
tag = DEFAULT_VERSION
|
tag = DEFAULT_VERSION
|
||||||
if __version__ and IS_GIT_REPO:
|
if __version__ and IS_GIT_REPO:
|
||||||
match = re.match(r"^(v?([0-9]+)\.([0-9]+)\.([0-9]+))", __version__)
|
match = re.match(r'^(v?([0-9]+(?:\.[0-9]+)*))', __version__)
|
||||||
if match:
|
if match:
|
||||||
tag = match.group(1)
|
tag = match.group(1)
|
||||||
replacements["tag"] = tag
|
replacements['tag'] = tag
|
||||||
|
|
||||||
output_string = format_string
|
output_string = format_string
|
||||||
for placeholder, value in replacements.items():
|
for placeholder, value in replacements.items():
|
||||||
pattern = re.compile(r"{\s*" + re.escape(placeholder) + r"\s*}")
|
pattern = re.compile(r'{{\s*' + re.escape(placeholder) + r'\s*}}')
|
||||||
output_string = pattern.sub(str(value), output_string)
|
output_string = pattern.sub(str(value), output_string)
|
||||||
|
|
||||||
if re.search(r"{\s*[\w_]+\s*}", output_string):
|
if re.search(r'{\s*\w+\s*}', output_string):
|
||||||
pass
|
pass # Or log a warning: print(f"Warning: Unreplaced placeholders found: {output_string}")
|
||||||
|
|
||||||
return output_string
|
return output_string
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user