Building CPython

Chris Angelico rosuav at gmail.com
Thu May 14 13:11:07 EDT 2015


On Fri, May 15, 2015 at 3:02 AM, BartC <bc at freeuk.com> wrote:
> Actually I had VirtualBox with Ubuntu, but I don't know my way around Linux
> and preferred doing things under Windows (and with all my own tools).
>
> But it's now building under Ubuntu.
>
> (Well, I'm not sure what it's doing exactly; the instructions said type
> make, then make test, then make install, and it's still doing make test.
>
> I hope there's a quicker way of re-building an executable after a minor
> source file change, otherwise doing any sort of development is going to be
> impractical.)

The whole point of 'make' is to rebuild only the parts that need to be
rebuilt (either they've changed, or they depend on something that was
changed). Sometimes practically everything needs to be rebuilt, if you
do some really fundamental change, but generally not.

The three parts to the build process are:

1) make - actually generate an executable. Takes ages the first time,
will be a lot quicker if you haven't changed much.
2) make test - run the entire test suite. Takes just as long every
time, but most of it won't have changed.
3) make install (needs root access, so probably 'sudo make install') -
install this as your primary build of Python.

When you start tinkering, I suggest just running make; rerunning the
test suite isn't necessary till you're all done, and even then it's
only important for making sure that your change hasn't broken anything
anywhere else. Test your actual changes by simply running the
freshly-built Python - most likely that'll be "./python". Working that
way is fairly quick - you can tweak some C code, see the results, and
go back and tweak some more, all without pausing for a sword fight.
But once you go and rerun the full test suite, well... that's when
it's time for some:

https://xkcd.com/303/

ChrisA



More information about the Python-list mailing list