2019-03-22 11:46:01 +01:00
|
|
|
import io
|
2019-02-20 11:50:36 +01:00
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
from setuptools import setup, find_packages
|
|
|
|
|
|
|
|
|
|
|
|
# Utility function to read the README file.
|
|
|
|
# Used for the long_description. It's nice, because now 1) we have a top level
|
|
|
|
# README file and 2) it's easier to type in the README file than to put a raw
|
|
|
|
# string in below ...
|
2019-03-22 11:46:01 +01:00
|
|
|
def read(filename):
|
|
|
|
with io.open(os.path.join(os.path.dirname(__file__), filename)) as f:
|
|
|
|
return f.read()
|
2019-02-20 11:50:36 +01:00
|
|
|
|
|
|
|
|
2019-03-22 11:46:01 +01:00
|
|
|
# Utility function to determine version using git in a PEP-440 compatible way, fallback to version.txt for releases
|
|
|
|
def determine_version():
|
|
|
|
dir_path = os.path.dirname(os.path.realpath(__file__))
|
|
|
|
ver_file = os.path.join(dir_path, "version.txt")
|
|
|
|
version = "0.0.0"
|
|
|
|
if os.path.exists(ver_file):
|
|
|
|
version = read(ver_file)
|
|
|
|
# If this is a release file and no git is found, use version.txt
|
|
|
|
if not os.path.isdir(os.path.join(dir_path, ".git")):
|
|
|
|
return version
|
|
|
|
# Derive version from git
|
2019-02-20 11:50:36 +01:00
|
|
|
try:
|
2019-03-24 17:17:26 +01:00
|
|
|
output = subprocess.check_output(['git', 'describe', '--tags', '--dirty'], cwd=dir_path) \
|
2019-03-22 11:46:01 +01:00
|
|
|
.decode('utf-8').strip().split('-')
|
2019-02-20 11:50:36 +01:00
|
|
|
if len(output) == 1:
|
2019-03-22 11:46:01 +01:00
|
|
|
return output[0]
|
2019-02-20 11:50:36 +01:00
|
|
|
elif len(output) == 2:
|
2019-03-22 11:46:01 +01:00
|
|
|
return "{}.dev0".format(output[0])
|
2019-02-20 11:50:36 +01:00
|
|
|
else:
|
|
|
|
release = 'dev' if len(output) == 4 and output[3] == 'dirty' else ''
|
2019-03-22 11:46:01 +01:00
|
|
|
return "{}.{}{}+{}".format(output[0], release, output[1], output[2])
|
2019-02-20 11:50:36 +01:00
|
|
|
except subprocess.CalledProcessError:
|
|
|
|
try:
|
|
|
|
commit = subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('utf-8').strip()
|
|
|
|
status = subprocess.check_output(['git', 'status', '-s']).decode('utf-8').strip()
|
2019-03-22 11:46:01 +01:00
|
|
|
return "{}.dev0+{}".format(version, commit) if len(status) > 0 else "{}+{}".format(version, commit)
|
2019-02-20 11:50:36 +01:00
|
|
|
except subprocess.CalledProcessError:
|
2019-03-22 11:46:01 +01:00
|
|
|
# finding the git version has utterly failed, use version.txt
|
|
|
|
return version
|
2019-02-20 11:50:36 +01:00
|
|
|
|
|
|
|
|
|
|
|
setup(
|
|
|
|
name="acertmgr",
|
2019-03-22 11:46:01 +01:00
|
|
|
version=determine_version(),
|
2019-02-20 11:50:36 +01:00
|
|
|
author="Markus Hauschild",
|
|
|
|
author_email="moepman@binary-kitchen.de",
|
|
|
|
description="An automated certificate manager using ACME/letsencrypt",
|
|
|
|
license="ISC",
|
|
|
|
keywords="acme letsencrypt",
|
|
|
|
url="https://github.com/moepman/acertmgr",
|
|
|
|
packages=find_packages(),
|
|
|
|
long_description=read('README.md'),
|
2019-02-23 17:36:27 +01:00
|
|
|
long_description_content_type="text/markdown",
|
2019-02-20 11:50:36 +01:00
|
|
|
classifiers=[
|
2019-03-22 11:46:01 +01:00
|
|
|
"Development Status :: 4 - Beta",
|
|
|
|
"Programming Language :: Python",
|
|
|
|
"Environment :: Console",
|
|
|
|
"Topic :: Security :: Cryptography",
|
2019-02-20 11:50:36 +01:00
|
|
|
"License :: OSI Approved :: ISC License",
|
|
|
|
],
|
|
|
|
install_requires=[
|
|
|
|
"cryptography",
|
|
|
|
"six",
|
|
|
|
],
|
|
|
|
extras_require={
|
|
|
|
"dns.nsupdate": [
|
|
|
|
"dnspython",
|
|
|
|
],
|
|
|
|
"yaml": [
|
|
|
|
"yaml",
|
|
|
|
],
|
2019-03-21 13:03:09 +01:00
|
|
|
"idna": [
|
|
|
|
"idna",
|
|
|
|
],
|
2019-02-20 11:50:36 +01:00
|
|
|
},
|
|
|
|
entry_points={
|
|
|
|
'console_scripts': [
|
|
|
|
'acertmgr=acertmgr:main',
|
|
|
|
],
|
|
|
|
},
|
2019-03-25 10:21:02 +01:00
|
|
|
data_files=[('readme', ['README.md'])]
|
2019-02-20 11:50:36 +01:00
|
|
|
)
|