eobuilderize setup.py

This commit is contained in:
Christophe Siraut 2018-07-20 10:45:16 +02:00
parent 9a0173cb4e
commit e5625bd7cf
2 changed files with 44 additions and 3 deletions

2
debian/changelog vendored
View File

@ -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

View File

@ -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,
}
)