-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a better description of development versions
Use `git describe` to provide the version text for development versions.
- Loading branch information
Showing
2 changed files
with
11 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
# Copyright (C) 2000-2006 Donald N. Allingham | ||
# Copyright (C) 2012 Doug Blank | ||
# Copyright (C) 2013 John Ralls <[email protected]> | ||
# Copyright (C) 2025 Nick Hall | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
|
@@ -173,14 +174,11 @@ | |
# | ||
# ------------------------------------------------------------------------- | ||
ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) | ||
|
||
sys.path.insert(0, ROOT_DIR) | ||
git_revision = get_git_revision(ROOT_DIR).replace("\n", "") | ||
if sys.platform == "win32" and git_revision == "": | ||
git_revision = get_git_revision(os.path.split(ROOT_DIR)[1]) | ||
|
||
git_revision = get_git_revision() | ||
if DEV_VERSION: | ||
VERSION += git_revision | ||
# VERSION += "-1" | ||
VERSION = git_revision | ||
|
||
# | ||
# Glade files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
# Gramps - a GTK+/GNOME based genealogy program | ||
# | ||
# Copyright (C) 2012 Doug Blank <[email protected]> | ||
# Copyright (C) 2025 Nick Hall | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
|
@@ -20,18 +21,18 @@ | |
# | ||
|
||
""" | ||
Find the latest git revision. | ||
Use `git describe` to obtain a description of the revision. | ||
""" | ||
|
||
import subprocess | ||
|
||
|
||
def get_git_revision(path=""): | ||
def get_git_revision(): | ||
""" | ||
Return the short commit hash of the latest commit. | ||
Return a description of the latest commit. | ||
""" | ||
stdout = "" | ||
command = ["git", "log", "-1", "--format=%h", path] | ||
command = ["git", "describe"] | ||
try: | ||
proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
(stdout, stderr) = proc.communicate() | ||
|
@@ -43,6 +44,6 @@ def get_git_revision(path=""): | |
stdout = stdout.decode("utf-8", errors="replace") | ||
except UnicodeDecodeError: | ||
pass | ||
return "-" + stdout if stdout else "" | ||
else: # no output from git log | ||
return stdout | ||
else: # no output from git describe | ||
return "" |