def load_conf(self): emake_dir = MakeEnv().get_emake_dir() try: with eutils.eopen("make.conf", "r", encoding="utf-8") as fp: self.conf = json.load(fp) except Exception: conf_fname = "%s/templates/make.%s.conf" % (emake_dir, eutils.get_platform()) with eutils.eopen(conf_fname, "r", encoding="utf-8") as fp: self.conf = json.load(fp) obj_conf_fname = "%s/templates/obj.%s.mk" % (emake_dir, eutils.get_platform()) with eutils.eopen(obj_conf_fname, "r", encoding="utf-8") as fp: self.obj_conf = fp.read()
def load_conf(self): emake_dir = MakeEnv().get_emake_dir() try: with eutils.eopen('make.conf', 'r', encoding='utf-8') as fp: self.conf = json.load(fp) except Exception: conf_fname = '%s/templates/make.%s.conf' % (emake_dir, eutils.get_platform()) with eutils.eopen(conf_fname, 'r', encoding='utf-8') as fp: self.conf = json.load(fp) obj_conf_fname = '%s/templates/obj.%s.mk' % (emake_dir, eutils.get_platform()) with eutils.eopen(obj_conf_fname, 'r', encoding='utf-8') as fp: self.obj_conf = fp.read()
def gen_sell(self): pf = eutils.get_platform() functor = getattr(self, '_gen_shell_%s' % pf, None) if not functor: raise Exception('No shell functor with platform "%s"' % pf) conf, obj_conf, static, shared = self._load_make_conf() mk_dict = functor(conf, obj_conf, static, shared) self._gen_makefile(pf, mk_dict, static, shared)
def main(): option = get_arguments() MakeEnv().set_env() MakeConf().load_conf() if option == 'remove': remove() else: mk = 'nmake' if eutils.get_platform() == 'windows' else 'make' fun = getattr(sys.modules['__main__'], option, None) os.chdir(MakeEnv().get_build_path()) fun and fun(mk) os.chdir('..')