[Python-Dev] Compiling Python with Python

Antonio Cavallo a.cavallo at cavallinux.eu
Wed Jun 5 22:18:21 CEST 2013


What's the advantage in writing a new build tool? I'm asking this because I'm doing the same using scons:

  https://bitbucket.org/cavallo71/fatpython

At the moment I'm very interested into this problem: the main advantages I see so far are (in scons) are node dependencies and the fact it is plain python syntax.

Thanks



On 5 Jun 2013, at 20:21, Jussi Pakkanen <jpakkane at gmail.com> wrote:

> Hello all
> 
> I'd like to start this email by saying this is not a proposal to change Python's build system. This is just the results of some experimentation you might be interested it.
> 
> I have been working on a cross-platform build system called Meson, which is implemented in Python 3. For symmetry I wanted to see if it could be used to build Python itself. After about an evening worth of work, I got the basic C parts (that is, the build targets in the main Makefile such as core Python, pgen etc) built.
> 
> Main highlights:
> 
> - pyconfig.h generation in a fully cross-platform way without Autoconf (not tested with Visual Studio but should work as Meson has unit tests for this, tests for functions in header files and some others not done)
> 
> - builds in a separate build directory, can have arbitrarily many build dirs with different configurations (for gcc/clang/static analysis/debug/release/etc)
> 
> - configure time 5s, build time 8s on an i5 Macbook running Ubuntu (Autotool-configure takes 37 s but it's not directly comparable because it does a lot more)
> 
> - the file describing the build is 433 lines, most of which look like this:
> 
> if cc.has_header('io.h')
>   pyconf.set('HAVE_IO_H', 1)
> endif
> 
> - implementation of Meson is 100% Python 3, it does not have a dependency on the shell and in fact already works on Windows
> 
> If you want to try it yourself, here are the steps (only 64 bit Linux tested thus far):
> 
> - install python3-ply and Ninja (Ubuntu package ninja-build)
> - get Meson git head: https://sourceforge.net/p/meson/code/
> - get Python3 trunk
> - download and extract the build files into trunk:
> https://dl.dropboxusercontent.com/u/37517477/python-meson.tar.gz
> - cd into Python trunk and do the following commands:
> 
> mkdir build
> cd build
> path/to/meson.py ..
> ninja
> 
> And there you have it. You can't do much with it, though (except run pgen to ensure that it actually did something ;) ).
> 
> If you have any questions that are not directly related to Python, feel free to email me or the Meson mailing list.
> 
> Enjoy,
> 
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/a.cavallo%40cavallinux.eu



More information about the Python-Dev mailing list