0

Added a new config file parser.

The new config file parser has an interface that's nearly identical to
the OptionParser of optparse.

Below is a sample settings.py config file:

$ cat settings.py
import multiprocessing

if 'rendermode' not in locals():
    rendermode="lighting"

cachedir = "cache.%s.cachedir" % rendermode

procs = multiprocessing.cpu_count() - 1
This commit is contained in:
Andrew Chin
2010-12-31 00:53:57 -05:00
parent fe8cd07c51
commit e989e97c5e
3 changed files with 150 additions and 11 deletions

View File

@@ -103,12 +103,12 @@ class WorldRenderer(object):
files to update. If it includes a trailing newline, it is stripped, so you
can pass in file handles just fine.
"""
def __init__(self, worlddir, cachedir, chunklist=None, lighting=False, night=False, spawn=False, useBiomeData=False):
def __init__(self, worlddir, cachedir, chunklist=None, rendermode="normal", useBiomeData=False):
self.worlddir = worlddir
self.caves = False
self.lighting = lighting or night or spawn
self.night = night or spawn
self.spawn = spawn
self.lighting = rendermode in ("lighting","night","spawn")
self.night = rendermode in ("night","spawn")
self.spawn = rendermode in ("spawn",)
self.cachedir = cachedir
self.useBiomeData = useBiomeData