1
1
#!/usr/bin/python
2
2
import os
3
3
import sys
4
- import time
5
- import glob
6
- import trace
7
4
import tempfile
8
5
9
6
if '--dir' in sys .argv :
10
7
i = sys .argv .index ('--dir' )
11
- dir = sys .argv [i + 1 ]
8
+ dir = sys .argv [i + 1 ]
12
9
else :
13
10
dir = None
14
11
15
12
if '--email' in sys .argv :
16
13
i = sys .argv .index ('--email' )
17
- email = sys .argv [i + 1 ]
14
+ email = sys .argv [i + 1 ]
18
15
else :
19
16
email = None
20
17
26
23
27
24
if '--tarfiledir' in sys .argv :
28
25
i = sys .argv .index ('--tarfiledir' )
29
- tarfiledir = sys .argv [i + 1 ]
26
+ tarfiledir = sys .argv [i + 1 ]
30
27
else :
31
28
tarfiledir = None
32
29
33
30
tmpdir = tempfile .mkdtemp (prefix = 'ase-sphinx-' , dir = dir )
34
31
os .chdir (tmpdir )
35
32
33
+
36
34
def build (email ):
37
35
if os .system ('svn checkout ' +
38
36
'https://svn.fysik.dtu.dk/projects/ase/trunk ase' ) != 0 :
@@ -89,12 +87,14 @@ def build(email):
89
87
fd .write ('' .join (errors ))
90
88
fd .close ()
91
89
if 1 and email is not None :
92
- x = os .system ('mail -s "ASE: EpyDoc errors" %s < epydoc.errors' % email )
90
+ x = os .system (
91
+ 'mail -s "ASE: EpyDoc errors" %s < epydoc.errors' % email )
93
92
assert x == 0
94
93
95
94
os .chdir ('doc' )
96
95
os .mkdir ('_build' )
97
- if os .system ('PYTHONPATH=%s/lib/python sphinx-build . _build' % tmpdir ) != 0 :
96
+ if os .system ('PYTHONPATH=%s/lib/python sphinx-build . _build' %
97
+ tmpdir ) != 0 :
98
98
raise RuntimeError ('Sphinx failed!' )
99
99
os .system ('cd _build; cp _static/searchtools.js .; ' +
100
100
'sed -i s/snapshot.tar/%s.tar/ download.html' % version )
@@ -103,11 +103,15 @@ def build(email):
103
103
if os .system ('PYTHONPATH=%s/lib/python ' % tmpdir +
104
104
'sphinx-build -b latex . _build 2> error' ) != 0 :
105
105
raise RuntimeError ('Sphinx failed!' )
106
- os .system (
107
- 'grep -v "WARNING: unusable reference target found" error 1>&2' )
106
+ os .system ('grep -v "WARNING: unusable reference target found"' +
107
+ 'error 1>&2' )
108
+ # Don't serve mixed content:
109
+ assert os .system (
110
+ 'cd _build; find -name "*.html" | xargs sed -i ' +
111
+ '"s%http://cdn.mathjax.org%https://cdn.mathjax.org%"' ) == 0
108
112
109
113
os .chdir ('_build' )
110
- #os.system('cd ../..; ln -s doc/_static')
114
+ # os.system('cd ../..; ln -s doc/_static')
111
115
if os .system ('make ase-manual.pdf 2>&1' ) != 0 :
112
116
raise RuntimeError ('pdflatex failed!' )
113
117
else :
0 commit comments