https://github.com/ahgamut/python27
https://github.com/ahgamut/cpython/tree/cosmo_py27
The assert macro needs to be changed in cosmopolitan.h to enable compilation (see #138).
Afterwards, just clone the repo and run superconfigure.
Python 2.7.18 compiled seamlessly once I figured out how autoconf worked, and what flags were being fed to the source files when running make. I'm pretty sure we can compile any C-based extensions into python.exe -- they just need to compiled/linked with Cosmopolitan, with necessary glue code added to the Python source. For example, I was able to compile SQLite into python.exe to enable the internal _sqlite module.
The compiled APE is about 4.1MB with MODE=tiny (without any of the standard modules, the interpreter alone is around 1.6MB). Most of the modules in the stdlib compile without error. The _socketmodule (required for Python's simple HTTP server) doesn't compile, as it requires the structs from netdb.h.
On Windows, the APE exits immediately because the intertpreter is unable to find the platform-specific files.
Module/getpath.c and Lib/site.py in the Python source try to use absolute paths from the prefixes provided during compilation; Editing those files to search the right locations (possibly with some zipos magic) ought to fix this.
https://github.com/ahgamut/python27https://github.com/ahgamut/cpython/tree/cosmo_py27
The
assertmacro needs to be changed incosmopolitan.hto enable compilation (see #138).Afterwards, just clone the repo and run
superconfigure.Python 2.7.18 compiled seamlessly once I figured out how
autoconfworked, and what flags were being fed to the source files when runningmake. I'm pretty sure we can compile any C-based extensions intopython.exe-- they just need to compiled/linked with Cosmopolitan, with necessary glue code added to the Python source. For example, I was able to compile SQLite intopython.exeto enable the internal_sqlitemodule.The compiled APE is about 4.1MB with
MODE=tiny(without any of the standard modules, the interpreter alone is around 1.6MB). Most of the modules in the stdlib compile without error. The_socketmodule (required for Python's simple HTTP server) doesn't compile, as it requires the structs fromnetdb.h.On Windows, the APE exits immediately because the intertpreter is unable to find the platform-specific files.
Module/getpath.candLib/site.pyin the Python source try to use absolute paths from the prefixes provided during compilation; Editing those files to search the right locations (possibly with someziposmagic) ought to fix this.