Files
reddit/r2/updateini.py
ketralnis 7fff900bbe February 2011 Merge
* Upgrade discount to 1.6.8
* Start reading Votes, Saves, and Hides from Cassandra (while still dual-writing all three)
* Some XSS fixes
* Significant Gold buying and gifting improvements
  - Move /api/ipn to /ipn
* Allow non-US countries to buy sponsored links
* Increase embed.ly scope
* redd.it support
* Allow postgres port number to be specified in ini file (this changes the format of the .ini file)
* Upgrade Cassandra to 0.7
  - Change g.urlcache to LinksByURL
  - Translate storage-conf.xml to cassandra.yaml
  - TTL support (and enable on Hides)
  - Move permacache keyspace to inside reddit keyspace
* The stalecache: a local memcached that contains slightly old information to speed up some lookups
* Switch to patched Paste that is hopefully download.gz-proof
* Don't store votes on things > 30 days old
* Many many bugfixes/small features
2011-02-23 12:00:44 -08:00

36 lines
841 B
Python
Executable File

#!/usr/bin/env python
import re, sys
line_rx = re.compile('\A([-_a-zA-Z0-9 ]*[-_a-zA-Z0-9]+)\s*=\s*(.*)')
def parse_line(line):
m = line_rx.match(line)
if m:
return m.groups()
def main(source_ini, update_ini):
#read in update file
update_parts = {}
for line in open(update_ini):
m = parse_line(line)
if m:
update_parts[m[0]] = m[1]
#pass through main file
m = None
for line in open(source_ini):
line = line.strip()
m = parse_line(line)
if m and update_parts.has_key(m[0]):
line = '%s = %s' % (m[0], update_parts[m[0]])
print line
if __name__ == '__main__':
args = sys.argv
if len(args) != 3:
print 'usage: iniupdate.py [source] [update]'
sys.exit(1)
else:
main(sys.argv[1], sys.argv[2])