# Installation script for doconce and all dependencies

# This script is translated from
# doc/src/manual/debpkg_doconce.txt
# in the doconce source tree, with help of
# vagrantbox/doc/src/vagrant/src-vagrant/deb2sh.py
# (git clone git@github.com:hplgit/vagrantbox.git)

# Python v2.7 must be installed (doconce does not work with v3.x)
$ pyversion=`python -c 'import sys; print sys.version[:3]'`
$ if [ $pyversion != '2.7' ]; then echo "Python v${pyversion} cannot be used with DocOnce"; exit 1; fi

# Install downloaded source code in subdirectory srclib
$ if [ ! -d srclib ]; then mkdir srclib; fi

# Version control systems
mercurial git subversion

# --- Python-based packages and tools ---
python-pip
idle
python-dev
python-setuptools
# upgrade
pip install setuptools
python-pdftools
pip install ipython
pip install tornado
pip install pyzmq
pip install traitlets
pip install pickleshare
pip install jsonschema
# If problems with IPython.nbformat.v4: clone ipython and run setup.py
# to get the latest version

# Preprocessors
pip install future
pip install mako
pip install -e git+https://github.com/hplgit/preprocess#egg=preprocess

# Publish for handling bibliography
pip install python-Levenshtein
libxml2-dev
libxslt1-dev
zlib1g-dev
pip install lxml
pip install -e hg+https://bitbucket.org/logg/publish#egg=publish

# Sphinx (with additional third/party themes)
pip install sphinx  # installs pygments and docutils too

pip install alabaster
pip install sphinx_rtd_theme
pip install -e hg+https://bitbucket.org/ecollins/cloud_sptheme#egg=cloud_sptheme
pip install -e git+https://github.com/ryan-roemer/sphinx-bootstrap-theme#egg=sphinx-bootstrap-theme
pip install -e hg+https://bitbucket.org/miiton/sphinxjp.themes.solarized#egg=sphinxjp.themes.solarized
pip install -e git+https://github.com/shkumagai/sphinxjp.themes.impressjs#egg=sphinxjp.themes.impressjs
pip install -e git+https://github.com/kriskda/sphinx-sagecell#egg=sphinx-sagecell
# tinkerer has several themes: minimal5, modern5, flat, dark, responsive
#pip install tinkerer --upgrade

# Runestone sphinx books
pip install sphinxcontrib-paverutils
pip install paver
pip install cogapp

#pip install -e git+https://bitbucket.org/sanguineturtle/pygments-ipython-console#egg=pygments-ipython-console
pip install -e git+https://bitbucket.org/hplbit/pygments-ipython-console#egg=pygments-ipython-console
pip install -e git+https://github.com/hplgit/pygments-doconce#egg=pygments-doconce

# XHTML
pip install beautifulsoup4
pip install html5lib

# ptex2tex is not needed if the --latex_code_style= option is used
$ cd srclib
$ git clone git@github.com:hplgit/ptex2tex.git
$ cd ptex2tex
$ sudo python setup.py install
$ cd latex
$ sh cp2texmf.sh  # copy stylefiles to ~/texmf directory
$ cd ../../..

# LaTeX
texinfo
texlive
texlive-extra-utils
texlive-latex-extra
texlive-latex-recommended
texlive-math-extra
texlive-font-utils
texlive-humanities
latexdiff
auctex

# Image manipulation
imagemagick
inkscape
netpbm mjpegtools pdftk giftrans
gv evince smpeg-plaympeg mplayer totem
libav-tools

# Misc
ispell
pandoc
libreoffice unoconv libreoffice-dmaths
#epydoc is an old-fashioned output format, will any doconce user use it?
#pip install -e svn+https://epydoc.svn.sourceforge.net/svnroot/epydoc/trunk/epydoc#egg=epydoc

curl
a2ps wdiff
meld diffpdf kdiff3 diffuse

# tkdiff.tcl:
#tcl8.5-dev tk8.5-dev blt-dev
#https://sourceforge.net/projects/tkdiff/

# example on installing mdframed.sty manually (it exists in texlive,
# but sometimes needs to be in its newest version)
$ git clone https://github.com/marcodaniel/mdframed
$ if [ -d mdframed ]; then cd mdframed; make localinstall; cd ..; fi
#$ echo "remove the mdframe directory (if successful install of mdframed.sty): rm -rf mdframed"

# DocOnce itself
$ cd srclib
$ git clone https://github.com/hplgit/doconce.git
$ if [ -d doconce ]; then cd doconce; sudo python setup.py install; cd ../..; fi
