Running Python from the source repo

Zachary Ware zachary.ware+pylist at gmail.com
Mon Aug 8 12:24:42 EDT 2016


On Sun, Aug 7, 2016 at 9: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

According to the hg docs [1], you should probably avoid 'hg fetch'.
Use 'hg pull -u' (or 'hg pull && hg update') instead.

> 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 generally assume that if I'm testing a patch, I'm going to need to
rebuild regardless of what the patch actually touches.  I often wait
until the patch is applied before I do the rebuild, or if I'm manually
testing a bug I go ahead and do the rebuild immediately.  Most make
targets (including 'test') will go ahead make sure the build is up to
date without your input.  Usually the slowest part of a rebuild is
rerunning ./configure, which 'make' will do for you if it determines
that it should.  You can speed up ./configure by passing it the
'--config-cache' (or '-C') option.  If you're on a multi-core machine,
also remember to pass '-j<number of cores + 1>' to make to speed up
building, and also to regrtest (which you can do with 'make test
TESTOPTS=-j9') to speed up testing.

[1]https://www.mercurial-scm.org/wiki/FetchExtension

-- 
Zach



More information about the Python-list mailing list