From 31ea390036ff6bcebe49559c72c6cef43100b37a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= Date: Thu, 10 Dec 2020 14:34:47 +0100 Subject: [PATCH] Switch kaboxer into a full-blown Python project --- .gitignore | 1 + VERSION | 1 + debian/install | 9 -------- debian/kaboxer.examples | 1 + debian/kaboxer.manpages | 5 ----- debian/rules | 6 +++++- kaboxer => kaboxer/__init__.py | 0 kbxbuilder => kaboxer/builder.py | 0 pyproject.toml | 3 +++ setup.cfg | 37 ++++++++++++++++++++++++++++++++ setup.py | 22 +++++++++++++++++++ 11 files changed, 70 insertions(+), 15 deletions(-) create mode 100644 VERSION delete mode 100644 debian/install create mode 100644 debian/kaboxer.examples delete mode 100644 debian/kaboxer.manpages rename kaboxer => kaboxer/__init__.py (100%) rename kbxbuilder => kaboxer/builder.py (100%) create mode 100644 pyproject.toml create mode 100644 setup.cfg create mode 100755 setup.py diff --git a/.gitignore b/.gitignore index a584200..e3f2757 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /kbxbuilder.1 /kbxbuilder.config.yaml.5 /kbxbuilder.apps.yaml.5 +.ropeproject/ diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..faef31a --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.7.0 diff --git a/debian/install b/debian/install deleted file mode 100644 index 299fc8c..0000000 --- a/debian/install +++ /dev/null @@ -1,9 +0,0 @@ -dh-kaboxer/Buildsystem/kaboxer.pm /usr/share/perl5/Debian/Debhelper/Buildsystem -dh-kaboxer/Sequence/kaboxer.pm /usr/share/perl5/Debian/Debhelper/Sequence -dh-kaboxer/dh_kaboxer /usr/bin -dh-kaboxer/postinst-kaboxer /usr/share/debhelper/autoscripts -dh-kaboxer/postrm-kaboxer /usr/share/debhelper/autoscripts -kaboxer /usr/bin -kbx-hello /usr/share/doc/kaboxer/examples -kbxbuilder /usr/bin -sudoers.d/kaboxer /etc/sudoers.d diff --git a/debian/kaboxer.examples b/debian/kaboxer.examples new file mode 100644 index 0000000..9961610 --- /dev/null +++ b/debian/kaboxer.examples @@ -0,0 +1 @@ +kbx-hello diff --git a/debian/kaboxer.manpages b/debian/kaboxer.manpages deleted file mode 100644 index 7b5df49..0000000 --- a/debian/kaboxer.manpages +++ /dev/null @@ -1,5 +0,0 @@ -kaboxer.1 -kaboxer.yaml.5 -kbxbuilder.1 -kbxbuilder.apps.yaml.5 -kbxbuilder.config.yaml.5 diff --git a/debian/rules b/debian/rules index b8deee6..3882ed6 100755 --- a/debian/rules +++ b/debian/rules @@ -1,7 +1,11 @@ #!/usr/bin/make -f %: - dh $@ --with python3 + dh $@ --with python3 --buildsystem=pybuild + +execute_before_dh_auto_configure: + # Ensure we have the correct version in the Python metadata + dpkg-parsechangelog -SVersion >VERSION override_dh_compress: dh_compress -X kbx-hello diff --git a/kaboxer b/kaboxer/__init__.py similarity index 100% rename from kaboxer rename to kaboxer/__init__.py diff --git a/kbxbuilder b/kaboxer/builder.py similarity index 100% rename from kbxbuilder rename to kaboxer/builder.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..9787c3b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..fa3be82 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,37 @@ +[metadata] +name = kaboxer +version = file:VERSION + +[options] +packages = kaboxer +install_requires = + docker + dockerpty + GitPython + Jinja2 + packaging + prompt_toolkit + requests + tabulate + yaml + +[options.entry_points] +console_scripts = + kaboxer = kaboxer:main + kbxbuilder = kaboxer.builder:main + +[options.data_files] +share/man/man1 = + kaboxer.1 + kbxbuilder.1 +share/man/man5 = + kaboxer.yaml.5 + kbxbuilder.apps.yaml.5 + kbxbuilder.config.yaml.5 +/etc/sudoers.d = sudoers.d/kaboxer +bin = dh-kaboxer/dh_kaboxer +share/perl5/Debian/Debhelper/Buildsystem = dh-kaboxer/Buildsystem/kaboxer.pm +share/perl5/Debian/Debhelper/Sequence = dh-kaboxer/Sequence/kaboxer.pm +share/debhelper/autoscripts = + dh-kaboxer/postinst-kaboxer + dh-kaboxer/postrm-kaboxer diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..14205d0 --- /dev/null +++ b/setup.py @@ -0,0 +1,22 @@ +#!/usr/bin/python3 +import os +from distutils.command.clean import clean +from distutils.command.build import build +from setuptools import setup + + +class MyBuild(build): + def run(self): + # Build manual pages + os.system("make") + super().run() + + +class MyClean(clean): + def run(self): + # Clean manual pages + os.system("make clean") + super().run() + + +setup(cmdclass={'build': MyBuild, 'clean': MyClean})