Editing source python modules

0 views
Skip to first unread message

Gerard Bosch

unread,
Nov 24, 2009, 10:07:38 AM11/24/09
to sage-...@googlegroups.com
Hello,

I'm new in Sage and I'm working on an implementation for the
error-correcting Golay codes (the decoder mainly).

The question is that I've got some doubts about how to edit de source
code. I have read that I must do a new branch for "my version", edit
files there and build with the changes.

The thing is that I only need to edit a couple of python modules in
sage.coding . I have tried directly editing the files into
"sage/devel/sage-main/build/sage/coding" and it works as I expect on
my local installation without build anything. But I'd like to know the
correct way to done it for example if I do it on a new branch
"sage-myver" and also to know what's about the modules in:

"sage/devel/sage-myver/sage/coding" <-- If I edit here nothing happens
AND
"sage/devel/sage-myver/build/sage/coding" <-- If I done changes here it's okay

And finally, if I build: $ sage -b myver , all the modifications on
modules are loosen (are the modules restored?).
In which directory must I edit the source of python modules?

I'd like to know the correct way and the steps to follow in order to
make a code patch then.


Thanks,
Gerard.

Tim Joseph Dumol

unread,
Nov 24, 2009, 11:04:15 AM11/24/09
to sage-...@googlegroups.com

--
To post to this group, send an email to sage-...@googlegroups.com
To unsubscribe from this group, send an email to sage-devel-...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Hey,

The first step in editing Sage code is to create your own branch from the main branch.

$ sage -b main
$ sage -clone my-branch

Changes should be made to $SAGE_ROOT/devel/sage-my-branch/sage/****. It is highly recommended that you make a Mercurial mq patch[1] to ease patch management. This can be done by cd'ing to the branch folder and running `sage -hg qnew "my-patch-name.patch"`.

$ cd $SAGE_ROOT/devel/sage-my-branch/
$ sage -hg qnew "my-patch-name.patch"

After implementing your changes, run the build script

$ sage -b

to propagate changes to the build folder, and to the site-packages folder. If you feel that your patch is satisfactory, simply refresh your patch, and add your commit message:

$ sage -hg qrefresh -m "#1234 My patch message."

The patch can then be found at $SAGE_ROOT/devel/sage-my-branch/.hg/patches, and this can be uploaded to the Sage Trac at http://sagemath.org. Alternatively, you can export it to a folder you want.

$ sage -hg export qtip -o ~/my-patch.patch

Hope this helps!

--
Tim Joseph Dumol <tim (at) timdumol (dot) com>
http://timdumol.com

Carlo Hamalainen

unread,
Nov 24, 2009, 11:06:15 AM11/24/09
to sage-...@googlegroups.com
On Tue, Nov 24, 2009 at 4:07 PM, Gerard Bosch <gerard...@gmail.com> wrote:
> I'd like to know the correct way and the steps to follow in order to
> make a code patch then.

You will want to use a Mercurial queue. Step by step instructions are here:

http://wiki.sagemath.org/MercurialQueues

If something isn't clear then please do ask about it.

Cheers,

--
Carlo Hamalainen
http://carlo-hamalainen.net
Reply all
Reply to author
Forward
0 new messages