Skip to content
Snippets Groups Projects
Commit ae60804c authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Run black

parent 4fdfc028
No related branches found
No related tags found
1 merge request!29Improve the version file information
This commit is part of merge request !29. Comments created here will be created in the context of that merge request.
......@@ -29,4 +29,5 @@ from .grid_based_searches import (
from .helper_functions import get_version_information
__version__ = get_version_information()
......@@ -394,9 +394,10 @@ def match_commandlines(cl1, cl2, be_strict_about_full_executable_path=False):
def get_version_information():
version_file = os.path.join(
os.path.dirname(os.path.dirname(__file__)), 'pyfstat/.version')
os.path.dirname(os.path.dirname(__file__)), "pyfstat/.version"
)
try:
with open(version_file, 'r') as f:
with open(version_file, "r") as f:
return f.readline().rstrip()
except EnvironmentError:
print("No version information file '.version' found")
......@@ -22,24 +22,25 @@ def write_version_file(version):
"""
try:
git_log = subprocess.check_output(
['git', 'log', '-1', '--pretty=%h %ai']).decode('utf-8')
git_diff = (subprocess.check_output(['git', 'diff', '.']) +
subprocess.check_output(
['git', 'diff', '--cached', '.'])).decode('utf-8')
if git_diff == '':
git_status = '(CLEAN) ' + git_log
["git", "log", "-1", "--pretty=%h %ai"]
).decode("utf-8")
git_diff = (
subprocess.check_output(["git", "diff", "."])
+ subprocess.check_output(["git", "diff", "--cached", "."])
).decode("utf-8")
if git_diff == "":
git_status = "(CLEAN) " + git_log
else:
git_status = '(UNCLEAN) ' + git_log
git_status = "(UNCLEAN) " + git_log
except Exception as e:
print("Unable to obtain git version information, exception: {}"
.format(e))
git_status = ''
print("Unable to obtain git version information, exception: {}".format(e))
git_status = ""
version_file = '.version'
version_file = ".version"
if path.isfile(version_file) is False:
with open('pyfstat/' + version_file, 'w+') as f:
f.write('{}: {}'.format(version, git_status))
print('Done', version_file, version, git_status)
with open("pyfstat/" + version_file, "w+") as f:
f.write("{}: {}".format(version, git_status))
print("Done", version_file, version, git_status)
return version_file
......@@ -61,7 +62,7 @@ here = path.abspath(path.dirname(__file__))
with open(path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()
VERSION = '1.3'
VERSION = "1.3"
version_file = write_version_file(VERSION)
setup(
......@@ -79,7 +80,7 @@ setup(
"pyfstat": [
"pyCUDAkernels/cudaTransientFstatExpWindow.cu",
"pyCUDAkernels/cudaTransientFstatRectWindow.cu",
version_file
version_file,
]
},
python_requires=">=%s.%s.%s" % min_python_version[:3],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment