-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add version indicator in dialog and generated page
Code attempts to get 'git describe' output and falls back to hardcoded tag if that fails. Fixes #132
- Loading branch information
Showing
10 changed files
with
40 additions
and
8 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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Update this when new version is tagged. | ||
LAST_TAG = 'v2.3' | ||
|
||
import os | ||
plugin_path = os.path.realpath(os.path.dirname(__file__)) | ||
plugin_path if not os.path.islink(plugin_path) else os.readlink(plugin_path) | ||
|
||
def _get_git_version(): | ||
import os, subprocess | ||
try: | ||
git_version = subprocess.check_output( | ||
['git', 'describe', '--tags', '--abbrev=4', '--dirty=-*'], | ||
cwd=plugin_path) | ||
return git_version.decode('utf-8') if isinstance(git_version, bytes) else git_version | ||
except subprocess.CalledProcessError as e: | ||
print('Git version check failed: ' + str(e)) | ||
except Exception as e: | ||
print('Git process cannot be launched: ' + str(e)) | ||
return None | ||
|
||
|
||
version = _get_git_version() or LAST_TAG |
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
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
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