dh_pycentral
Register Python modules with pycentral
SYNOPSIS
dh_pycentral [debhelper options]
PARAMETERS
-k, --no-clean
Do not clean up byte-compiled files from the source tree.
-p, --package=package
Act only on the specified package.
-N, --noact
Don't actually do anything; just show what would be done.
-X, --exclude=item
Exclude files or directories matching item from processing.
-v, --verbose
Enable verbose output, showing more details of operations.
-i, --indep
Operate on architecture-independent files (used by debhelper for build architecture).
-a, --arch
Operate on architecture-dependent files (used by debhelper for build architecture).
DESCRIPTION
dh_pycentral is a debhelper(7) program historically used during the Debian package build process to handle Python-specific tasks. Its primary function was to manage Python's byte-compiled files (.pyc and .pyo) for various Python versions supported on a system. When a package installed Python modules, dh_pycentral would ensure these modules were correctly byte-compiled, making them ready for faster execution. It also handled the creation of .pth files and links in /usr/share/python-central, which allowed different Python packages to correctly resolve dependencies and share modules. While once a standard part of Python package building in Debian, dh_pycentral and the broader python-central system it belonged to have been largely superseded by dh-python and the pybuild system. Modern Debian/Ubuntu Python packages typically use dh-python for a more streamlined and flexible approach to Python packaging, making dh_pycentral a legacy tool.
CAVEATS
dh_pycentral and the python-central system it belongs to are largely considered legacy. Modern Debian and Ubuntu packaging for Python applications and libraries exclusively uses dh-python and the pybuild system, which provide a more robust and flexible framework for handling multiple Python versions, virtual environments, and diverse build systems. New Debian packages should not use dh_pycentral. Existing packages might still use it, but are strongly encouraged to migrate to dh-python for maintainability and compatibility.
FILE MANAGEMENT
dh_pycentral managed the byte-compilation of .py files into .pyc and .pyo (optimized) files and ensured these were placed correctly for all supported Python versions (e.g., /usr/lib/python2.7/dist-packages/). It also handled the creation of .pth files and symlinks in /usr/share/python-central, which allowed multiple Debian packages to provide modules to the same Python environment without conflicts.
HISTORY
dh_pycentral was introduced as part of the python-central package in Debian, becoming a standard tool for managing Python byte-compilation and module installation within the Debian packaging ecosystem. Its purpose was to standardize the handling of Python packages, especially in environments with multiple Python interpreters and shared module directories. However, with the evolving landscape of Python development and the need for more flexible build systems (e.g., setuptools, distutils2, wheel), python-central began to show limitations. Around Debian 7 (Wheezy) and later, dh-python emerged as a more modern and powerful successor, leveraging the standard distutils and setuptools build systems more directly. dh_pycentral's usage has steadily declined since, with dh-python now being the recommended and widely adopted method for Python packaging in Debian and its derivatives.
SEE ALSO
debhelper(7), dh-python(1), pybuild(1)