def gen_makefile(platform="linux", target="a.out", outdir="build", sources=[]): mname = sys.modules["__main__"] gen_obj = getattr(mname, "gen_{pt}_obj".format(pt=platform), gen_posix_obj) gen_make_obj = getattr(mname, "gen_{pt}_make_obj".format(pt=platform), gen_posix_make_obj) gen_includes = getattr(mname, "gen_{pt}_include".format(pt=platform), gen_posix_include) objs_list = [] make_objs_list = [] for s in sources: objstr = gen_obj(s) objs_list.append(objstr) make_objs_list.append(gen_make_obj(objstr, s)) make_dict = dict( outdir=outdir, target=target, objs="".join(objs_list).rstrip(), make_objs="".join(make_objs_list).rstrip(), includes=gen_includes(INC_DIRS), ) ext_dict = getattr(mname, "{pt}_MKEXT".format(pt=platform.upper()), None) if ext_dict: make_dict.update(ext_dict) makefile_temp = getattr(mname, "{pt}_MAKEFILE".format(pt=platform.upper()), POSIX_MAKEFILE) with do_open("Makefile", "w", encoding="utf-8") as fp: fp.write(makefile_temp.format(**make_dict))
def new_chat(platform, uname, msg, op): #open a new chat window path = os.path.abspath("messenger_client.py") if (platform.upper() == "WINDOWS"): lastindex = len(path) - path[::-1].index("\\") - 1 path = path[0:lastindex + 1] path = "new_chat.py" os.system("start /wait cmd /c python %s %d %s %s" % (path, op, uname, msg)) elif (platform.upper() == "DARWIN"): #MACOS lastindex = len(path) - path[::-1].index("/") - 1 path = path[0:lastindex + 1] path = path + "new_chat.py" appscript.app('Terminal').do_script('python %s %d %s %s' % (path, op, uname, msg)) elif (platform.upper() == "LINUX"): lastindex = len(path) - path[::-1].index("/") - 1 path = path[0:lastindex + 1] path = path + "new_chat.py" subprocess.call([ 'gnome-terminal', '-x', 'python %s %d %s %s' % (path, op, uname, msg) ]) else: print_to_screen(1, bcolors.FAIL, "Your platform is not recognized, sorry!") return
def gen_makefile(platform='linux', target='a.out', outdir='build', sources=[]): mname = sys.modules['__main__'] gen_obj = getattr(mname, 'gen_{pt}_obj'.format(pt=platform), gen_posix_obj) gen_make_obj = getattr(mname, 'gen_{pt}_make_obj'.format(pt=platform), gen_posix_make_obj) gen_includes = getattr(mname, 'gen_{pt}_include'.format(pt=platform), gen_posix_include) objs_list = [] make_objs_list = [] for s in sources: objstr = gen_obj(s) objs_list.append(objstr) make_objs_list.append(gen_make_obj(objstr, s)) make_dict = dict(outdir=outdir, target=target, objs=''.join(objs_list).rstrip(), make_objs=''.join(make_objs_list).rstrip(), includes=gen_includes(INC_DIRS)) ext_dict = getattr(mname, '{pt}_MKEXT'.format(pt=platform.upper()), None) if ext_dict: make_dict.update(ext_dict) makefile_temp = getattr(mname, '{pt}_MAKEFILE'.format(pt=platform.upper()), POSIX_MAKEFILE) with do_open('Makefile', 'w', encoding='utf-8') as fp: fp.write(makefile_temp.format(**make_dict))
def gen_makefile(platform='linux', target='a.out', outdir='build', sources=[]): mname = sys.modules['__main__'] gen_obj = getattr(mname, 'gen_{pt}_obj'.format(pt=platform), gen_posix_obj) gen_make_obj = getattr(mname, 'gen_{pt}_make_obj'.format(pt=platform), gen_posix_make_obj) objs_list = [] make_objs_list = [] for s in sources: objstr = gen_obj(s) objs_list.append(objstr) make_objs_list.append(gen_make_obj(objstr, s)) make_dict = dict( outdir = outdir, target = target, objs = ''.join(objs_list)[:-1], make_objs = ''.join(make_objs_list)[:-1] ) ext_dict = getattr(mname, '{pt}_MKDIR'.format(pt=platform.upper()), None) if ext_dict: make_dict.update(ext_dict) makefile_temp = getattr(mname, '{pt}_MAKEFILE'.format(pt=platform.upper()), 'POSIX_MAKEFILE') with do_open('Makefile', 'w', encoding='utf-8') as fp: fp.write(makefile_temp.format(**make_dict))
def _create_makefile(self, platform): Makefile.clear() Makefile.platform = Workspace.Platforms[platform]() Makefile.set('PLATFORM', platform) Makefile.set('ARCH', self._args.arch) Makefile.set('STD', self._args.std) Makefile.set('DEVELOPMENT_TEAM', self._args.xcteam) Makefile.set('PACKAGE', self._args.package) Makefile.set('PLATFORM_SDK', self._args.platformSdk) Makefile.initialize( Target.Project, self._name, platform, lambda fileName: execfile( fileName, Globals.create(Makefile, platform, Makefile.project)) ) Makefile.project.define('DC_PLATFORM_' + platform.upper()) Makefile.project.define('DC_PLATFORM=' + platform) self._parse_parameters()
def platform_family(platform): for f in (System.Family.Linux, System.Family.Win, System.Family.MacOSX): if platform.upper().startswith(f): return f raise RuntimeError('No known family for platform %s' % platform)