Wednesday, May 1, 2013

Compiling CPython on Fedora

This is the workflow I used to compile CPython and make a patch on a virtual machine with Fedora 17. The first steps may vary depending on the OS and the distribution, but the structure and the order of the steps is always the same.
First of all, you have to download Mercurial and obtain the appropiate headers:
$ sudo yum install mercurial
$ sudo yum-builddep python3
Then you can download the source code of CPython and compile it:
$ hg clone http://hg.python.org/cpython
$ cd cpython
$ ./configure --with-pydegub
$ make -s
Once this is done, run the tests, make your patch, and run the tests again to make sure your modification does not affect the functioning of CPython:
$ ./python -m test
$ (edit code)
$ hg diff > mypatch.patch
$ ./python -m test
If one test fails, you might want to run it again in verbose mode, so you can easily identify the origin of the problem. Let's say you want to rerun the test test_threading:
$ ./python -m test -v test_threading
Finally, and only if there was no errors while running your tests, you can submit your patch to the issue tracker.

Reference:

No comments:

Post a Comment