If you follow the simple configure
-> make
-> make install
process for compiling python from source code, you end up with a very large install that includes a whole lot of files that are not necessary for a functional python environment. eg: All .py
files are left in the installation (not just the .pyc
or .pyo
files), all the unit tests are carried over for each library in the lib folders, man pages are included, etc.
Is there a canned way (make option?) to ignore or strip out the 'unnecessary' files during the install process so you are left with a minimalist, but fully functional, python distribution?
If no pre-made procedure, what files can be stripped out, while being certain that the installation will still work on the machine it was installed?
It may be instructive to look at Debian's python2.7-minimal
package (apt-get source python2.7-minimal
). When in doubt, always look to see what others, especially the experts, are doing...
From debian/rules
there:
: # Move the binary and the minimal libraries into $(p_min).
dh_installdirs -p$(p_min) \
etc/$(PVER) \
usr/bin \
usr/include/$(PVER) \
usr/share/man/man1 \
$(scriptdir)/lib-dynload \
$(scriptdir)/config
DH_COMPAT=2 dh_movefiles -p$(p_min) --sourcedir=$(d) \
usr/bin/python$(VER) \
usr/share/man/man1/python$(VER).1 \
$(foreach i,$(MIN_MODS),$(scriptdir)/$(i).py) \
$(foreach i,$(MIN_PACKAGES),$(scriptdir)/$(i)) \
$(foreach i,$(MIN_ENCODINGS),$(scriptdir)/$(i)) \
$(scriptdir)/config/Makefile \
usr/include/$(PVER)/pyconfig.h \
$(scriptdir)/site.py
The MIN_*
variables are parsed out from README.Debian.in
, which of course doubles as the package README
but also thus becomes the authority on which modules to include.
Interesting stuff, I'd never looked at this before now. As for your question, the answer does seem that no, there isn't really a minimal target included in Python, but perhaps you could take the same approach Debian does to achieve your aims.
There is no such option - and it is a good thing keeping the installation as it is (perhaps you can chop of the test files manually). The .py files are handy for debugging. Apart from that: you really want to keep the full installation as it is. Dealing with stripped down Python installations as we see it on various Linux distributions is often a pain in the *.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With