xref: /openbsd-src/share/man/man5/python-module.5 (revision de8cc8edbc71bd3e3bc7fbffa27ba0e564c37d8b)
1.\"	$OpenBSD: python-module.5,v 1.1 2021/02/25 09:13:18 espie Exp $
2.\"
3.\" Copyright (c) 2008 Marc Espie
4.\"
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
17.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
20.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd $Mdocdate: February 25 2021 $
28.Dt PYTHON-MODULE 5
29.Os
30.Sh NAME
31.Nm python-module
32.Nd lang/python port module
33.Sh DESCRIPTION
34This manual page documents the behavior of setting
35.Li MODULE=lang/python
36in the
37.Xr ports 7
38tree.
39.Pp
40Sets
41.Ev MODPY_VERSION ,
42.Ev MODPY_BIN ,
43.Ev MODPY_INCDIR ,
44.Ev MODPY_LIBDIR ,
45.Ev MODPY_SITEPKG ,
46.Ev MODPY_SETUP ,
47.Ev MODPY_TEST_DIR ,
48.Ev MODPY_TEST_LOCALE ,
49.Ev MODPY_WANTLIB ,
50.Ev MODPY_LIB_DEPENDS ,
51.Ev MODPY_RUN_DEPENDS ,
52.Ev MODPY_TEST_DEPENDS ,
53.Ev MODPY_BUILD_DEPENDS ,
54and
55.Ev MODPY_ADJ_FILES .
56Appends to
57.Ev RUN_DEPENDS
58unless
59.Ev MODPY_RUNDEP
60is set to No.
61Appends to
62.Ev BUILD_DEPENDS
63unless
64.Ev MODPY_BUILDDEP
65is set to No or
66.Ev NO_BUILD
67is set to Yes.
68Appends to
69.Ev TEST_DEPENDS
70if
71.Ev MODPY_PYTEST
72is set to Yes
73unless
74.Ev MODPY_TESTDEP
75is set to No.
76Appends
77.Ev MODPY_TEST_LOCALE
78to
79.Ev TEST_ENV .
80Changes to the directory specified in
81.Ev MODPY_TEST_DIR ,
82by default WRKSRC, before running tests.
83.Ev MODPY_VERSION
84is the default version used by all python modules.
85Ports which use the setuptools module should set
86.Ev MODPY_SETUPTOOLS
87to Yes.
88Ports which use the pytest module should set
89.Ev MODPY_PYTEST
90to Yes.
91Arguments can be passed to pytest during
92.Cm test
93with
94.Ev MODPY_PYTEST_ARGS .
95All ports that generate egg-info files should set
96.Ev MODPY_EGG_VERSION
97to the version string used by the
98.Fn setup
99function in the port's
100.Pa setup.py .
101Arguments can be passed to setup.py during
102.Cm configure
103with
104.Ev MODPY_SETUP_ARGS .
105Extra arguments to the build and install commands can be passed via
106.Ev MODPY_DISTUTILS_BUILDARGS
107and
108.Ev MODPY_DISTUTILS_INSTALLARGS .
109If any files have a python shebang line which needs to be replaced
110using MODPY_BIN, list them in
111.Ev MODPY_ADJ_FILES .
112These are prefixed with WRKSRC and replaced automatically
113at the end of
114.Cm pre-configure .
115Also affects
116.Ev CATEGORIES ,
117.Ev MAKE_ENV ,
118.Ev CONFIGURE_ENV ,
119and
120.Ev SUBST_VARS .
121May affect the
122.Cm test
123target.
124If
125.Ev MODPY_PI
126is set to Yes it will set
127.Ev HOMEPAGE
128and
129.Ev MASTER_SITES .
130The subdirectory can be overridden with
131.Ev MODPY_PI_DIR .
132.Pp
133Python 2.x places .pyc files in the same directory as the associated .py file.
134Python 3.x places these in a separate __pycache__ directory and uses an
135additional suffix.
136In some cases, an ABI tag is also used for names of compiled extensions.
137The python module defines variables to allow a single PLIST to be
138used for both versions.
139Generate or update the PLIST using the python3
140.Ev FLAVOR ,
141then edit it to prefix any lines creating
142.Ev MODPY_PYCACHE
143directories with
144.Ev MODPY_COMMENT .
145As python2 and python3 packages should permit being installed together,
146it may be necessary to suffix names of common binaries or directories,
147or split common files into a subpackage.
148If updating the PLIST without using the python3 flavor,
149take care not to remove ${MODPY_PYCACHE}, ${MODPY_PYC_MAGIC_TAG}, or
150${MODPY_ABI_TAG} variables from the PLIST.
151.Sh SEE ALSO
152.Xr port-modules 5
153