summaryrefslogtreecommitdiff
path: root/pack
blob: 4708cff17d3120c06bb19dc5b4bf55a9fe85c283 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python
import base64, bz2
import os

def split (data, count):
  ret = ""
  while len (data) > count:
    ret += data[:count] + "\n"
    data = data[count:]
  ret += data
  return ret

base = os.path.dirname (os.path.abspath (__file__))

post = open (os.path.join (base, "raw_post")).read ()
post = "\n".join ([line for line in post.split ("\n") if line.strip ()])
produce = open (os.path.join (base, "raw_produce")).read ()
post = post.replace ("PRODUCE_SCRIPT",
                     split (base64.b64encode (bz2.compress (produce)), 70))
open (os.path.join (base, "post"), "w").write (post)
os.chmod (os.path.join (base, "post"), 0755)