From e4a6f7ce95dc1712bd265326308fcca1174a4345 Mon Sep 17 00:00:00 2001 From: Lou Marvin Caraig Date: Sat, 6 Jun 2020 13:48:53 +0200 Subject: [PATCH] Update setup.py to package the compiled go program Signed-off-by: Lou Marvin Caraig --- setup.py | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 8ecc8c6..0c5241c 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ from functools import partial import setuptools +from wheel.bdist_wheel import bdist_wheel as _bdist_wheel requires = [ @@ -30,7 +31,7 @@ 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Topic :: Software Development', - 'Topic :: Utilities' + 'Topic :: Utilities', ] with open('README.md', 'r') as fh: @@ -40,7 +41,7 @@ def get_about(): regexes = { 'title': r"^__title__\s=\s(?P['])(?P\w*)(?P=quote)$", - 'version': r"^__version__\s=\s(?P<quote>['])(?P<version>[\d\.]*)(?P=quote)$", + 'version': r"^__version__\s=\s(?P<quote>['])(?P<version>[\w\.]*)(?P=quote)$", 'author': r"^__author__\s=\s(?P<quote>['])(?P<author>[\w\s]*)(?P=quote)$", 'author_email': r"^__author_email__\s=\s(?P<quote>['])(?P<author_email>.*)(?P=quote)$", 'description': r"^__description__\s=\s(?P<quote>['])(?P<description>.*)(?P=quote)$", @@ -57,6 +58,19 @@ def get_about(): about = get_about() +class bdist_wheel(_bdist_wheel): + + def finalize_options(self): + _bdist_wheel.finalize_options(self) + self.root_is_pure = False + + def get_tag(self): + if not self.plat_name_supplied: + raise ValueError('plat_name is required') + + return 'py2.py3', 'none', self.plat_name + + setuptools.setup( name=about['title'], version=about['version'], @@ -68,8 +82,14 @@ def get_about(): url=about['project_url'], packages=setuptools.find_packages(exclude=['tests']), scripts=scripts, - package_data={'': ['LICENSE']}, + package_data={ + '': ['LICENSE'], + }, + data_files=[('bin', ['bin/pydockenv_exec'])], include_package_data=True, install_requires=requires, classifiers=classifiers, + cmdclass={ + 'bdist_wheel': bdist_wheel, + }, )