(c) Copyright Rosetta Commons Member Institutions.
(c) This file is part of the Rosetta software suite and is made available under license.
(c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
(c) For more information, see http://www.rosettacommons.org. Questions about this can be
(c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.

Latest tested revision: 29093

List of currently binded namespaces:

core:
core/chemical:
core/conformation:
core/fragment:
core/fragment/picking:
core/fragment/picking/vall:
core/fragment/picking/vall/gen:
core/graph:
core/grid:
core/id:
core/io:
core/io/pdb:
core/io/pose_stream:
core/kinematics:
core/kinematics/tree:
core/mm:
core/optimization:
core/pack:
core/pack/annealer:
core/pack/task:
core/pack/task/ops:
core/pose:
core/pose/datacache:
core/pose/metrics:
core/scoring:
core/scoring/constraints:
core/scoring/dna:
core/scoring/dssp:
core/scoring/electron_density:
core/scoring/hbonds:
core/scoring/methods:
core/scoring/trie:
core/sequence:
core/util:
basic/datacache:

numeric:
numeric/fourier:
numeric/interpolation:
numeric/interpolation/periodic_range:
numeric/interpolation/periodic_range/periodic_value:
numeric/interpolation/spline:
numeric/random:

protocols:
protocols/abinitio:
protocols/antibody:
protocols/constraints_additional:
protocols/docking:
protocols/electron_density:
protocols/flexpack:
protocols/flexpack/annealer:
protocols/flexpack/interaction_graph:
protocols/flexpack/task:
protocols/flxbb:
protocols/idealize:
protocols/jd2:
protocols/ligand_docking:
protocols/loops:
protocols/moves:
protocols/relax:
protocols/toolbox:
protocols/toolbox/TaskOperations:
protocols/topology_broker:

utility:
utility/file:
utility/pointer:
utility/tag:

Requirements -------------------------------------
    To build python bindings on Linux system you have to make sure that the following packages are installed and accessible (added to your path variable):

    - Python >= 2.5
    - cmake

    - GCCXML >=0.9
    - pygccxml
    - Py++
    - Full version of Boost lib (including Boost python) >=1.34

Below is instruction on how to perform local installation (without root rights) of packages GCCXML, pygccxml, Py++ and Boost.

--------------------------------------------------------------------------------
# Creating prefix dir, where all software will be installed to:
mkdir ~/y
echo '#!/bin/sh'  >~/y/y.sh
echo 'export PATH=$HOME/y/bin:$PATH' >>~/y/y.sh
echo 'export PYTHONPATH=$HOME/y/lib/python2.5/site-packages:$PYTHONPATH' >>~/y/y.sh
# if you building on Dig's add this line: echo 'export LD_LIBRARY_PATH=$HOME/y/lib' >>~/y/y.sh
chmod +x ~/y/y.sh
source ~/y/y.sh
# in future session use 'source ~/y/y.sh' before starting to build  bindings

--------------------------------------------------------------------------------
Installing Python 2.5 and cmake (if you trying to build on BakerLab digs this step is req. for you)

1. Install Python 2.5.* from python.org:
 $ wget http://www.python.org/ftp/python/2.5.4/Python-2.5.4.tar.bz2
 $ tar -vjxf Python-2.5.4.tar.bz2   # unpack
 # Building
 $ cd Python-2.5.4
 $ ./configure --enable-shared --prefix=/home/<YOUR_LOGIN>/y  # if you trying to build on digs use --prefix=/work/<your_login>/y instead
 $ make && make install

2. CMake
 # download
 $ wget http://www.cmake.org/files/v2.6/cmake-2.6.3.tar.gz
 $ tar -vzxf cmake-2.6.3.tar.gz
 # Building
 $ cd cmake-2.6.3
 $ ./configure --prefix=~/y
 $ make && make install

--------------------------------------------------------------------------------
# Installing GCCXML:
mkdir gccxml-cvs
cd gccxml-cvs
# getting the source
#cvs -d :pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML co -D 2009-02-03 gccxml
cvs -d :pserver:anoncvs@www.gccxml.org:/cvsroot/GCC_XML co -D 2009-04-15 gccxml
# compiling
mkdir gccxml-build
cd gccxml-build
cmake ../gccxml -DCMAKE_INSTALL_PREFIX:PATH=~/y

make && make install

# Currently gccxml does not support gcc version 4.2 and up, so you may want to make it use
# older gcc version by supplying -DCMAKE_CXX_COMPILER=/some/path/to/gnu-c++ like this:
# cmake ../gccxml -DCMAKE_INSTALL_PREFIX:PATH=~/y -DCMAKE_CXX_COMPILER=/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.2/c++
# Or better yet you can  overwriting gccxml_config to set the correct c++ version ------------------
# mv ~/y/share/gccxml-0.9/gccxml_config ~/y/share/gccxml-0.9/gccxml_config.original
# echo 'GCCXML_COMPILER="/usr/bin/c++-4.0"' >~/y/share/gccxml-0.9/gccxml_config
# echo 'GCCXML_CXXFLAGS=""' >>~/y/share/gccxml-0.9/gccxml_config


cd
# Check installation, following command should report something like: GCC-XML version 0.9.0
gccxml


# Installing pygccxml
# download pygccxml from https://sourceforge.net/project/showfiles.php?group_id=118209
unzip pygccxml-1.0.0.zip
cd pygccxml-1.0.0
python setup.py install --prefix=~/y

# Installing Py++
# download pyplusplus from https://sourceforge.net/project/showfiles.php?group_id=118209
unzip Py++-1.0.0.zip
cd Py++-1.0.0
python setup.py install --prefix=~/y

# Checking installation, following command sequence of commands should report something like: '1.0.0 1.0.0'
python
>>> import pygccxml, pyplusplus
>>> print pygccxml.__version__, pyplusplus.__version__
1.0.0 1.0.0
>>> exit()

# Installing Boost 1_38
# Download and extract source from boost.org
./configure --prefix=/home/<your_home_folder>/y  # if you trying to build on digs use --prefix=/work/<your_login>/y instead
# Note: you have to specify absolute path in '--prefix=...' in line above, saying just '~/y' will not work.
make
make install
# Deprecated --with-python-root=/opt/local --prefix=/home/<your_home_folder>/y

# Manyaly adjust BOOST_PYTHON configuration
in file ~/y/include/boost-1_38/boost/python/detail/preprocessor.hpp line 29 change
#  define BOOST_PYTHON_MAX_ARITY 15
  -->
#  define BOOST_PYTHON_MAX_ARITY 20


#     Building Python bindings
#
# At this point all necessary packages are installed, we can try to build Python bindings
# Check revsion number at line 0 of this file and update your src tree to this revesion
svn up src -r<put revision numebr here>

cd path_to_rosetta/rosetta_source/src/python/bindings

# if you using using system installation of Python (for example for Mac OS build),
# then add '-I/usr/include/python2.5' to command line below.
./BuildBindings.py -I/home/<your_home_folder>/y/include/boost \
    -I/home/<your_home_folder>/y/include \
    -L /home/<your_home_folder>/y/lib/ -L .



# Test results:
python TestBindings.py

--------------------------------------------------------------------------------
Colin's Notes on Building Bindings for Mac OS X 10.5:

I used MacPorts to install Boost.Python and GCCXML.

sudo port install boost+python25 gccxml-devel

Check that Boost.Python is linking against the preinstalled python library:

otool -L /opt/local/lib/libboost_python-mt.dylib

unzip pygccxml-1.0.0.zip
cd pygccxml-1.0.0
python setup.py build
sudo python setup.py install
cd ..

unzip pyplusplus-1.0.0.zip
cd Py++-1.0.0
python setup.py build
sudo python setup.py install

./BuildBindings.py -I/usr/include/python2.5 -I/opt/local/include -I/opt/local/include/boost -L/usr/lib -L/opt/local/lib --boost_lib boost_python-mt

This is what I used to update bindings:

./BuildBindings.py -I/usr/include/python2.5 -I/opt/local/include -I/opt/local/include/boost -L/usr/lib -L/opt/local/lib --boost_lib boost_python-mt -d --one-lib-file -u


----------------------------------------------------------------------------------------------------
Environment variables set up that allow to import PyRosetta from location
different then src/python/bindings. Replace 'current' with appropriate
absolute path to your src/python/bindings folder.

Mac:
export LIBPATH=current/rosetta:$LIBPATH
export PYTHONPATH=current:$PYTHONPATH
export DYLD_LIBRARY_PATH=current:current/rosetta


Linux:
export LIBPATH=current/rosetta:$LIBPATH
export LD_LIBRARY_PATH=current/rosetta
export PYTHONPATH=current:$PYTHONPATH


