Skip to content

Commit 85183ef

Browse files
authored
Merge pull request #2816 from OSInside/drop_setuptools_requirement
Drop use of setuptools
2 parents 28158c7 + 2c92441 commit 85183ef

File tree

4 files changed

+33
-26
lines changed

4 files changed

+33
-26
lines changed

doc/source/contributing/kiwi_plugin_architecture.rst

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,44 +24,51 @@ Task plugin class
2424
implementation of the :file:`process` method.
2525

2626
Task plugin entry point
27-
Registration of the plugin must be done in :file:`setup.py`
28-
using the ``entry_points`` concept from Python's setuptools.
27+
Registration of the plugin must be done in :file:`pyproject.toml`
28+
using the ``tool.poetry.plugins`` concept.
2929

3030
.. code:: python
3131
32-
'packages': ['kiwi_plugin'],
33-
'entry_points': {
34-
'kiwi.tasks': [
35-
'service_command=kiwi_plugin.tasks.service_command'
36-
]
37-
}
32+
[tool.poetry]
33+
name = "kiwi_plugin"
34+
35+
packages = [
36+
{ include = "kiwi_plugin"},
37+
]
38+
39+
[tool.poetry.plugins]
40+
[tool.poetry.plugins."kiwi.tasks"]
41+
service_command = "kiwi_plugin.tasks.service_command"
3842
3943
Example plugin
4044
--------------
4145

4246
.. note::
4347

4448
The following example assumes an existing Python project
45-
which was set up according to the Python project rules
46-
and standards.
49+
which was set up using poetry and pyproject.toml.
4750

4851
1. Assuming the project namespace is **kiwi_relax_plugin**, create the task
4952
plugin directory :file:`kiwi_relax_plugin/tasks`
5053

51-
2. Create the entry point in :command:`setup.py`.
54+
2. Create the entry point in :command:`pyproject.toml`.
5255

5356
Assuming we want to create the service named **relax** that has
54-
the command **justdoit**, this is the following entry point
55-
definition in :file:`setup.py`:
57+
the command **justdoit**, this is the required plugin
58+
definition in :file:`pyproject.toml`:
5659

5760
.. code:: python
5861
59-
'packages': ['kiwi_relax_plugin'],
60-
'entry_points': {
61-
'kiwi.tasks': [
62-
'relax_justdoit=kiwi_relax_plugin.tasks.relax_justdoit'
63-
]
64-
}
62+
[tool.poetry]
63+
name = "kiwi_relax_plugin"
64+
65+
packages = [
66+
{ include = "kiwi_relax_plugin"},
67+
]
68+
69+
[tool.poetry.plugins]
70+
[tool.poetry.plugins."kiwi.tasks"]
71+
relax_justdoit = "kiwi_relax_plugin.tasks.relax_justdoit"
6572
6673
3. Create the plugin code in the file
6774
:file:`kiwi_relax_plugin/tasks/relax_justdoit.py` with the following
@@ -106,5 +113,4 @@ Example plugin
106113

107114
.. code:: bash
108115
109-
$ ./setup.py develop
110-
$ kiwi-ng relax justdoit --now
116+
$ poetry run kiwi-ng relax justdoit --now

package/python-kiwi-pkgbuild-template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pkgrel=0
88
pkgdesc="KIWI - Appliance Builder Next Generation"
99
url="https://github.com/SUSE/kiwi/tarball/master"
1010
license=('GPL3')
11-
makedepends=(make gcc python-build python-docopt python-installer python-lxml python-poetry-core python-requests python-setuptools python-simplejson python-sphinx python-sphinx_rtd_theme python-wheel python-yaml shadow grep)
11+
makedepends=(make gcc python-build python-docopt python-installer python-lxml python-poetry-core python-requests python-simplejson python-sphinx python-sphinx_rtd_theme python-wheel python-yaml shadow grep)
1212
provides=(kiwi-ng kiwi)
1313
source=("${pkgname}.tar.gz")
1414
changelog="${pkgname}.changes"
@@ -27,7 +27,7 @@ build() {
2727
}
2828

2929
package_python-kiwi(){
30-
depends=(python-docopt python-simplejson python-lxml python-requests python-setuptools python-yaml grub qemu squashfs-tools gptfdisk pacman e2fsprogs xfsprogs btrfs-progs libisoburn lvm2 mtools parted multipath-tools rsync tar shadow screen kiwi-man-pages)
30+
depends=(python-docopt python-simplejson python-lxml python-requests python-yaml grub qemu squashfs-tools gptfdisk pacman e2fsprogs xfsprogs btrfs-progs libisoburn lvm2 mtools parted multipath-tools rsync tar shadow screen kiwi-man-pages)
3131
optdepends=('gnupg: keyring creation for APT package manager')
3232
cd kiwi-${pkgver}
3333
python3 -m installer --destdir "${pkgdir}/" dist/*.whl

package/python-kiwi-spec-template

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,12 @@ BuildRequires: python%{python3_pkgversion}-docopt >= 0.6.2
9696
%else
9797
BuildRequires: python%{python3_pkgversion}-docopt-ng
9898
%endif
99+
%if 0%{?debian} || 0%{?ubuntu}
100+
# only because of debbuild
101+
BuildRequires: python%{python3_pkgversion}-setuptools
102+
%endif
99103
BuildRequires: python%{python3_pkgversion}-lxml
100104
BuildRequires: python%{python3_pkgversion}-requests
101-
BuildRequires: python%{python3_pkgversion}-setuptools
102105
BuildRequires: python%{python3_pkgversion}-simplejson
103106
%if 0%{?suse_version}
104107
BuildRequires: python%{python3_pkgversion}-Sphinx
@@ -445,7 +448,6 @@ Requires: python%{python3_pkgversion}-docopt-ng
445448
%endif
446449
Requires: python%{python3_pkgversion}-lxml
447450
Requires: python%{python3_pkgversion}-requests
448-
Requires: python%{python3_pkgversion}-setuptools
449451
Requires: python%{python3_pkgversion}-xmltodict
450452
%if ! (0%{?rhel} && 0%{?rhel} < 8)
451453
Recommends: kiwi-man-pages

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ docopt-ng = ">=0.9.0"
5555
lxml = ">=4.6.0"
5656
requests = ">=2.25.0"
5757
PyYAML = ">=5.4.0"
58-
setuptools = ">=50"
5958
simplejson = ">=3.17.0"
6059

6160
# Optional dependencies for markup extra

0 commit comments

Comments
 (0)