Skip to content

Commit

Permalink
supercell-wx: get copyright year from LICENSE and remove gitpython
Browse files Browse the repository at this point in the history
dependency
  • Loading branch information
aware70 committed Nov 1, 2024
1 parent b2a9af1 commit aff8fd3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
1 change: 0 additions & 1 deletion pkgs/by-name/su/supercell-wx/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ stdenv.mkDerivation (finalAttrs: {
bzip2
(python3.withPackages (ps: [
ps.geopandas
ps.gitpython
]))
];
})
26 changes: 23 additions & 3 deletions pkgs/by-name/su/supercell-wx/patches/skip-git-versioning.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
diff --git a/scwx-qt/tools/generate_versions.py b/scwx-qt/tools/generate_versions.py
index e7c470e..dde3e4f 100644
index e7c470ef..dc7f336b 100644
--- a/scwx-qt/tools/generate_versions.py
+++ b/scwx-qt/tools/generate_versions.py
@@ -74,15 +74,8 @@ def CollectVersionInfo(args):
@@ -1,6 +1,5 @@
import argparse
import datetime
-import git
import json
import os
import pathlib
@@ -69,20 +68,21 @@ def ParseArguments():
required = True)
return parser.parse_args()

+def GetYearFromLicense(license_file: pathlib.Path):
+ import re
+ for line in license_file.read_text().splitlines():
+ m = re.search(r'^\s*Copyright \(c\) 2021-(\d{4,})', line)
+ if m is not None:
+ return int(m.group(1))
+ raise RuntimeError(f"Could not find copyright year in {license_file}")
+
def CollectVersionInfo(args):
print("Collecting version info")

versionInfo = VersionInfo()

Expand All @@ -16,7 +36,7 @@ index e7c470e..dde3e4f 100644
- commitString = commitString + "+dirty"
- copyrightYear = datetime.date.today().year
+ commitString = "@rev@"
+ copyrightYear = datetime.date.today().year
+ copyrightYear = GetYearFromLicense(args.gitRepo_ / 'LICENSE.txt')

versionInfo.commitString_ = commitString
versionInfo.copyrightYear_ = copyrightYear

0 comments on commit aff8fd3

Please sign in to comment.