-
Notifications
You must be signed in to change notification settings - Fork 60
/
install_doconce.py
174 lines (146 loc) · 6.33 KB
/
install_doconce.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/usr/bin/env python
# Automatically generated script by
# vagrantbox/doc/src/vagrant/src-vagrant/deb2sh.py
# where vagrantbox is the directory arising from
# git clone git@github.com:hplgit/vagrantbox.git
# The script is based on packages listed in debpkg_doconce.txt.
from __future__ import print_function
logfile = 'tmp_output.log' # store all output of all operating system commands
f = open(logfile, 'w'); f.close() # touch logfile so it can be appended
import subprocess, sys
def system(cmd):
"""Run system command cmd."""
print(cmd)
try:
output = subprocess.check_output(cmd, shell=True,
stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
print('Command\n %s\nfailed.' % cmd)
print('Return code:', e.returncode)
print(e.output)
sys.exit(1)
print(output)
f = open(logfile, 'a'); f.write(output); f.close()
system('sudo apt-get update --fix-missing')
# 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)
cmd = """
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
"""
system(cmd)
system('sudo apt-get -y install mercurial')
system('sudo apt-get -y install git')
system('sudo apt-get -y install subversion')
# --- Python-based packages and tools ---
system('sudo apt-get -y install python-pip')
system('sudo apt-get -y install idle')
system('sudo apt-get -y install python-dev')
system('sudo apt-get -y install python-setuptools')
# upgrade
system('sudo pip install setuptools')
system('sudo apt-get -y install python-pdftools')
system('sudo pip install ipython')
system('sudo pip install tornado')
system('sudo pip install pyzmq')
system('sudo pip install traitlets')
system('sudo pip install pickleshare')
system('sudo pip install jsonschema')
# If problems with IPython.nbformat.v4: clone ipython and run setup.py
# to get the latest version
# Preprocessors
system('sudo pip install future')
system('sudo pip install mako')
system('sudo pip install -e git+https://github.com/doconce/preprocess#egg=preprocess')
# Publish for handling bibliography
system('sudo pip install python-Levenshtein')
system('sudo apt-get -y install libxml2-dev')
system('sudo apt-get -y install libxslt1-dev')
system('sudo apt-get -y install zlib1g-dev')
system('sudo pip install lxml')
system('sudo pip install -e hg+https://bitbucket.org/logg/publish#egg=publish')
# Sphinx (with additional third/party themes)
system('sudo pip install sphinx')
system('sudo pip install alabaster')
system('sudo pip install sphinx_rtd_theme')
system('sudo pip install -e hg+https://bitbucket.org/ecollins/cloud_sptheme#egg=cloud_sptheme')
system('sudo pip install -e git+https://github.com/ryan-roemer/sphinx-bootstrap-theme#egg=sphinx-bootstrap-theme')
system('sudo pip install -e hg+https://bitbucket.org/miiton/sphinxjp.themes.solarized#egg=sphinxjp.themes.solarized')
system('sudo pip install -e git+https://github.com/shkumagai/sphinxjp.themes.impressjs#egg=sphinxjp.themes.impressjs')
system('sudo 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
system('sudo pip install sphinxcontrib-paverutils')
system('sudo pip install paver')
system('sudo pip install cogapp')
#pip install -e git+https://bitbucket.org/sanguineturtle/pygments-ipython-console#egg=pygments-ipython-console
system('sudo pip install -e git+https://bitbucket.org/hplbit/pygments-ipython-console#egg=pygments-ipython-console')
system('sudo pip install -e git+https://github.com/hplgit/pygments-doconce#egg=pygments-doconce')
# XHTML
system('sudo pip install beautifulsoup4')
system('sudo pip install html5lib')
# ptex2tex is not needed if the --latex_code_style= option is used
cmd = """
cd srclib
git clone git@github.com:hplgit/ptex2tex.git
cd ptex2tex
sudo python setup.py install
cd latex
sh cp2texmf.sh
cd ../../..
# LaTeX
"""
system(cmd)
system('sudo apt-get -y install texinfo')
system('sudo apt-get -y install texlive')
system('sudo apt-get -y install texlive-extra-utils')
system('sudo apt-get -y install texlive-latex-extra')
system('sudo apt-get -y install texlive-latex-recommended')
system('sudo apt-get -y install texlive-math-extra')
system('sudo apt-get -y install texlive-font-utils')
system('sudo apt-get -y install texlive-humanities')
system('sudo apt-get -y install latexdiff')
system('sudo apt-get -y install auctex')
# Image manipulation
system('sudo apt-get -y install imagemagick')
system('sudo apt-get -y install inkscape')
system('sudo apt-get -y install netpbm')
system('sudo apt-get -y install mjpegtools')
system('sudo apt-get -y install pdftk')
system('sudo apt-get -y install giftrans')
system('sudo apt-get -y install gv')
system('sudo apt-get -y install evince')
system('sudo apt-get -y install smpeg-plaympeg')
system('sudo apt-get -y install mplayer')
system('sudo apt-get -y install totem')
system('sudo apt-get -y install libav-tools')
# Misc
system('sudo apt-get -y install ispell')
system('sudo apt-get -y install pandoc')
system('sudo apt-get -y install libreoffice')
system('sudo apt-get -y install unoconv')
system('sudo apt-get -y install 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
system('sudo apt-get -y install curl')
system('sudo apt-get -y install a2ps')
system('sudo apt-get -y install wdiff')
system('sudo apt-get -y install meld')
system('sudo apt-get -y install diffpdf')
system('sudo apt-get -y install kdiff3')
system('sudo apt-get -y install 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)
print('Everything is successfully installed!')