summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Siraut <csiraut@entrouvert.com>2018-07-20 08:45:16 (GMT)
committerChristophe Siraut <csiraut@entrouvert.com>2018-07-20 08:46:08 (GMT)
commite5625bd7cfc207f30e013a51fd8104362f3f4e91 (patch)
tree9b88f6f5d064bb02149f871e1834cc46311facfa
parent9a0173cb4e8a5794792e006994b3ae83e1613013 (diff)
downloadcertbot-haproxy-e5625bd7cfc207f30e013a51fd8104362f3f4e91.zip
certbot-haproxy-e5625bd7cfc207f30e013a51fd8104362f3f4e91.tar.gz
certbot-haproxy-e5625bd7cfc207f30e013a51fd8104362f3f4e91.tar.bz2
eobuilderize setup.py
-rw-r--r--debian/changelog2
-rw-r--r--setup.py45
2 files changed, 44 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog
index e08e8f9..eb28437 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-certbot-haproxy (0.1.1-1) unstable; urgency=low
+certbot-haproxy (0.1.2-1) unstable; urgency=low
* source package automatically created by stdeb 0.8.5
diff --git a/setup.py b/setup.py
index 350df5e..5285ea3 100644
--- a/setup.py
+++ b/setup.py
@@ -1,11 +1,48 @@
+import os
+import subprocess
import sys
-
from setuptools import setup
from setuptools import find_packages
+from distutils.command.sdist import sdist
own_version = '0.1.2'
certbot_version = '0.8.1'
+class eo_sdist(sdist):
+ def run(self):
+ if os.path.exists('VERSION'):
+ os.remove('VERSION')
+ version = get_version()
+ version_file = open('VERSION', 'w')
+ version_file.write(version)
+ version_file.close()
+ sdist.run(self)
+ if os.path.exists('VERSION'):
+ os.remove('VERSION')
+
+def get_version():
+ if os.path.exists('VERSION'):
+ version_file = open('VERSION', 'r')
+ version = version_file.read()
+ version_file.close()
+ return version
+ if os.path.exists('.git'):
+ p = subprocess.Popen(['git', 'describe', '--dirty', '--match=v*'], stdout=subprocess.PIPE)
+ result = p.communicate()[0]
+ if p.returncode == 0:
+ version = result.split()[0][1:]
+ version = version.replace('-', '.')
+ return version
+ return '0'
+
+def data_tree(destdir, sourcedir):
+ extensions = ['.css', '.png', '.jpeg', '.jpg', '.gif', '.xml', '.html', '.js']
+ r = []
+ for root, dirs, files in os.walk(sourcedir):
+ l = [os.path.join(root, x) for x in files if os.path.splitext(x)[1] in extensions]
+ r.append((root.replace(sourcedir, destdir, 1), l))
+ return r
+
# Please update tox.ini when modifying dependency version requirements
install_requires = [
'acme>={0}'.format(certbot_version),
@@ -43,7 +80,7 @@ haproxy_installer = 'certbot_haproxy.installer:HAProxyInstaller'
setup(
name='certbot-haproxy',
- version=own_version,
+ version=get_version(),
description="HAProxy plugin for Certbot",
long_description=long_description,
url='https://code.greenhost.net/open/certbot-haproxy',
@@ -70,6 +107,7 @@ setup(
packages=find_packages(),
include_package_data=True,
+ data_files=data_tree('share/certbot-haproxy/docs/', 'docs/'),
install_requires=install_requires,
extras_require={
'docs': docs_extras,
@@ -81,4 +119,7 @@ setup(
],
},
# test_suite='certbot_haproxy',
+ cmdclass={
+ 'sdist': eo_sdist,
+ }
)