mirror of
https://github.com/weewx/weewx.git
synced 2026-04-19 00:56:54 -04:00
These are notes regarding packaging of weewx for debian systems.
mwall 22feb2020
For the transition from python2 to python3, we introduce a new package
python3-weewx. This contains the python3-compatible weewx4 implementation.
Those who need python2 can continue with the weewx packages for as long as
weewx supports python2.
We must use one control file for python2 and another control file for python3,
since a python2 installation differs from a python3 installation only in the
shebang line of the weewx entry points.
We do our own packaging, using relatively low-level debian packaging tools
instead of the high level python sdist tools. Why?
- WeeWX does some very non-standard things in its setup.py. It modifies the
configuration file and attempts to do other things to facilitate upgrades.
- WeeWX is not just another python package that is plopped into the python
library tree. WeeWX prefers instead to live on its own as a standalone
application, with everything in a single directory tree (or in
system-specific trees such as /var/lib, /etc).
WeeWX was traditionally packaged in a single deb file with this naming:
weewx_x.y.z-n_all.deb
As of 2020, the packaging files now generate two different deb files:
weewx_x.y.z-n_all.deb
python3-weewx_x.y.z-n_all.deb
Even though they are identical other than the shebang, they are mutually
exclusive, since they occupy the same directory and filename space. If someone
wants to run a single weewx installation using both python2 and python3, then
the generation of .pyc files must be prevented, and different entry points are
necessary.
To work "the python way", weewx would have to be modified as follows:
- setup.py would not import any weewx code
- the setup.cfg behavior must be fixed
- setup.py must respect --install-lib and --install-scripts
- weewx library code would live in a python2 or python3 directory
References:
debian python policy:
https://www.debian.org/doc/packaging-manuals/python-policy/
debian library style guide:
https://wiki.debian.org/Python/LibraryStyleGuide
debian pybuild:
https://wiki.debian.org/Python/Pybuild
basic debian lore:
https://www.debian.org/doc/debian-policy/ch-source.html
what does dh_auto do for python?
dh_auto_configure -
dh_auto_build - ./setup.py build
dh_auto_test -
dh_auto_install - ./setup.py install --blah
dh_auto_clean - ./setup.py clean
override_dh_auto_install:
./setup.py install --no-prompt --prefix=build
targets: clean, binary, binary-arch, binary-indep, build, build-arch, build-indep
useful examples:
https://www.wefearchange.org/2012/01/ebian-package-for-python-2-and-3.html
https://www.v13.gr/blog/?p=412