Turning setup.py into .debs with FPM
Used to be that whenever I saw a Python code repository of an app I wanted to hack on and install Iād get a pit of fear in my stomach.š° Itās so difficult to install with all the pips and venvs and what not.
But fpm to the rescue! At least if thereās a setup.py in the repo.
In a temp directory,
Problem one is that sometimes there might be dependencies. Go install them first (if theyāre in apt, use that) and then add --python-disable-dependency for each one. For example, Iāve been compiling a package that depends on click which I already have installed from Debianās own repos so I would:
There can be multiple instances of the --python-disable-dependency flag.
Problem two is that that turns into a kinda janky deb because all the paths are relative, so I need to be in / when I install it. But I just cd to / and then install āem with the path to the temp directory where the deb is with gdebi.
The awesomest part is that they donāt go in their own venvs or dockers or chroots or their own liāl boring & redundant worlds. Instead itās all according to traditional Debian philosophy, all part of the same file system with no redundancy. Straight into /usr/lib/python3/dist-packages so other packages you install can use them.
You can also install things from pythonās package repos without having the repo locally; just put the package name instead of the path to the repository. Look at those debs carefully before installing āem so you donāt get malware and stuff. Itās not something I do a lot since what I want is usually something thatās in apt already (in which case no need to use fpm at all) or itās something I wanna hack on (in which case I did need the repo, so I could make changes & patches).
fpm - packaging made simple ā fpm - packaging made simple 1.9.0 documentation