#!/bin/bash
#wget http://python.org/ftp/python/version/Python-version.tgz

version=3.2.2
#version=2.7.2

#Some cleanup
rm -rf install src
rm -rf Python-$version
mkdir install src

#exports
export CC

#Untar and move python into install directory
tar -zxvf  Python-$version.tgz
mv Python-$version/* src
rm -rf Python-$version

#Configure doxygen
cd src 
./configure --prefix="$ISSM_DIR/externalpackages/python/install" --enable-framework="$ISSM_DIR/externalpackages/python/install"
if [ -z $1 ]; then
	make
else
	make -j $1
fi
make install

#Some modifications to be done in case version is 3.2: 
if [[ $version == "3.2.2" ]]; then 
	cd install/bin
	ln -s python3.2 python 
	cd ../
	ln -s Python.framework/Versions/3.2/include/python3.2m include
	ln -s Python.framework/Versions/3.2/lib/ lib


fi
