mirror of https://github.com/dirtbags/moth.git
change category.py loading to deal with nutty cwd() issues and encourage on-demand computation
This commit is contained in:
parent
846643dcb0
commit
9266adab9a
|
@ -112,7 +112,7 @@ class Puzzle:
|
|||
|
||||
def read_directory(self, path):
|
||||
try:
|
||||
fn = os.path.join(path, "puzzle.py")
|
||||
fn = os.path.abspath(os.path.join(path, "puzzle.py"))
|
||||
loader = importlib.machinery.SourceFileLoader('puzzle_mod', fn)
|
||||
puzzle_mod = loader.load_module()
|
||||
except FileNotFoundError:
|
||||
|
@ -260,9 +260,10 @@ class Category:
|
|||
|
||||
if os.path.exists(os.path.join(path, 'category.py')):
|
||||
with pushd(path):
|
||||
loader = importlib.machinery.SourceFileLoader('catmod', 'category.py')
|
||||
fn = os.path.abspath('category.py')
|
||||
loader = importlib.machinery.SourceFileLoader('category', fn)
|
||||
self.catmod = loader.load_module()
|
||||
self.pointvals.extend(self.catmod.points)
|
||||
self.pointvals.extend(self.catmod.pointvals())
|
||||
else:
|
||||
for fpath in glob.glob(os.path.join(path, "[0-9]*")):
|
||||
pn = os.path.basename(fpath)
|
||||
|
|
Loading…
Reference in New Issue