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 ( ...@@ -29,4 +29,5 @@ from .grid_based_searches import (
from .helper_functions import get_version_information from .helper_functions import get_version_information
__version__ = get_version_information() __version__ = get_version_information()
...@@ -394,9 +394,10 @@ def match_commandlines(cl1, cl2, be_strict_about_full_executable_path=False): ...@@ -394,9 +394,10 @@ def match_commandlines(cl1, cl2, be_strict_about_full_executable_path=False):
def get_version_information(): def get_version_information():
version_file = os.path.join( version_file = os.path.join(
os.path.dirname(os.path.dirname(__file__)), 'pyfstat/.version') os.path.dirname(os.path.dirname(__file__)), "pyfstat/.version"
)
try: try:
with open(version_file, 'r') as f: with open(version_file, "r") as f:
return f.readline().rstrip() return f.readline().rstrip()
except EnvironmentError: except EnvironmentError:
print("No version information file '.version' found") print("No version information file '.version' found")
...@@ -22,24 +22,25 @@ def write_version_file(version): ...@@ -22,24 +22,25 @@ def write_version_file(version):
""" """
try: try:
git_log = subprocess.check_output( git_log = subprocess.check_output(
['git', 'log', '-1', '--pretty=%h %ai']).decode('utf-8') ["git", "log", "-1", "--pretty=%h %ai"]
git_diff = (subprocess.check_output(['git', 'diff', '.']) + ).decode("utf-8")
subprocess.check_output( git_diff = (
['git', 'diff', '--cached', '.'])).decode('utf-8') subprocess.check_output(["git", "diff", "."])
if git_diff == '': + subprocess.check_output(["git", "diff", "--cached", "."])
git_status = '(CLEAN) ' + git_log ).decode("utf-8")
if git_diff == "":
git_status = "(CLEAN) " + git_log
else: else:
git_status = '(UNCLEAN) ' + git_log git_status = "(UNCLEAN) " + git_log
except Exception as e: except Exception as e:
print("Unable to obtain git version information, exception: {}" print("Unable to obtain git version information, exception: {}".format(e))
.format(e)) git_status = ""
git_status = ''
version_file = '.version' version_file = ".version"
if path.isfile(version_file) is False: if path.isfile(version_file) is False:
with open('pyfstat/' + version_file, 'w+') as f: with open("pyfstat/" + version_file, "w+") as f:
f.write('{}: {}'.format(version, git_status)) f.write("{}: {}".format(version, git_status))
print('Done', version_file, version, git_status) print("Done", version_file, version, git_status)
return version_file return version_file
...@@ -61,7 +62,7 @@ here = path.abspath(path.dirname(__file__)) ...@@ -61,7 +62,7 @@ here = path.abspath(path.dirname(__file__))
with open(path.join(here, "README.md"), encoding="utf-8") as f: with open(path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read() long_description = f.read()
VERSION = '1.3' VERSION = "1.3"
version_file = write_version_file(VERSION) version_file = write_version_file(VERSION)
setup( setup(
...@@ -79,7 +80,7 @@ setup( ...@@ -79,7 +80,7 @@ setup(
"pyfstat": [ "pyfstat": [
"pyCUDAkernels/cudaTransientFstatExpWindow.cu", "pyCUDAkernels/cudaTransientFstatExpWindow.cu",
"pyCUDAkernels/cudaTransientFstatRectWindow.cu", "pyCUDAkernels/cudaTransientFstatRectWindow.cu",
version_file version_file,
] ]
}, },
python_requires=">=%s.%s.%s" % min_python_version[:3], 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