Skip to content

Commit 79d43f7

Browse files
committed
Rewrote travis. Should be easier now.
1 parent 99f9d68 commit 79d43f7

File tree

4 files changed

+63
-149
lines changed

4 files changed

+63
-149
lines changed

travis_common.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# travis_common.py
2+
"""Tools used by both travis_pre.py and travis_post.py."""
3+
14
import warnings
25

36
class BuildError(Exception):

travis_file_exceptions

+18-110
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,18 @@
1-
fd5619c31aae7a1607044f9f889509e7640472c7 Applications/RiemannSphere/mobius5.png
2-
fd5619c31aae7a1607044f9f889509e7640472c7 Labs/RiemannSphere/mobius5.png
3-
fb7d83221917837a2db0ab870126497097662603 Labs/Introduction/matplotlib/pcolor2.png
4-
fa3faaa0f6570550435492f73f8f1bcb32121ea1 Algorithms/FFT/tadaspec.pdf
5-
f67a82a8e13ff6fe42c61867215c8073d682b270 Applications/Poisson/co2V.png
6-
f2f5fdf762489b5d39b54c2bd9b179bfa37bf392 Labs/Vol4A/AnisotropicDiffusion/baloons_resized_noisy.png
7-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Vol1B/Complex1/Identity.png
8-
e7a3bbc1cd9feab9f586a6575d602054cc00c012 Applications/RiemannSphere/mobius3.png
9-
e7a3bbc1cd9feab9f586a6575d602054cc00c012 Labs/RiemannSphere/mobius3.png
10-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Vol1B/Complex1/example.png
11-
d76fb0d780b32508ef0b9b3588b3bdaf6988a737 Labs/Vol1B/PageRank/sparse_web.png
12-
cc0a05d00ecbddfcd2e86ce679a6d1296729e4bd Applications/RiemannSphere/mobius4.png
13-
cc0a05d00ecbddfcd2e86ce679a6d1296729e4bd Labs/RiemannSphere/mobius4.png
14-
cade081b49bf2b2338b5f8187d3881d17781948c Algorithms/PRNG/PRNG1.jpg
15-
ca9b04997fc9bf6709b6ff52c65615f5fbea2e74 Algorithms/FourierExtensions/ecoli.jpg
16-
ca270abd85e047edb2ad193a5d61e8ef0cbd1227 Applications/FFT/noisy.pdf
17-
ca14ec790568077b9d140cf45d0b6b22063db780 Labs/Metropolis/samples.pdf
18-
c9d29a113228d2578921a678591ccdf398d7e0b5 Labs/Introduction/matplotlib/sinxsiny.png
19-
c64e14d290a750e842f85e0475ac988bd696ea4e Applications/WaveletApps/dwt2.pdf
20-
c64e14d290a750e842f85e0475ac988bd696ea4e Algorithms/Haar/dwt2.pdf
21-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Vol1B/Complex1/function.png
22-
be9ef2d16457693f15023e443a22b19236b07aeb Labs/Introduction/matplotlib/3dplot.pdf
23-
aea400bcc2258a80e6ef3b84203d1580f9f2609c Labs/CompressedSensing/Estimated2Cropped.pdf
24-
a91d31f8d0a14ab29213bbb0e419dae412f4c54c Labs/Introduction/matplotlib/GrandCanyon.pdf
25-
a8fccffbf997babb63e42eb94c46313d8ae1cde9 Applications/RiemannSphere/StereographicIllustration.png
26-
a8fccffbf997babb63e42eb94c46313d8ae1cde9 Labs/RiemannSphere/StereographicIllustration.png
27-
a50676a8b25acfa79cf969fe3811d4ea5a2030d5 Labs/Introduction/matplotlib/fancymesh.png
28-
a4c822c3835d4ec6ad069183610c6a9c6ea35a3a Python/scipyoptimize/MultiMin.pdf
29-
a44299a3d07ad281694a79b3fd81b5cf181fd085 Algorithms/PRNG/PRNG2.jpg
30-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Vol1B/Complex1/complexnumbers/poly_color_plot_imag.pdf
31-
9804ac4427f896ad1a20bcec8d8c8db008b6629d Labs/Introduction/matplotlib/mesh_example.png
32-
87938910652c1221f01fca2512f1a1a7f743b6c7 Labs/Introduction/matplotlib/pcolor2.png
33-
8630ad8383023b3e822f2aa21ea8b7dfebf53430 Labs/CorrelationCovariance/nonlinear_dependence.pdf
34-
81111cbcb81111b2c92679d8f9d92fc2d5406741 Labs/CompressedSensing/Original2Cropped.pdf
35-
7d89c6262556825d1741c9faa127021d47bf8efd Labs/CrimeMapping/map.jpeg
36-
6d3573ee7d730236ca7b13c7f8ea4c68eeda2555 Applications/FFT/Cleanedsignal.pdf
37-
6bbaf966a54cc5fb03744b46e345b4774dfb9933 Algorithms/residues/inv4_imag.png
38-
5f59212ebccaca39aff36741e9144234063aea02 Algorithms/residues/exp_inv2_imag.png
39-
5be390fa7e18af5e3cd6d673bfe5c77c2ad27936 Python/scipyoptimize/HeatingFit.pdf
40-
50aceaa2b159325c7e36640c1a505bdd256d8dfb Algorithms/residues/exp_inv_real.png
41-
4ec65bacc9b4715b9c9df30b089b9dcdf6279149 Labs/Introduction/matplotlib/pcolor.png
42-
4d18576c7ee8526d79efe18e4844744c60295d56 Algorithms/FourierExtensions/2dfft.pdf
43-
4af48925983d2a138d6732c1be0e96d844701b05 Python/scipyoptimize/Rosenbrock.pdf
44-
4af48925983d2a138d6732c1be0e96d844701b05 Labs/Vol1B/NumericalDerivatives/Rosenbrock.pdf
45-
4af48925983d2a138d6732c1be0e96d844701b05 Algorithms/MultiDeriv/Rosenbrock.pdf
46-
4af48925983d2a138d6732c1be0e96d844701b05 Labs/MultivariateDerivatives/Rosenbrock.pdf
47-
488bf6c5f24b500bee4917fa1416e4dad8ebde03 Labs/Wavelets/phantom_random.pdf
48-
488bf6c5f24b500bee4917fa1416e4dad8ebde03 Algorithms/Haar/phantom_random.pdf
49-
4634c65fd79d2760818602652c959c4380119dd1 Labs/Vol2B/scipyoptimize/ManyMinima.pdf
50-
43ab20e9f7d046f76dfca305d2947d91b415480b Algorithms/residues/exp_inv2_real.png
51-
3fa887830b48be3b862dd64247b89585acd91c98 Labs/BSplines/decasteljau_6.png
52-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Vol1B/Complex1/function1.png
53-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Vol1B/Complex1/function2.png
54-
3627caee071bdf4e8a0acd3b954cd276f6715925 Applications/RiemannSphere/mobius2.png
55-
3627caee071bdf4e8a0acd3b954cd276f6715925 Labs/RiemannSphere/mobius2.png
56-
341924ca96d49ad80bdac273004f6fda8cde9923 Applications/ComplexIntegration/RiemannSurface3.pdf
57-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Vol1B/Complex1/log_riemann_surface.pdf
58-
2c8180d0e941bc85958026424e7456395500f656 Labs/Introduction/matplotlib/3dplot.pdf
59-
219177da81b6e1a4b657b80096558ac9a6830019 Algorithms/residues/exp_inv2_abs.png
60-
1f1ae7124d251f58f8abf8ed65a71285be7e5968 Labs/Vol1B/GMRES/LeastSquares.pdf
61-
1dafb61efeb78dd54587741547bcf50d229a75cf Applications/ComplexIntegration/RiemannSurface4.pdf
62-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Vol1B/Complex1/arctan_riemann_surface.pdf
63-
1affd29ee99d45c9ed127053026526ef3c4a5ad6 Algorithms/residues/exp_inv_imag.png
64-
18ffef3f46ac42729822b9497276214acc886969 Algorithms/FFT/tadaspec2.pdf
65-
189d1d90d34a580b5e7e0ca9f5f252f801aaab9d Applications/Earthquakes/latlong.png
66-
12b8c862d1398a03e51c24c42825bedc87d97e99 Labs/Introduction/matplotlib/soln3.pdf
67-
1089d7fa5890e4f5b8ae7d87353fa2400be2d413 Labs/Introduction/matplotlib/GrandCanyon.png
68-
0ffe2b14ac02958c8a89db7ce5d5d6e8ef3b0ae2 Algorithms/residues/exp_inv_abs.png
69-
0e3b2ce130417fa4f510f4b4c595681c0bf9ed03 Algorithms/residues/inv4_real.png
70-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Vol1B/Complex1/poly_color_plot_real.pdf
71-
02a4b6f140152525956382aa97ae3db9dc73d089 Applications/FFT/noisyspec.pdf
72-
02220801d73bdaca2beb9c66479224d7705dac9e Applications/Poisson/waterRho.png
73-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Vol1B/Complex1/poly_color_plot_imag.pdf
74-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Vol1B/Complex1/poly_color_plot_imag.pdf
75-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Vol1B/Complex1/poly_color_plot_real.pdf
76-
1f1ae7124d251f58f8abf8ed65a71285be7e5968 Algorithms/GMRES/LeastSquares.pdf
77-
f2f5fdf762489b5d39b54c2bd9b179bfa37bf392 Applications/AnisotropicDiffusion/baloons_resized_noisy.png
78-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Vol1B/Complex1/arctan_riemann_surface.pdf
79-
4af48925983d2a138d6732c1be0e96d844701b05 Algorithms/NumDeriv/Rosenbrock.pdf
80-
ca14ec790568077b9d140cf45d0b6b22063db780 Algorithms/Metropolis/samples.pdf
81-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Vol1B/Complex1/function2.png
82-
3fa887830b48be3b862dd64247b89585acd91c98 Algorithms/Splines/decasteljau_6.png
83-
488bf6c5f24b500bee4917fa1416e4dad8ebde03 Applications/WaveletApps/phantom_random.pdf
84-
7d89c6262556825d1741c9faa127021d47bf8efd Applications/CrimeMapping/map.jpeg
85-
c182ed4b5e6297c38dfb442f4336cb54f39453f2 Algorithms/complexnumbers/function.png
86-
d76fb0d780b32508ef0b9b3588b3bdaf6988a737 Applications/PageRank/sparse_web.png
87-
8630ad8383023b3e822f2aa21ea8b7dfebf53430 Applications/CorrCovariance/nonlinear_dependence.pdf
88-
fcdff00c64a4294f175752d493936b4065d812a7 Labs/TotalVariation/lab_noised_baloons_resized_bw.jpg
89-
e32d50318491b00c7e5b5dca2537c1c2e14e94f0 Labs/InvertedPendulum/rickshaw_img.png
90-
91-
12b8c862d1398a03e51c24c42825bedc87d97e99 Python/matplotlib/soln3.pdf
92-
fb7d83221917837a2db0ab870126497097662603 Python/matplotlib/pcolor2.png
93-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Complex1/poly_color_plot_imag.pdf
94-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Complex1/poly_color_plot_real.pdf
95-
1f1ae7124d251f58f8abf8ed65a71285be7e5968 Labs/GMRES/LeastSquares.pdf
96-
1dafb61efeb78dd54587741547bcf50d229a75cf Labs/Complex1/arctan_riemann_surface.pdf
97-
c9d29a113228d2578921a678591ccdf398d7e0b5 Python/matplotlib/sinxsiny.png
98-
1089d7fa5890e4f5b8ae7d87353fa2400be2d413 Python/matplotlib/GrandCanyon.png
99-
4af48925983d2a138d6732c1be0e96d844701b05 Labs/NumericalDerivatives/Rosenbrock.pdf
100-
a50676a8b25acfa79cf969fe3811d4ea5a2030d5 Python/matplotlib/fancymesh.png
101-
2c8180d0e941bc85958026424e7456395500f656 Python/matplotlib/3dplot.pdf
102-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Complex1/function2.png
103-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Complex1/function1.png
104-
9804ac4427f896ad1a20bcec8d8c8db008b6629d Python/matplotlib/mesh_example.png
105-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Complex1/function.png
106-
d76fb0d780b32508ef0b9b3588b3bdaf6988a737 Labs/PageRank/sparse_web.png
107-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Complex1/log_riemann_surface.pdf
108-
c92d59c9dbd73fe462cf78ca40c2fbeda0f98db7 Labs/Complex1/example.png
109-
4634c65fd79d2760818602652c959c4380119dd1 Python/scipyoptimize/ManyMinima.pdf
110-
f2f5fdf762489b5d39b54c2bd9b179bfa37bf392 Labs/AnisotropicDiffusion/baloons_resized_noisy.png
1+
Labs/Introduction/NumpyIntro/jacobi_small.pdf
2+
Labs/Introduction/PlottingIntro/3dplot.pdf
3+
Labs/Introduction/PlottingIntro/GrandCanyon.png
4+
Labs/Introduction/PlottingIntro/fancymesh.png
5+
Labs/Orphans/FiniteElement/tridiag.c
6+
Labs/Orphans/MultivariateDerivatives/Rosenbrock.pdf
7+
Labs/Orphans/RiemannSphere/mobius2.png
8+
Labs/Vol1B/Complex1/arctan_riemann_surface.pdf
9+
Labs/Vol1B/Complex1/poly_color_plot_imag.pdf
10+
Labs/Vol1B/Complex1/poly_color_plot_real.pdf
11+
Labs/Vol1B/Differentiation/Rosenbrock.pdf
12+
Labs/Vol1B/GMRES/LeastSquares.pdf
13+
Labs/Vol2B/scipyoptimize/ManyMinima.pdf
14+
Labs/Vol2B/scipyoptimize/Rosenbrock.pdf
15+
Labs/Vol3A/PandasII/plotting_demos.ipynb
16+
Labs/Vol3A/PandasIII/industry_return_data.csv
17+
Labs/Vol3B/Metropolis/samples.pdf
18+
Labs/Vol4A/AnisotropicDiffusion/baloons_resized_noisy.png

