File: 74-pyproject.txt

package info (click to toggle)
debmake-doc 1.22-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 12,952 kB
  • sloc: makefile: 916; sh: 692; python: 202; ansic: 114; sed: 16
file content (103 lines) | stat: -rw-r--r-- 3,411 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// vim:set filetype=asciidoc:
[[pyproject]]
=== pyproject.toml (Python3, CLI)

Here is an example of creating a simple Debian package from a Python3 CLI program using *pyproject.toml*.

Let's get the source and make the Debian package.

.Download *debhello-1.1.tar.gz*
----
include::../examples/debhello-1.1_build-1/step000.slog[]
----

Here, the content of this *debhello* source tree as follows.

.*pyproject.toml* (v=1.1) -- https://www.python.org/dev/peps/pep-0517/[PEP 517] configuration
----
include::../examples/debhello-1.1_build-1/step103.slog[]
----

.*MANIFEST.in* (v=1.1) -- for tar-ball.
----
include::../examples/debhello-1.1_build-1/step104.slog[]
----

.**src/debhello/\\__init__.py** (v=1.1)
----
include::../examples/debhello-1.1_build-1/step105.slog[]
----

.*src/debhello/main.py* (v=1.1) -- command entry point
----
include::../examples/debhello-1.1_build-1/step106.slog[]
----

Let's package this with the *debmake* command.  Here, the **-b':py3'** option is used to specify the generated binary package containing Python3 script and module files.

----
include::../examples/debhello-1.1_build-1/step200.slog[lines=1..3]
 ...
include::../examples/debhello-1.1_build-1/step200.slog-sanity[]
 ...
----

Let's inspect the notable template files generated.

.*debian/rules* (template file, v=1.1):
----
include::../examples/debhello-1.1_build-1/step202.slog[]
----

This is essentially the standard *debian/rules* file with the *dh* command.

The use of the "`*--with python3*`" option invokes *dh_python3* to calculate Python dependencies, add maintainer scripts to byte compiled files, etc. See *dh_python3*(1).

The use of the "`*--buildsystem=pybuild*`" option invokes various build systems for requested Python versions in order to build modules and extensions.  See *pybuild*(1).

.*debian/control* (template file, v=1.1):
----
include::../examples/debhello-1.1_build-1/step203.slog[]
----

Since this is the Python3 package, the *debmake* command sets "`*Architecture: all*`" and "`*Multi-Arch: foreign*`".  Also, it sets required *substvar* parameters as "`*Depends: ${python3:Depends}, ${misc:Depends}*`".  These are explained in "`<<basics>>`".

Let's make this Debian package better as the maintainer.

.*debian/rules* (maintainer version, v=1.1):
----
include::../examples/debhello-1.1_build-1/step301.slog[]
----

.*debian/control* (maintainer version, v=1.1):
----
include::../examples/debhello-1.1_build-1/step302.slog[]
----

There are several other template files under the *debian/* directory.  These also need to be updated.

This *debhello* command comes with the upstream-provided manpage and desktop file but the upstream *pyproject.toml* doesn't install them.  So you need to update *debian/install* and *debian/manpages* as follows:

.*debian/install* (maintainer version, v=1.1):
----
include::../examples/debhello-1.1_build-1/step303.slog[]
----

.*debian/manpages* (maintainer version, v=1.1):
----
include::../examples/debhello-1.1_build-1/step304.slog[]
----

The rest of the packaging activities are practically the same as the ones in "`<<makefile-sh>>`".

.Template files under *debian/*. (v=1.1):
----
include::../examples/debhello-1.1_build-1/step400.slog[]
----

Here is the generated dependency list of *debhello_1.1-1_all.deb*.

.The generated dependency list of *debhello_1.1-1_all.deb*:
----
include::../examples/debhello-1.1_build-1/step702.slog[]
----