mirror of https://github.com/dirtbags/moth.git
more versatile logging, chdir into puzzle directory when loading category.py
This commit is contained in:
parent
c12ee422c4
commit
e749dcb9ee
|
@ -72,9 +72,10 @@ class Puzzle:
|
|||
self.randseed = category_seed * self.points
|
||||
self.rand = random.Random(self.randseed)
|
||||
|
||||
def log(self, msg):
|
||||
def log(self, *vals):
|
||||
"""Add a new log message to this puzzle."""
|
||||
self.logs.append(str(msg))
|
||||
msg = ' '.join(str(v) for v in vals)
|
||||
self.logs.append(msg)
|
||||
|
||||
def read_stream(self, stream):
|
||||
header = True
|
||||
|
@ -258,11 +259,10 @@ class Category:
|
|||
self.catmod = None
|
||||
|
||||
if os.path.exists(os.path.join(path, 'category.py')):
|
||||
self.catmod = importlib.machinery.SourceFileLoader(
|
||||
'catmod',
|
||||
os.path.join(path, 'category.py')).load_module()
|
||||
self.pointvals.extend(self.catmod.points)
|
||||
self.pointvals = self.catmod.points[:]
|
||||
with pushd(path):
|
||||
loader = importlib.machinery.SourceFileLoader('catmod', 'category.py')
|
||||
self.catmod = loader.load_module()
|
||||
self.pointvals.extend(self.catmod.points)
|
||||
else:
|
||||
for fpath in glob.glob(os.path.join(path, "[0-9]*")):
|
||||
pn = os.path.basename(fpath)
|
||||
|
|
Loading…
Reference in New Issue