travis_post.py

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
import os
2-
import travis_common as tc
1+
# travis_post.py
2+
"""Make sure that each tex file produced a pdf file."""
3+
4+
from os.path import isfile
5+
from travis_common import raise_msg
36

47
def all_present(fatal=True):
58
try:
6-
assert os.path.isfile('Vol1.pdf')
7-
assert os.path.isfile('Vol2.pdf')
8-
assert os.path.isfile('Vol3.pdf')
9-
assert os.path.isfile('Vol4.pdf')
10-
assert os.path.isfile('ExtraLabs.pdf')
9+
assert isfile("Vol1.pdf"), "Vol1.pdf is missing"
10+
assert isfile("Vol2.pdf"), "Vol2.pdf is missing"
11+
assert isfile("Vol3.pdf"), "Vol3.pdf is missing"
12+
assert isfile("Vol4.pdf"), "Vol4.pdf is missing"
13+
assert isfile("ExtraLabs.pdf"), "ExtraLabs.pdf is missing"
1114
except AssertionError as e:
12-
raise BuildError(e)
15+
raise_msg(e, fatal)
1316

14-
if __name__ == "__main":
15-
all_present()
17+
if __name__ == "__main__":
18+
all_present(True)

travis_pre.py

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
import os
2-
import sys
1+
# travis_pre.py
2+
"""Make sure that there are no unapproved files exceeding the max filesize."""
33

