OpenBSD manual page server

Manual Page Search Parameters

PYTHON-MODULE(5) File Formats Manual PYTHON-MODULE(5)

python-modulelang/python port module

This manual page documents the behavior of setting MODULES=lang/python in the ports(7) tree.

By default, the module sets MODPY_VERSION to the appropriate python version (depending on the existence/presence of a ‘python3’ FLAVOR). but MODPY_VERSION may be set manually to ${MODPY_DEFAULT_VERSION_2} for legacy ports.

The module then sets MODPY_BIN, MODPY_INCDIR, MODPY_LIBDIR, MODPY_SITEPKG, MODPY_SETUP, MODPY_TEST_DIR, MODPY_TEST_LOCALE, MODPY_WANTLIB, MODPY_LIB_DEPENDS, MODPY_RUN_DEPENDS, MODPY_TEST_DEPENDS, MODPY_BUILD_DEPENDS, and MODPY_ADJ_FILES accordingly.

The module also appends to

It also appends MODPY_TEST_LOCALE to TEST_ENV and changes to the directory specified in MODPY_TEST_DIR (by default ${WRKSRC}) before running tests.

Ports which use the setuptools module should set MODPY_SETUPTOOLS to Yes.

Ports which use the pytest module should set MODPY_PYTEST to Yes. Arguments can be passed to pytest during test with MODPY_PYTEST_ARGS.

All ports that generate egg-info files should set MODPY_EGG_VERSION to the version string used by the () function in the port's setup.py. Arguments can be passed to setup.py during configure with MODPY_SETUP_ARGS. Extra arguments to the build and install commands can be passed via MODPY_DISTUTILS_BUILDARGS and MODPY_DISTUTILS_INSTALLARGS.

If any files have a python shebang line where the interpreter should be ${MODPY_BIN}, list them in MODPY_ADJ_FILES. These filenames can be relative to ${WRKSRC} and will be modified at the end of pre-configure.

This module also affects CATEGORIES, MAKE_ENV, CONFIGURE_ENV, and SUBST_VARS, and it may affect the test target.

If MODPY_PI is set to ‘Yes’ the module will provide a default for HOMEPAGE and set MASTER_SITES (the subdirectory can be overridden with MODPY_PI_DIR).

Python 2.x places .pyc files in the same directory as the associated .py file. Python 3.x places these in a separate __pycache__ directory and uses an additional suffix. In some cases, an ABI tag is also used for names of compiled extensions. The python module defines variables to allow a single PLIST to be used for both versions: generate or update the PLIST using the python3 FLAVOR, then edit it to prefix any lines creating MODPY_PYCACHE directories with MODPY_COMMENT. As python2 and python3 packages should permit being installed together, it may be necessary to suffix names of common binaries or directories, or split common files into a subpackage. If updating the PLIST without using the python3 flavor, take care not to remove ${MODPY_PYCACHE}, ${MODPY_PYC_MAGIC_TAG}, or ${MODPY_ABI_TAG} variables from the PLIST.

port-modules(5)

July 27, 2021 OpenBSD-current