forked from jma127/pcu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.py
20 lines (17 loc) · 790 Bytes
/
make.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os
import globals
import helper
import log
import pattern
import settings
# Problem Creation Engine
def make ():
print 'Creating {} source file for problem {}'.format(settings.langexts[globals.getext()], globals.getprob())
template = helper.read(os.path.join(globals.templatedir, globals.getmode() + '.' + globals.getext()))
if template is None:
print '{}.{} template file not found (add it to templates folder)'.format(globals.getmode(), globals.getext())
return False
helper.write(os.path.join(globals.working, globals.getsrc()), pattern.convert(template))
print 'Source file created: ' + globals.getsrc()
log.addmsg('Creating {} source file for problem {}'.format(settings.langexts[globals.getext()], globals.getprob()))
return True