4-
import travis_common as tc
4+
from os import popen
5+
from travis_common import raise_msg
56

67

7-
# 500KB in bytes
8-
MAX_FILESIZE = 512000
8+
# 200KB in bytes
9+
MAX_FILESIZE = 204800
910

1011
def getOutput(cmd):
11-
return os.popen(cmd).read()
12+
return popen(cmd).read()
1213

1314
def find_big_files(fatal=True):
14-
#load the exception file
15-
exceptions = set()
16-
with open('travis_file_exceptions', 'rU') as e:
17-
for L in e:
18-
exceptions.add(tuple(map(str.strip, L.split())))
19-
20-
revisions = getOutput("git rev-list HEAD").split()
15+
16+
# Load the names of the files listed in the exceptions file.
17+
with open('travis_file_exceptions', 'rU') as ex:
18+
approved_files = {name for name in ex.read().split('\n') if name != ""}
19+
20+
# Get the objects in the tree at the most recent commit.
21+
this_commit = getOutput("git rev-list HEAD").split()[0]
22+
tree = getOutput("git ls-tree -rlz {}".format(this_commit)).split("\0")
23+
24+
# Check that the objects in the tree are not too big.
2125
violations = set()
22-
for r in revisions:
23-
tree = getOutput("git ls-tree -rlz {}".format(r)).split("\0")
24-
for obj in tree:
25-
try:
26-
data = obj.split()
27-
commit, size, name = data[2], int(data[3]), data[4]
28-
if (commit, name) not in exceptions and size > MAX_FILESIZE:
29-
violations.add((size, commit, name))
30-
except (IndexError, ValueError):
31-
continue
26+
for obj in tree:
27+
try:
28+
data = obj.split()
29+
size, name = int(data[3]), data[4]
30+
if name not in approved_files and size > MAX_FILESIZE:
31+
violations.add((name, size))
32+
except (IndexError, ValueError):
33+
continue
3234

3335
if violations:
34-
for v in sorted(violations, reverse=True):
35-
print "{} {} {}".format(*v)
36-
tc.raise_msg("Large files present", fatal=fatal, category=tc.BuildWarning)
37-
36+
files = "\n".join(sorted(["\t{:.<50}{:.>20} bytes".format(*v)
37+
for v in violations]))
38+
raise_msg("Large files present:\n{}\n".format(files), fatal=fatal)
3839

3940
if __name__ == "__main__":
40-
pass
41-
# find_big_files(fatal=False)
41+
find_big_files(True)

0 commit comments

Comments
 (0)