-
Notifications
You must be signed in to change notification settings - Fork 3
/
pavement.py
175 lines (147 loc) · 4.92 KB
/
pavement.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
175
import paver
from paver.easy import *
import paver.setuputils
paver.setuputils.install_distutils_tasks()
import os, sys
import subprocess
sys.path.append(os.getcwd())
# You will want to change these for your own environment in .gitignored paverconfig.py
try:
from paverconfig import master_url, master_app, minify_js
except:
print 'NOTICE: You are using default values for master_* Make your own paverconfig.py file'
master_url = 'http://127.0.0.1:8000'
master_app = 'runestone'
minify_js = False
# Save the most recent
build_info = sh("git describe --long", capture=True)
bif = open('build_info','w')
bif.write(build_info)
bif.close()
options(
sphinx = Bunch(
docroot=".",
),
)
@task
@cmdopts([('all','a','rebuild everything')])
def everyday(options):
# project-specific pavements have defaults set but we can override here
params = ["paver", "build", # task name
"--masterapp", master_app,
"--masterurl", master_url]
if 'all' in options.everyday:
params.append("-a")
os.chdir("books/everyday")
subprocess.call(params)
os.chdir("../..")
@task
@cmdopts([('all','a','rebuild everything')])
def compthink(options):
# project-specific pavements have defaults set but we can override here
params = ["paver", "build", # task name
"--masterapp", master_app,
"--masterurl", master_url]
if 'all' in options.compthink:
params.append("-a")
os.chdir("books/compthink")
with open("../../build_compthink.log", "wb") as build_log:
proc = subprocess.Popen(params, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
for line in proc.stdout:
sys.stdout.write(line)
build_log.write(line)
proc.wait()
os.chdir("../..")
@task
@cmdopts([('all','a','rebuild everything')])
def context(options):
# project-specific pavements have defaults set but we can override here
params = ["paver", "build", # task name
"--masterapp", master_app,
"--masterurl", master_url]
if 'all' in options.context:
params.append("-a")
os.chdir("books/contextualizedpython")
subprocess.call(params)
os.chdir("../..")
@task
@cmdopts([('all','a','rebuild everything')])
def thinkcspy(options):
# project-specific pavements have defaults set but we can override here
params = ["paver", "build", # task name
"--masterapp", master_app,
"--masterurl", master_url]
if 'all' in options.thinkcspy:
params.append("-a")
os.chdir("books/thinkcspy")
subprocess.call(params)
os.chdir("../..")
if minify_js:
sh('./scripts/minifyjs.py %s' % "static/thinkcspy")
@task
@cmdopts([('all','a','rebuild everything')])
def pythonds(options):
# project-specific pavements have defaults set but we can override here
params = ["paver", "build", # task name
"--masterapp", master_app,
"--masterurl", master_url]
if 'all' in options.pythonds:
params.append("-a")
os.chdir("books/pythonds")
subprocess.call(params)
os.chdir("../..")
if minify_js:
sh('./scripts/minifyjs.py %s' % "static/pythonds")
@task
@cmdopts([('all','a','rebuild everything')])
def overview(options):
# project-specific pavements have defaults set but we can override here
params = ["paver", "build", # task name
"--masterapp", master_app,
"--masterurl", master_url]
if 'all' in options.overview:
params.append("-a")
os.chdir("books/overview")
subprocess.call(params)
os.chdir("../..")
if minify_js:
sh('./scripts/minifyjs.py %s' % "static/overview")
@task
@cmdopts([('all','a','rebuild everything')])
def devcourse(options):
# project-specific pavements have defaults set but we can override here
params = ["paver", "build", # task name
"--masterapp", master_app,
"--masterurl", master_url]
if 'all' in options.devcourse:
params.append("-a")
os.chdir("books/devcourse")
subprocess.call(params)
os.chdir("../..")
if minify_js:
sh('./scripts/minifyjs.py %s' % "static/devcourse")
@task
@cmdopts([('all','a','rebuild everything')])
def java4python(options):
# project-specific pavements have defaults set but we can override here
params = ["paver", "build", # task name
"--masterapp", master_app,
"--masterurl", master_url]
if 'all' in options.java4python:
params.append("-a")
os.chdir("books/Java4Python")
subprocess.call(params)
os.chdir("../..")
@task
@cmdopts([('all','a','rebuild everything')])
def allbooks(options):
opts = Bunch()
if 'all' in options.allbooks:
opts['all'] = True
options.thinkcspy = opts
options.pythonds = opts
options.overview = opts
thinkcspy(options)
pythonds(options)
overview(options)