Renamed generators to backends.

pull/15/head
Jussi Pakkanen 12 years ago
parent 40012fad45
commit cf97f78de7
  1. 12
      backends.py
  2. 6
      meson.py

@ -49,7 +49,7 @@ def do_conf_file(src, dst, variables):
open(dst, 'w').writelines(result) open(dst, 'w').writelines(result)
class Generator(): class Backend():
def __init__(self, build, interp): def __init__(self, build, interp):
self.build = build self.build = build
self.environment = build.environment self.environment = build.environment
@ -152,10 +152,10 @@ class Generator():
outfile = os.path.join(outdir, cf.get_target_name()) outfile = os.path.join(outdir, cf.get_target_name())
do_conf_file(infile, outfile, self.interpreter.get_variables()) do_conf_file(infile, outfile, self.interpreter.get_variables())
class NinjaGenerator(Generator): class NinjaBackend(Backend):
def __init__(self, build, interp): def __init__(self, build, interp):
Generator.__init__(self, build, interp) Backend.__init__(self, build, interp)
self.ninja_filename = 'build.ninja' self.ninja_filename = 'build.ninja'
def generate(self): def generate(self):
@ -463,9 +463,9 @@ class NinjaGenerator(Generator):
ignore_missing = 'build %s: phony\n\n' % depstr ignore_missing = 'build %s: phony\n\n' % depstr
outfile.write(ignore_missing) outfile.write(ignore_missing)
class ShellGenerator(Generator): class ShellBackend(Backend):
def __init__(self, build, interp): def __init__(self, build, interp):
Generator.__init__(self, build, interp) Backend.__init__(self, build, interp)
self.build_filename = 'compile.sh' self.build_filename = 'compile.sh'
self.test_filename = 'run_tests.sh' self.test_filename = 'run_tests.sh'
self.install_filename = 'install.sh' self.install_filename = 'install.sh'
@ -716,5 +716,5 @@ if __name__ == '__main__':
os.chdir(os.path.split(__file__)[0]) os.chdir(os.path.split(__file__)[0])
envir = environment.Environment('.', 'work area') envir = environment.Environment('.', 'work area')
intpr = interpreter.Interpreter(code, envir) intpr = interpreter.Interpreter(code, envir)
g = ShellGenerator(intpr, envir) g = ShellBackend(intpr, envir)
g.generate() g.generate()

@ -18,7 +18,7 @@ from optparse import OptionParser
import sys, stat import sys, stat
import os.path import os.path
import environment, interpreter import environment, interpreter
import generators, build import backends, build
version = '0.1-research' version = '0.1-research'
@ -93,9 +93,9 @@ class MesonApp():
intr = interpreter.Interpreter(b) intr = interpreter.Interpreter(b)
intr.run() intr.run()
if options.generator == 'shell': if options.generator == 'shell':
g = generators.ShellGenerator(b, intr) g = backends.ShellBackend(b, intr)
elif options.generator == 'ninja': elif options.generator == 'ninja':
g = generators.NinjaGenerator(b, intr) g = backends.NinjaBackend(b, intr)
else: else:
raise RuntimeError('Unknown generator "%s".' % options.generator) raise RuntimeError('Unknown generator "%s".' % options.generator)
g.generate() g.generate()

Loading…
Cancel
Save