-
Notifications
You must be signed in to change notification settings - Fork 26
Setting up a development environment
Pynac is a C++ library for symbolic manipulation based on GiNaC. It can use arbitrary Python objects for numeric types. Since Pynac is closely tied to Sage, setting up a development environment and finding your way around initially can be troublesome. This is a short tutorial to provide help with the first steps.
GiNaC has great documentation. It's a good idea to read the tutorial to get familiar with the library. The reference manual for GiNaC can also be useful to find your way around.
One way to set up a development pipeline is to follow these steps:
- have Sage built from git source.
In the following
SAGE_ROOT
means the full path to the directory where you installed Sage. - if the current branch from https://github.com/pynac/sage is newer than Sage develop then fetch and build it
-
cd
intoSAGE_ROOT
- clone the pynac repository:
git clone git@github.com:pynac/pynac.git
or extract the source from theupstream
subdirectory withtar xvfj upstream/pynac-...tar.bz2
-
cd
into the created directory - if you cloned the repo this is the time to create files needed for build (they are included in the tarball). This needs
autoconf
,automake
,m4
,libtoolize
, andautoreconf
installed on your machine. Do:
user@host: aclocal
user@host: autoconf
user@host: autoreconf --install
user@host: automake
Now type
export CFLAGS=-I$SAGE_ROOT/local/include
./configure --includedir=$SAGE_ROOT/local/include --libdir=$SAGE_ROOT/local/lib PKG_CONFIG_PATH=$SAGE_ROOT/local/lib/pkgconfig
and the development environment is set up (to compile Pynac outside Sage you need to give configure a hint where the headers of dependent packages are if you only have installed those packages via Sage, as opposed to a system installation of e.g. flint).
After having changed Pynac to your liking you want to test it inside the newest Sage.
- inside
SAGE_ROOT/pynac
saymake dist
- copy the resulting
bz2
tarball toSAGE_ROOT/upstream
-
cd
toSAGE_ROOT
and:
user@host: ./sage --package fix-checksum
user@host: ./sage -p pynac
user@host: make
user@host: ./sage -tp -a
If no doctests fail you're ready to go! Instead of make
which also builds the full documentation you might want to use make start
if you are not interested in that.
(Previously the install instructions went like this:)
In order to start working on the source code go to your SAGE_ROOT
and run
./sage -f -m spkg/standard/pynac-*.spkg
.
This will install the latest version of Pynac that comes with Sage and leave the package files in the directory spkg/build/pynac-<version>
. You will find the Pynac sources in spkg/build/pynac-<version>/src
, most files you'll want to work on are in the subdirectory ginac
.
After you make changes to the Pynac files, in order to build your changes and install them so Sage will see them, get in a Sage shell with
./sage -sh
Go to the Pynac source directory
cd spkg/build/pynac-*/src
and run
make install