[Python-Dev] Can Python Be Built Without Distutils

Antonio Cavallo a.cavallo at cavallinux.eu
Sun Jan 25 11:08:35 CET 2015

I tried a Makefile based build of python (+ some module) in the past for Android (and macos):


There was no particular problem in dropping autoconfigure+setup.py in the process: the only real problem was the pgen must be 
compiled on the host machine (but that could have changed since).

In general python was a plain compile and link stuff with not much magic involved and that is (very) good in my opinion: magic 
detection tends to fail, autoconfigure need to "execute" stuff to detect things (reason why is quite useless in cross-compile 
mode) etc.

I would've tried also cmake and qmake builds as well, but simply I didn't have time to spend on it.

I hope this helps,

Zachary Ware wrote:
> On Saturday, January 24, 2015, Brett Cannon <brett at python.org <mailto:brett at python.org>> wrote:
>     On Fri Jan 23 2015 at 5:45:28 PM Gregory P. Smith <greg at krypto.org <javascript:_e(%7B%7D,'cvml','greg at krypto.org');>> wrote:
>         On Fri Jan 23 2015 at 11:20:02 AM M.-A. Lemburg <mal at egenix.com <javascript:_e(%7B%7D,'cvml','mal at egenix.com');>> wrote:
>             On 23.01.2015 19:48, Matthias Klose wrote:
>              > On 01/23/2015 06:30 PM, Cyd Haselton wrote:
>              >> Related to my earlier question regarding building Python on Android
>              >> and an undefined reference to dlopen error...I have the following
>              >> question:  Is it possible to build and install Python without having
>              >> to build and install...or use...distutils?
>              >>
>              >> Some background:
>              >> I can build the python interpreter on my device, and I can build a
>              >> bunch of modules.  The problem appears when make reaches the part
>              >> where setup.py is used to build and import modules...specifically when
>              >> setup.py attempts to import distutils.core.
>              >
>              > you can do this using Setup.local. This works for me building additional
>              > extensions as builtins.  It might require some tweaking to build everything.
>             You may want to have a look at the Setup files we're using
>             in eGenix PyRun, which uses them to force static builds of the
>             various built-in extensions.
>             Look for these files:
>             PyRun/Runtime/Setup.PyRun-2.7
>             PyRun/Runtime/Setup.PyRun-3.4
>             in the source archives:
>             http://www.egenix.com/__products/python/PyRun/ <http://www.egenix.com/products/python/PyRun/>
>              > Otoh, I would like to get rid off the setup.py altogether (/me ducks ...).
>             Why ? It's great for finding stuff on your system and configuring
>             everything without user intervention (well, most of the time :-)).
>         Because our setup.py is a nightmare of arbitrary code run in a linear fashion with ad-hoc checks for things that are
>         unlike how any other project on the planet determines what is available on your system.  It may have seemed "great" when
>         it was created in 2001.  It really shows its age now.
>         It defeats build parallelism and dependency declaration.
>         It also prevents cross compilation.
>         Building an interpreter with a limited standard library on your build host so that you can run said interpreter to have
>         it drive the remainder of your build is way more self hosting that we rightfully need to be for CPython.
>     So are you suggesting to add the build rules to configure and the Makefile -- and Windows build file -- in order to drop
>     setup.py?
> Windows already doesn't use setup.py. There are a lot more modules built-in on Windows, and others have their own project files;
> distutils isn't used at all.
> --
> Sent from Gmail Mobile
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/a.cavallo%40cavallinux.eu

More information about the Python-Dev mailing list