How to split modules in multiple deb packages
Hello everybody, I'm packaging a daemon that I've developed in python3 and I need to split the core modules in two deb packages, but I don't now how to do that. One of the module is specific for Raspberry Pi, it adds some functionalities, but the daemon itself doesn't require a Pi hardware and can still do its job without that module even on a Pi. What I want to do is to split the modules in two deb packages, one with all the modules except rpi.py and one with only rpi.py (setting the appropriate dependencies, i.e. python3-gpiozero, etc). How can I do that? I can exclude rpi.py module from main package and create a python3-mypackage.rpi.install file installing rpi.py in /usr/lib/python3/mypackage but I don't think it is the right way of doing that. This is the source folder: mydaemon/ |-- bin/ | `-- mydaemon* | |-- debian/ | |-- changelog | |-- [...] | |-- mydaemon.install | |-- mydaemon.service | |-- python3-mypackage-doc.install | |-- rules* | `-- [...] | |-- MANIFEST.in |-- mypackage/ | |-- module1.py | |-- module2.py | |-- moduleN.py | `-- rpi.py | `-- setup.py The setup.py file is almost this: > setup(name='mydaemon', > packages=['mypackage'], > scripts=['bin/mydaemon'], > install_requires=['python-daemon','jsonschema']) The MANIFEST.in > include setup.py > include MANIFEST.in > recursive-include mypackage *.py > include bin/mydaemon The debian/rules file contains: > dh $@ --with python3,systemd --buildsystem=pybuild Thanks, bye Simone
Re: How to split modules in multiple deb packages
Hi Dominik, thanks for your reply. > Well, in that case, with you being upstream, I'd separate the two > packages entirely. Yes, I can do that. But, don't you think a whole package for a single python file is... too much? >> I can exclude rpi.py module from main package and create a >> python3-mypackage.rpi.install >> file installing rpi.py in /usr/lib/python3/mypackage but I don't think it is >> the right way of doing that. > > Why not? Because I'll miss all the "egg"-related files. Won't I? And, how can I choose the right destination folder? /usr/lib/python3 or /usr/lib/python3.4 perhaps? > This is not a Python package. > > (Hint: no __init__.py…) Of course there is a __init__.py file with all the required import inside mypackage/ folder. I forgot to mention. >> The MANIFEST.in >> > include setup.py >> > include MANIFEST.in >> > recursive-include mypackage *.py >> > include bin/mydaemon > > Uh? All of this is duplicating setup.py. Just remove it. Ok, you are right. > Instead, please > make sure to include your full licence, readme and changelog in the > source tarball from within MANIFEST.in. Yes yes, the whole file include README.md, COPYING, CHANGELOG and a samples folder. Thanks, bye Simone
Re: How to split modules in multiple deb packages
Hi Piotr, > ("mypackage" is module name which will be shipped in python3-mypackage > binary package and "rpi" or "rpi-daemon" is binary package shipping the > daemon) > [...] > if it's one file only (without private modules) you can install directly > into /usr/bin/ The file rpi.py is a module of mypackage, not the binary of the daemon. The binary will be installed in its own package that requires python3-mypackage. Bye Simone
Re: How to split modules in multiple deb packages
Hi Ioannes, > why would you want to do that? > i mean: what harm comes from shipping the rpi.py file on non-rpi systems? Because only the rpi module requires gpiozero module to work properly, but I cannot put a dependency on gpiozero for the whole package. > is that file exposed to the user or is it just internally used? Exposed to the user. > is the system failing gracefully if it is there but not really usable, > because you are missing hardware? (if so, there is no need to split). Yes, it raises ImportError if the user tries to use a class that needs gpiozero. > is the system failing gracefully if it is missing on systems that would > normally use it? (if not, then splitting could actually be harmful). Yes, same as above. But the user can complain that he/she installed a package that requires gpiozero without having pyhton3-gpiozero in the required list... Bye Simone