Add note to top of generated ini files

This commit is contained in:
Keith Mitchell
2012-03-16 15:48:38 -07:00
parent 14f84678ea
commit abe385cc74
3 changed files with 25 additions and 0 deletions

View File

@@ -73,11 +73,16 @@ clean_i18n:
UPDATE_FILES := $(wildcard *.update)
INIFILES := $(UPDATE_FILES:.update=.ini)
.PHONY: clean_ini
ini: $(INIFILES)
$(INIFILES): %.ini: %.update
./updateini.py example.ini $< > $@ || rm $@
clean_ini:
rm $(INIFILES)
#################### Static Files
STATIC_DIR := r2/public/static

View File

@@ -1,3 +1,13 @@
# DO NOT EDIT THIS FILE
# This is a base template. To apply changes to your
# reddit instance, create a "myreddit.update" config
# file, then run 'make ini'. 'make ini' will combine
# this template with the myreddit.update file and create a
# 'myreddit.ini'. ('myreddit.update' is just an example;
# any name will do - e.g., 'foo.update' will create
# 'foo.ini')
#
# r2 - Pylons development environment configuration
#

View File

@@ -4,6 +4,15 @@ from ConfigParser import MissingSectionHeaderError
from StringIO import StringIO
import sys
HEADER = '''
# YOU DO NOT NEED TO EDIT THIS FILE
# This is a generated file. To update the configuration,
# edit the *.update file of the same name, and then
# run 'make ini'
# Configuration settings in the *.update file will override
# or be added to the base 'example.ini' file.
'''
def main(source_ini, update_ini):
parser = Parser()
# By default, the parser is case insensitve and rewrites config
@@ -24,6 +33,7 @@ def main(source_ini, update_ini):
except MissingSectionHeaderError:
updates = "[DEFAULT]\n" + updates
parser.readfp(StringIO(updates))
print HEADER
parser.write(sys.stdout)
if __name__ == '__main__':