How To compile Python without any module.

Delaney, Timothy tdelaney at avaya.com
Thu Oct 18 20:39:00 EDT 2001


> From: Skip Montanaro [mailto:skip at pobox.com]
>     dag> In fact i don't need the build in modules like sys.
>     dag> So how could i built python with out the build in modules.
>     dag> I want to use Python on 8Mo of Flash and 16Mo of RAM.
> I'd be real surprised if Python worked very well without the 
> sys module.
> Still, you might be able to get away with just commenting it 
> out of the
> makefile.  It's one of the files listed in the PYTHON_OBJS 
> make variable.
> 
> To get an idea of how central the sys module is to Python's operation,
> notice that Include/sysmodule.h is #included by 
> Include/Python.h, which is
> #included by just about every C file in the distribution.

Skip's right here ...

My approach would probably be to identify which parts of the builtin modules
you don't need, and comment those out. It will be a long, difficult process
however, as many parts that you don't think you need will be used by those
parts that you do need. You will need to build a complete dependency tree of
modules and functions, then remove a few at a time, testing that your
application works each time.

As mentioned before, deeply-embedded Python is probably your best option -
if only to show what parts can be safely removed from Python.

http://www.abo.fi/~iporres/python/

Tim Delaney




More information about the Python-list mailing list