From b1b15e2eefe8a8c8975a70c9f4e171b405bae921 Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 14 Sep 2022 22:45:58 +0200 Subject: [PATCH] fix: do not overwrite __version__ (#1170) --- .github/pyinstaller/pyinstaller.spec | 25 ------------------------- CHANGELOG.md | 1 + 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/.github/pyinstaller/pyinstaller.spec b/.github/pyinstaller/pyinstaller.spec index f251828c..8130684a 100644 --- a/.github/pyinstaller/pyinstaller.spec +++ b/.github/pyinstaller/pyinstaller.spec @@ -6,31 +6,6 @@ import subprocess import wcwidth -# git output will look like: -# -# tags/v1.0.0-0-g3af38dc -# ------- tag -# - commits since -# g------- git hash fragment -version = ( - subprocess.check_output(["git", "describe", "--always", "--tags", "--long"]) - .decode("utf-8") - .strip() - .replace("tags/", "") -) -# when invoking pyinstaller from the project root, this gets run from the project root. -with open("./capa/version.py", "r", encoding="utf-8") as f: - lines = f.read() -# version.py contains the version string and other helper functions -# here we manually replace the version value substring with the result of the above git output -VERSION_DEF = "__version__ = " -s = lines.index(VERSION_DEF) -e = s + len(VERSION_DEF) -off_rest_file = e + lines[e:].index("\n") -lines = lines[s:e] + f'"{version}"' + lines[off_rest_file:] -with open("./capa/version.py", "w", encoding="utf-8") as f: - f.write(lines) - a = Analysis( # when invoking pyinstaller from the project root, # this gets invoked from the directory of the spec file, diff --git a/CHANGELOG.md b/CHANGELOG.md index a9f36ac9..32afcb43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ ### Bug Fixes - render: convert feature attributes to aliased dictionary for vverbose #1152 @mike-hunhoff - decouple Token dependency / extractor and features #1139 @mr-tz +- do not overwrite version in version.py during PyInstaller build #1169 @mr-tz ### capa explorer IDA Pro plugin - fix: display instruction items #1154 @mr-tz