-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing release_skillstore.py (#9)
- Loading branch information
1 parent
3969217
commit 9e39d03
Showing
1 changed file
with
41 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import json | ||
from os.path import join, dirname | ||
|
||
base_dir = dirname(dirname(__file__)) | ||
|
||
|
||
def get_version(): | ||
""" Find the version of the package""" | ||
version_file = join(base_dir, 'version.py') | ||
major, minor, build, alpha = (None, None, None, None) | ||
with open(version_file) as f: | ||
for line in f: | ||
if 'VERSION_MAJOR' in line: | ||
major = line.split('=')[1].strip() | ||
elif 'VERSION_MINOR' in line: | ||
minor = line.split('=')[1].strip() | ||
elif 'VERSION_BUILD' in line: | ||
build = line.split('=')[1].strip() | ||
elif 'VERSION_ALPHA' in line: | ||
alpha = line.split('=')[1].strip() | ||
|
||
if ((major and minor and build and alpha) or | ||
'# END_VERSION_BLOCK' in line): | ||
break | ||
version = f"{major}.{minor}.{build}" | ||
if alpha and int(alpha) > 0: | ||
version += f"a{alpha}" | ||
return version | ||
|
||
|
||
desktop_dir = join(base_dir, "res", "desktop") | ||
|
||
jsonf = join(desktop_dir, "skill.json") | ||
|
||
with open(jsonf) as f: | ||
data = json.load(f) | ||
|
||
data["branch"] = "v" + get_version() | ||
|
||
with open(jsonf, "w") as f: | ||
json.dump(data, f, indent=4) |