1
0
mirror of https://github.com/moepman/acertmgr.git synced 2024-12-27 11:51:50 +01:00

reformat setup.py

This commit is contained in:
Markus 2020-10-12 17:48:55 +02:00
parent bc2a7229ec
commit b48f4532b9

View File

@ -26,19 +26,19 @@ def determine_version():
return version return version
# Derive version from git # Derive version from git
try: try:
output = subprocess.check_output(['git', 'describe', '--tags', '--dirty'], cwd=dir_path) \ output = subprocess.check_output(["git", "describe", "--tags", "--dirty"], cwd=dir_path) \
.decode('utf-8').strip().split('-') .decode("utf-8").strip().split("-")
if len(output) == 1: if len(output) == 1:
return output[0] return output[0]
elif len(output) == 2: elif len(output) == 2:
return "{}.dev0".format(output[0]) return "{}.dev0".format(output[0])
else: else:
release = 'dev' if len(output) == 4 and output[3] == 'dirty' else '' release = "dev" if len(output) == 4 and output[3] == "dirty" else ""
return "{}.{}{}+{}".format(output[0], release, output[1], output[2]) return "{}.{}{}+{}".format(output[0], release, output[1], output[2])
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
try: try:
commit = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('utf-8').strip() commit = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode("utf-8").strip()
status = subprocess.check_output(['git', 'status', '-s']).decode('utf-8').strip() status = subprocess.check_output(["git", "status", "-s"]).decode("utf-8").strip()
return "{}.dev0+{}".format(version, commit) if len(status) > 0 else "{}+{}".format(version, commit) return "{}.dev0+{}".format(version, commit) if len(status) > 0 else "{}+{}".format(version, commit)
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
# finding the git version has utterly failed, use version.txt # finding the git version has utterly failed, use version.txt
@ -65,7 +65,7 @@ if __name__ == "__main__":
keywords="acme letsencrypt", keywords="acme letsencrypt",
url="https://github.com/moepman/acertmgr", url="https://github.com/moepman/acertmgr",
packages=find_packages(), packages=find_packages(),
long_description=read('README.md'), long_description=read("README.md"),
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
classifiers=[ classifiers=[
"Development Status :: 5 - Production/Stable", "Development Status :: 5 - Production/Stable",
@ -79,9 +79,9 @@ if __name__ == "__main__":
], ],
extras_require=extra_requirements, extras_require=extra_requirements,
entry_points={ entry_points={
'console_scripts': [ "console_scripts": [
'acertmgr=acertmgr:main', "acertmgr=acertmgr:main",
], ],
}, },
data_files=[('readme', ['README.md'])] data_files=[("readme", ["README.md"])],
) )