The unified diff between revisions [cd79ac7e..] and [a53ace40..] is displayed below. It can also be downloaded as a raw diff.
#
#
# add_file "buildmt.sh"
# content [a1e23c7e44ae9b5fee1b58641792ad8d711fef53]
#
# patch "potd/potd.py"
# from [f8f8f7c30525f3f7da9af77bf1b6827a108141c9]
# to [624277921b79af3ff71f6713d69d7454ea3e30e1]
#
# set "buildmt.sh"
# attr "mtn:execute"
# value "true"
#
============================================================
--- buildmt.sh a1e23c7e44ae9b5fee1b58641792ad8d711fef53
+++ buildmt.sh a1e23c7e44ae9b5fee1b58641792ad8d711fef53
@@ -0,0 +1,29 @@
+#!/bin/zsh
+
+# warning.. this is evil
+# heavily rips off graydon's build examples from monotone's INSTALL file
+
+BOOSTVER="boost_1_33_1"
+BOOST="$HOME/mtn/support/$BOOSTVER/"
+MONOTONE="$HOME/mtn/monotone/"
+BOOSTDEST="$MONOTONE/$BOOSTVER/"
+
+cd "$BOOST" || exit 1
+mkdir -p "$BOOSTDEST"
+mkdir -p "$BOOSTDEST"/libs
+
+(cd tools/build/jam_src && ./build.sh)
+BJAM=`find tools/build/jam_src/ -name bjam -a -type f`
+"$BJAM" "-sBUILD=release <threading>single <optimization>speed <runtime-link>static"
+for i in `find bin -type d -a -name \*.a`; do
+ for j in `find $i -type f -a -name \*.a`; do
+ cp "$j" "$BOOSTDEST"/libs/`basename "$i"`
+ done
+done
+
+cd "$MONOTONE" &&
+AUTOMAKE=automake-1.9 ACLOCAL=aclocal-1.9 autoreconf --install &&
+./configure --prefix=/opt/mtn \
+ CC="ccache gcc" CXX="ccache g++" CFLAGS="-Os -ggdb" CXXFLAGS="-I$BOOST -Os -ggdb" LDFLAGS="-L$BOOSTDEST/libs" &&
+make
+
============================================================
--- potd/potd.py f8f8f7c30525f3f7da9af77bf1b6827a108141c9
+++ potd/potd.py 624277921b79af3ff71f6713d69d7454ea3e30e1
@@ -17,19 +17,19 @@ def cache_result():
def cache_result():
def decorate(f):
- def new_f(*args, **kwds):
- arg_hash = sha.new()
- arg_hash.update(pickle.dumps(args))
- arg_hash.update(pickle.dumps(kwds))
- cache_file = os.path.join(cache_path, urllib.quote(f.func_name) + '.' + arg_hash.hexdigest())
- try:
- return pickle.load(open(cache_file))
- except:
- rv = f(*args, **kwds)
- pickle.dump(rv, open(cache_file, 'w'))
- return rv
- new_f.func_name = f.func_name
- return new_f
+ def new_f(*args, **kwds):
+ arg_hash = sha.new()
+ arg_hash.update(pickle.dumps(args))
+ arg_hash.update(pickle.dumps(kwds))
+ cache_file = os.path.join(cache_path, urllib.quote(f.func_name) + '.' + arg_hash.hexdigest())
+ try:
+ return pickle.load(open(cache_file))
+ except:
+ rv = f(*args, **kwds)
+ pickle.dump(rv, open(cache_file, 'w'))
+ return rv
+ new_f.func_name = f.func_name
+ return new_f
return decorate
def retrieve_uri(uri):
@@ -42,37 +42,40 @@ def pictures_of_the_day():
def pictures_of_the_day():
rv = []
for line in retrieve_uri(picture_uri).readlines():
- m = re.match(r'^.*\"(/wiki/Image\:[^\"]+)\"', line)
- if m:
- rv.append("http://en.wikipedia.org" + m.groups()[0])
+ m = re.match(r'^.*\"(/wiki/Image\:[^\"]+)\"', line)
+ if m:
+ rv.append("http://en.wikipedia.org" + m.groups()[0])
return rv
@cache_result()
def get_image_uri(uri):
for line in retrieve_uri(uri).readlines():
- m = re.match(r'^.*a href="(http://upload.wikimedia.org/[^"]+)', line)
- if m:
- return m.groups()[0]
+ m = re.match(r'^.*a href="(http://upload.wikimedia.org/[^"]+)', line)
+ if m:
+ return m.groups()[0]
if __name__ == '__main__':
for uri in pictures_of_the_day():
- imguri = get_image_uri(uri)
- p = urlparse.urlparse(imguri)
- imgname = urlparse.urlparse(imguri)[2].split('/')[-1]
+ imguri = get_image_uri(uri)
+ if not imguri:
+ print "couldn't find image for picture:", uri
+ continue
+ p = urlparse.urlparse(imguri)
+ imgname = urlparse.urlparse(imguri)[2].split('/')[-1]
- tmp, out = map(lambda x: os.path.join(x, imgname),
- [tmp_path, image_path])
- if os.access(out, os.R_OK):
- continue
+ tmp, out = map(lambda x: os.path.join(x, imgname),
+ [tmp_path, image_path])
+ if os.access(out, os.R_OK):
+ continue
- fd_in, fd_out = retrieve_uri(imguri), open(tmp, 'w')
- while True:
- data = fd_in.read(8192)
- if data == '': break
- fd_out.write(data)
- sys.stdout.write('.')
- sys.stdout.flush()
- print ' done.'
- os.rename(tmp, out)
- time.sleep(5)
+ fd_in, fd_out = retrieve_uri(imguri), open(tmp, 'w')
+ while True:
+ data = fd_in.read(8192)
+ if data == '': break
+ fd_out.write(data)
+ sys.stdout.write('.')
+ sys.stdout.flush()
+ print ' done.'
+ os.rename(tmp, out)
+ time.sleep(5)