diff --git a/dependencyanalyzer.spec b/dependencyanalyzer.spec index 85f8c1a..21fb007 100644 --- a/dependencyanalyzer.spec +++ b/dependencyanalyzer.spec @@ -1,45 +1,6 @@ -# -*- mode: python ; coding: utf-8 -*- - block_cipher = None - import os -a = Analysis(scripts=['dependencyanalyzer\\__main__.py'], - pathex=['dependencyanalyzer'], - binaries=[], - datas=[], - hiddenimports=[], - hookspath=[], - hooksconfig={}, - runtime_hooks=[], - excludes=[], - win_no_prefer_redirects=False, - win_private_assemblies=False, - cipher=None, - noarchive=False) - +a = Analysis(scripts=['dependencyanalyzer\\__main__.py'], pathex=['dependencyanalyzer', '.'], 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) - -exe = EXE(pyz, - a.scripts, - [], # Binaries/Datas usually handled by Analysis/COLLECT - exclude_binaries=True, # Let COLLECT handle binaries in one-dir - name='DependencyAnalyzer', - debug=False, - bootloader_ignore_signals=False, - strip=False, - upx=True, # Use UPX based on config - runtime_tmpdir=None, - console=False, # Set console based on GUI checkbox - disable_windowed_traceback=False, - target_arch=None, - codesign_identity=None, - entitlements_file=None) - -coll = COLLECT(exe, - a.binaries, - a.zipfiles, - a.datas, - strip=False, - upx=True, # Match UPX setting - upx_exclude=[], - name='DependencyAnalyzer') +exe = EXE(pyz, a.scripts, [], exclude_binaries=True, name='DependencyAnalyzer', 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=None) +coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, upx_exclude=[], name='DependencyAnalyzer') diff --git a/dependencyanalyzer/_version.py b/dependencyanalyzer/_version.py index 203bba7..da4e3d3 100644 --- a/dependencyanalyzer/_version.py +++ b/dependencyanalyzer/_version.py @@ -3,15 +3,13 @@ # Contains build-time information scraped from Git (if available) # and a helper function to format version strings. - import re # --- Version Data (Generated) --- -# This section is automatically generated by the build process. -__version__ = "v.0.0.0.1-dirty" -GIT_COMMIT_HASH = "64a2351e311aa852d2f11c0ac18537cd6fc001fb" +__version__ = "v.0.0.0.6-0-g29b44d4" +GIT_COMMIT_HASH = "29b44d4ff35b56ffc9a0d81d73d8c896241f7f1f" GIT_BRANCH = "master" -BUILD_TIMESTAMP = "2025-05-06T12:11:38Z" +BUILD_TIMESTAMP = "2025-11-10T13:43:39.196176+00:00" IS_GIT_REPO = True # --- Default Values (for comparison or fallback) --- @@ -19,7 +17,6 @@ DEFAULT_VERSION = "0.0.0+unknown" DEFAULT_COMMIT = "Unknown" DEFAULT_BRANCH = "Unknown" - # --- Helper Function --- def get_version_string(format_string=None): """ @@ -27,7 +24,7 @@ def get_version_string(format_string=None): Args: 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: {{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. @@ -43,57 +40,35 @@ def get_version_string(format_string=None): str: The formatted version string, or an error message if formatting fails. """ if format_string is None: - format_string = "{version} ({branch}/{commit_short})" # Sensible default + format_string = "{version} ({branch}/{commit_short})" # Default format replacements = {} try: - # Prepare data dictionary for substitution - replacements["version"] = __version__ if __version__ else DEFAULT_VERSION - replacements["commit"] = GIT_COMMIT_HASH if GIT_COMMIT_HASH else DEFAULT_COMMIT - replacements["commit_short"] = ( - GIT_COMMIT_HASH[:7] - if GIT_COMMIT_HASH and len(GIT_COMMIT_HASH) >= 7 - else DEFAULT_COMMIT - ) - replacements["branch"] = GIT_BRANCH if GIT_BRANCH else DEFAULT_BRANCH - 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 "" - ) + replacements['version'] = __version__ if __version__ else DEFAULT_VERSION + replacements['commit'] = GIT_COMMIT_HASH if GIT_COMMIT_HASH else DEFAULT_COMMIT + replacements['commit_short'] = GIT_COMMIT_HASH[:7] if GIT_COMMIT_HASH and len(GIT_COMMIT_HASH) >= 7 else DEFAULT_COMMIT + replacements['branch'] = GIT_BRANCH if GIT_BRANCH else DEFAULT_BRANCH + 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 "" - # Extract clean tag using regex (handles versions like v1.0.0, 1.0.0) tag = DEFAULT_VERSION if __version__ and IS_GIT_REPO: - # Match optional 'v' prefix, then major.minor.patch - match = re.match(r"^(v?([0-9]+)\.([0-9]+)\.([0-9]+))", __version__) + match = re.match(r'^(v?([0-9]+(?:\.[0-9]+)*))', __version__) if match: - tag = match.group(1) # Get the full tag (e.g., 'v1.0.0') - replacements["tag"] = tag + tag = match.group(1) + replacements['tag'] = tag - # Perform substitution using regex to find placeholders {placeholder} output_string = format_string - # Iterate through placeholders and replace them in the format string for placeholder, value in replacements.items(): - # Compile regex pattern for {placeholder}, allowing for whitespace inside braces - pattern = re.compile(r"{\s*" + re.escape(placeholder) + r"\s*}") - # Substitute found patterns with the corresponding string value - output_string = pattern.sub(str(value), output_string) + pattern = re.compile(r'{{\s*' + re.escape(placeholder) + r'\s*}}') + output_string = pattern.sub(str(value), output_string) - # Optional: Check if any placeholders remain unsubstituted (could indicate typo) - if re.search(r"{\s*[\w_]+\s*}", output_string): - # You might want to log this or handle it, for now, we return the string as is - # print(f"Warning: Unsubstituted placeholders remain in version string: {output_string}") - pass + if re.search(r'{\s*\w+\s*}', output_string): + pass # Or log a warning: print(f"Warning: Unreplaced placeholders found: {output_string}") return output_string except Exception as e: - # Return a simple error message in case of unexpected formatting issues - # Avoid printing directly from this generated function return f"[Formatting Error: {e}]"