Running Python from the source repo

Chris Angelico rosuav at gmail.com
Sun Aug 7 22:32:23 EDT 2016


On Mon, Aug 8, 2016 at 12:11 PM, Steven D'Aprano
<steve+python at pearwood.info> wrote:
> I have cloned the Python source repo, and build CPython, as described here:
>
> https://docs.python.org/devguide/
>
>
> Now a little bit later, I want to update the repo, so I run:
>
> hg fetch
>
> to get and apply any changes. How do I know if I need to rebuild Python? I
> don't want to have to rebuild after every fetch, because that's quite time
> consuming (I estimate about five minutes on my machine, just long enough to
> be a distraction but not long enough to get into something else). Plus the
> time to run the tests (significantly longer).
>
> What do others do?

I use 'hg pull -u' - that's the same as 'hg fetch' right? After that,
I just 'make'. It won't rebuild everything, only what's changed. If
you 'make' and immediately 'make' again, it's pretty quick - at least,
it is on my Linux box, where it's cheap to 'stat' a bunch of files to
see if they've changed. On other systems, it might be a bit slower,
but it certainly won't take as long as a full build from scratch.

The only time a full rebuild is needed is if something really
fundamental has changed. I just pulled now, and the first build took
1m39s, which involved a reconfigure and a good bit of chugging; then a
rebuild looked like this:

rosuav at sikorsky:~/cpython$ time make
running build
running build_ext
running build_scripts
copying and adjusting /home/rosuav/cpython/Tools/scripts/pydoc3 ->
build/scripts-3.6
copying and adjusting /home/rosuav/cpython/Tools/scripts/idle3 ->
build/scripts-3.6
copying and adjusting /home/rosuav/cpython/Tools/scripts/2to3 ->
build/scripts-3.6
copying and adjusting /home/rosuav/cpython/Tools/scripts/pyvenv ->
build/scripts-3.6
changing mode of build/scripts-3.6/pydoc3 from 644 to 755
changing mode of build/scripts-3.6/idle3 from 644 to 755
changing mode of build/scripts-3.6/2to3 from 644 to 755
changing mode of build/scripts-3.6/pyvenv from 644 to 755
renaming build/scripts-3.6/pydoc3 to build/scripts-3.6/pydoc3.6
renaming build/scripts-3.6/idle3 to build/scripts-3.6/idle3.6
renaming build/scripts-3.6/2to3 to build/scripts-3.6/2to3-3.6
renaming build/scripts-3.6/pyvenv to build/scripts-3.6/pyvenv-3.6

real 0m0.148s
user 0m0.108s
sys 0m0.028s
rosuav at sikorsky:~/cpython$

So normally just run 'make' and let it do its work.

ChrisA



More information about the Python-list mailing list