Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ current_version = 1.0.10
commit = True
tag = True

[bumpversion:file:pyproject.toml]

[bumpversion:file:kiwi_stackbuild_plugin/version.py]

[bumpversion:file:doc/source/conf.py]
4 changes: 2 additions & 2 deletions .github/workflows/ci-publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
- name: Install
run: |
python -m pip install --upgrade pip
python -m pip install tox
python -m pip install poetry
- name: Prepare
run: |
tox -e doc,release
make prepare_for_pypi
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
10 changes: 5 additions & 5 deletions .github/workflows/ci-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v3
- name: Python${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install
- name: Install Poetry
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Tox
python -m pip install poetry
- name: Run unit and type tests
run: |
tox
make check test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,6 @@ dmypy.json

# Pyre type checker
.pyre/

# Poetry
poetry.lock
34 changes: 0 additions & 34 deletions .virtualenv.dev-requirements.txt

This file was deleted.

8 changes: 0 additions & 8 deletions .virtualenv.requirements.txt

This file was deleted.

18 changes: 0 additions & 18 deletions MANIFEST.in

This file was deleted.

47 changes: 31 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,45 @@ version := $(shell \
'from kiwi_stackbuild_plugin.version import __version__; print(__version__)'\
)

tox:
tox

install:
# install plugin manual page and license/readme
# NOTE: this file is not handled through pip because on system level
install -d -m 755 ${buildroot}usr/share/man/man8
gzip -f doc/build/man/kiwi::system::stackbuild.8
gzip -f doc/build/man/kiwi::system::stash.8
install -m 644 doc/build/man/kiwi::system::stackbuild.8.gz \
${buildroot}usr/share/man/man8
install -m 644 doc/build/man/kiwi::system::stash.8.gz \
${buildroot}usr/share/man/man8
install -d -m 755 ${buildroot}${docdir}/python-kiwi_stackbuild_plugin
install -m 644 LICENSE \
${buildroot}${docdir}/python-kiwi_stackbuild_plugin/LICENSE
install -m 644 README.rst \
${buildroot}${docdir}/python-kiwi_stackbuild_plugin/README

build: clean tox
# create setup.py variant for rpm build.
# delete module versions from setup.py for building an rpm
# the dependencies to the python module rpm packages is
# managed in the spec file
sed -ie "s@>=[0-9.]*'@'@g" setup.py
setup:
poetry install --all-extras

docs: setup
poetry run make -C doc man

check: setup
# python flake tests
poetry run flake8 --statistics -j auto --count kiwi_stackbuild_plugin
poetry run flake8 --statistics -j auto --count test/unit

test: setup
# python static code checks
poetry run mypy kiwi_stackbuild_plugin
# unit tests
poetry run bash -c 'pushd test/unit && pytest -n 5 \
--doctest-modules --no-cov-on-fail --cov=kiwi_stackbuild_plugin \
--cov-report=term-missing --cov-fail-under=100 \
--cov-config .coveragerc'

build: clean check test
# build the sdist source tarball
$(python) setup.py sdist
# restore original setup.py backed up from sed
mv setup.pye setup.py
poetry build --format=sdist
# provide rpm source tarball
mv dist/kiwi_stackbuild_plugin-${version}.tar.gz \
dist/python-kiwi-stackbuild-plugin.tar.gz
Expand All @@ -52,10 +65,12 @@ build: clean tox
# provide rpm rpmlintrc
cp package/python-kiwi_stackbuild_plugin-rpmlintrc dist

pypi: clean tox
$(python) setup.py sdist upload
prepare_for_pypi: clean setup
# sdist tarball, the actual publishing happens via the
# ci-publish-to-pypi.yml github action
poetry build --format=sdist

clean:
$(python) setup.py clean
rm -rf dist
rm -rf doc/build
rm -rf dist/*
rm -rf doc/dist
1 change: 0 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
extensions = [
'sphinx.ext.extlinks',
'sphinx.ext.viewcode',
'sphinx.ext.intersphinx'
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
51 changes: 43 additions & 8 deletions package/python-kiwi_stackbuild_plugin-spec-template
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,36 @@ Summary: KIWI - Stack Build Plugin
License: GPL-3.0-or-later
%if "%{_vendor}" == "debbuild"
# Needed to set Maintainer in output debs
Packager: Marcus Schaefer <ms@suse.de>
Packager: Marcus Schaefer <marcus.schaefer@suse.de>
%endif
Group: %{pygroup}
Source: python-kiwi-stackbuild-plugin.tar.gz
Source1: %{name}-rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: python%{python3_pkgversion}-%{develsuffix}
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-build
BuildRequires: python%{python3_pkgversion}-installer
BuildRequires: python%{python3_pkgversion}-poetry-core >= 1.2.0
BuildRequires: python%{python3_pkgversion}-wheel
# doc build requirements
%if ! (0%{?fedora} >= 41 || 0%{?rhel} >= 10)
BuildRequires: python%{python3_pkgversion}-docopt >= 0.6.2
%else
BuildRequires: python%{python3_pkgversion}-docopt-ng
%endif
%if 0%{?suse_version}
BuildRequires: python%{python3_pkgversion}-Sphinx
%else
BuildRequires: python%{python3_pkgversion}-sphinx
%endif
%if 0%{?debian} || 0%{?ubuntu}
BuildRequires: python%{python3_pkgversion}-sphinx-rtd-theme
%else
BuildRequires: python%{python3_pkgversion}-sphinx_rtd_theme
%endif
%if 0%{?fedora} || 0%{?suse_version}
BuildRequires: fdupes
%endif
BuildArch: noarch

%description
Expand All @@ -79,9 +100,9 @@ image root directory
%package -n python%{python3_pkgversion}-kiwi_stackbuild_plugin
Summary: KIWI - Stack Build Plugin
Group: Development/Languages/Python
Requires: python%{python3_pkgversion} >= 3.9
Requires: python%{python3_pkgversion}-docopt
Requires: python%{python3_pkgversion}-kiwi >= 9.21.21
Requires: python%{python3_pkgversion}-setuptools

%description -n python%{python3_pkgversion}-kiwi_stackbuild_plugin
KIWI plugin to build images using a container layer as the rootfs
Expand All @@ -91,13 +112,27 @@ image root directory
%prep
%setup -q -n kiwi_stackbuild_plugin-%{version}

%build
# Build Python 3 version
%{__python3} setup.py build
# Temporarily switch things back to docopt for everything but Fedora 41+
# FIXME: Drop this hack as soon as we can...
%if ! (0%{?fedora} >= 41 || 0%{?rhel} >= 10)
sed -e 's/docopt-ng.*/docopt = ">=0.6.2"/' -i pyproject.toml
%endif

# Build documentation
make -C doc man

# Build application wheel
%{__python3} -m build --no-isolation --wheel

%install
# Install Python 3 version
%{__python3} setup.py install --prefix=%{_prefix} --root=%{buildroot} %{?is_deb:--install-layout=deb}
# Install plugin
%{__python3} -m installer --destdir %{buildroot} %{?is_deb:--no-compile-bytecode} dist/*.whl

%if 0%{?is_deb}
# Fix where files were installed
mv %{buildroot}%{_prefix}/local/* %{buildroot}%{_prefix}
mv %{buildroot}%{_prefix}/lib/python3* %{buildroot}%{_prefix}/lib/python3
%endif

# Install man pages and package documentation
make buildroot=%{buildroot}/ docdir=%{_defaultdocdir}/ install
Expand Down
87 changes: 87 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
[tool.poetry]
name = "kiwi_stackbuild_plugin"
version = "1.0.10"
description = "KIWI - Stack Build Plugin"
license = "GPL-3.0-or-later"
readme = "README.rst"
homepage = "https://osinside.github.io/kiwi/"
documentation = "https://osinside.github.io/kiwi/plugins/stackbuild.html"
repository = "https://github.com/OSInside/kiwi-stackbuild-plugin"

authors = [
"Marcus Schäfer <[email protected]>",
"David Cassany Viladomat <[email protected]>",
]
maintainers = [
"Marcus Schäfer <[email protected]>",
"David Cassany Viladomat <[email protected]>",
"Neal Gompa <[email protected]>",
]

packages = [
{ include = "kiwi_stackbuild_plugin"},
]

include = [
{ path = ".bumpversion.cfg", format = "sdist" },
{ path = ".coverage*", format = "sdist" },
{ path = "setup.cfg", format = "sdist" },
{ path = "doc/source", format = "sdist" },
{ path = "doc/Makefile", format = "sdist" },
{ path = "helper", format = "sdist" },
{ path = "Makefile", format = "sdist" },
{ path = "package", format = "sdist" },
{ path = "test", format = "sdist" },
]

classifiers = [
# classifier: http://pypi.python.org/pypi?%3Aaction=list_classifiers
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Operating System :: POSIX :: Linux",
"Topic :: System :: Operating System",
]

[tool.poetry.urls]
"Bug Tracker" = "https://github.com/OSInside/kiwi-stackbuild-plugin/issues"

[tool.poetry.dependencies]
python = "^3.9"
kiwi = ">=9.21.21"
docopt-ng = ">=0.9.0"

[tool.poetry.plugins]
[tool.poetry.plugins."kiwi.tasks"]
system_stackbuild = "kiwi_stackbuild_plugin.tasks.system_stackbuild"
system_stash = "kiwi_stackbuild_plugin.tasks.system_stash"

[tool.poetry.group.test]
[tool.poetry.group.test.dependencies]
# python unit testing framework
pytest = ">=6.2.0"
pytest-cov = "*"
pytest-xdist = "*"
# type checking
mypy = ">=0.971"

[tool.poetry.group.style]
[tool.poetry.group.style.dependencies]
flake8 = ">=4.0.0"

[tool.poetry.group.docs]
[tool.poetry.group.docs.dependencies]
sphinx = ">=5.0.0"
sphinx_rtd_theme = "*"
sphinxcontrib-spelling = "*"
pyenchant = "*"
travis-sphinx = "*"
ghp-import = "*"

[tool.poetry.group.development]
[tool.poetry.group.development.dependencies]
python-dateutil = "*"
bumpversion = "*"

[build-system]
requires = ["poetry-core>=1.2.0"]
build-backend = "poetry.core.masonry.api"
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[sdist]
# Used by setup.py sdist
# Used by sdist
formats=gztar

[tool:pytest]
Expand Down
Loading