def build(self): sourcefilerel, reloutfile, absoutfile = self.calcFilename() sourcefilerel = sourcefilerel.replace(os.sep, '/') outfile = reloutfile.replace(os.sep, '/') manifest_data = {sourcefilerel: outfile} if os.path.isfile(self.manifest): with open(self.manifest, 'r') as f: manifest_data = json.load(f) if sourcefilerel in manifest_data.keys(): oldfilename = os.path.normpath( os.path.join(self.destdir, manifest_data[sourcefilerel])) #log.info(oldfilename) #log.info(absoutfile) if oldfilename != absoutfile: self.removeFile(oldfilename) os_utils.ensureDirExists(os.path.dirname(absoutfile), noisy=True) os_utils.single_copy(self.source, absoutfile, verbose=False) manifest_data[sourcefilerel] = outfile os_utils.ensureDirExists(os.path.dirname(self.manifest), noisy=True) #print(self.manifest) with open(self.manifest, 'w') as f: json.dump(manifest_data, f, indent=2) self.touch(absoutfile) self.touch(self.target)
def build(self): os_utils.ensureDirExists(os.path.dirname(self.target), noisy=False) os_utils.single_copy(self.files[0], self.target, verbose=False, as_file=True) self.touch(self.target)
def build(self): os_utils.ensureDirExists(os.path.dirname(self.destination), noisy=True) os_utils.single_copy(self.source, self.intermediate_filename, verbose=True) os_utils.cmd([self.webify, self.intermediate_filename], echo=True, critical=True)
def Install(self): if "manual-install" in self.build_cfg: for pattern, destination in self.build_cfg.get("manual-install", {}).items(): installbasedir = os.path.basename(pattern) pattern = os.path.dirname(pattern) for installfilename in os.listdir(os.path.join(self.build_dir)): if fnmatch.fnmatch(installfilename, pattern): os_utils.single_copy(installfilename, destination, verbose=True)
def _cmd_collect(args=None): allpools = {} for pooldirname in os.listdir('lobbyscreens'): pooldir = os.path.join('lobbyscreens', pooldirname) data = None datafile = os.path.join(pooldir, '__POOL__.yml') if os.path.isfile(datafile): with open(datafile, 'r') as f: data = yaml.safe_load(f) if data is None: continue pool = Pool() pool.ID = pooldirname pool.deserialize(data) poolfilesdir = os.path.join(pooldir, 'files') for imagebasename in os.listdir(poolfilesdir): basename, ext = os.path.splitext(imagebasename) #print(basename, ext) if ext not in ('.jpg', '.png', '.gif', '.svg', '.webm', '.webp', '.mp4', '.ogv'): #print(' SKIPPED') continue anim = Animation() anim.ID = basename data = None filedatapath = os.path.join(poolfilesdir, basename+'.yml') if os.path.isfile(filedatapath): with open(filedatapath, 'r') as f: data = yaml.safe_load(f) filedatapath = os.path.join(poolfilesdir, basename+'.toml') if os.path.isfile(filedatapath): with open(filedatapath, 'r') as f: data = toml.load(f) filedatapath = os.path.join(poolfilesdir, basename+'.json') if os.path.isfile(filedatapath): with open(filedatapath, 'r') as f: data = json.load(f) if data is not None: anim.deserialize(data) anim.url = imagebasename fullpath = os.path.join(poolfilesdir, imagebasename) destfile = os.path.join('htdocs', 'img', 'lobby', pool.ID, anim.url) os_utils.ensureDirExists(os.path.dirname(destfile), noisy=False) os_utils.single_copy(fullpath, destfile, as_file=True, noisy=False) pool.add(anim) with open(os.path.join(pooldir, 'parsed.yml'), 'w') as f: yaml.dump(pool.serialize(suppress_id=True), f, default_flow_style=False) log.info('Found pool %r: %d animations', pool.ID, len(pool.animations)) allpools[pool.ID] = pool.serialize() os_utils.ensureDirExists('data') with open('data/lobby.json', 'w') as f: json.dump(allpools, f, indent=2)
def build(self): os_utils.ensureDirExists(os.path.dirname(self.cached_dl)) http.DownloadFile(self.url, self.cached_dl, log_after=True, print_status=True, log_before=True) os_utils.ensureDirExists(os.path.dirname(self.target)) os_utils.single_copy(self.cached_dl, self.target, as_file=True, verbose=True) if not self.cache: os.remove(self.cached_dl)
def _cmd_set(args=None): pooldir = os.path.join('lobbyscreens', args.poolID) data = {} data = None datafile = os.path.join(pooldir, '__POOL__.yml') if os.path.isfile(datafile): with open(datafile, 'r') as f: data = yaml.safe_load(f) readfrom = f.name if data is None: log.critical('Could not find __POOL__.yml') sys.exit(1) pool = Pool() pool.ID = args.poolID pool.deserialize(data) poolfilesdir = os.path.join(pooldir, 'files') if args.animID in pool.animationsByID.keys(): anim = pool.animationsByID[args.animID] if args.set_filename is not None: anim.filename = args.set_filename else: anim = Animation() anim.ID = args.animID anim.filename = args.set_filename or f'{args.animID}.gif' pool.animationsByID[args.animID] = anim if args.override_playlist is not None: anim.overridePlaylist = args.override_playlist for script in args.add_scripts: anim.scripts += [script] for script in args.rm_scripts: anim.scripts.remove(script) if args.clear_scripts: anim.scripts = [] try: with open('__POOL__.tmp.yml', 'w') as f: yaml.dump(pool.serialize(), f, default_flow_style=False) finally: os.remove(readfrom) os_utils.single_copy('__POOL__.tmp.yml', '__POOL__.yml') os.remove('__POOL__.tmp.yml')
critical=True, ) cpp = WindowsCCompiler("libudis86.lib") cpp.files = [ "libudis86/decode.c", "libudis86/itab.c", "libudis86/syn.c", "libudis86/syn-att.c", "libudis86/syn-intel.c", "libudis86/udis86.c", ] cpp.compiler = ENV.which("cl") cpp.linker = ENV.which("link") cpp.compile() os_utils.single_copy(os.path.join(udis_dir, "libudis86.lib"), libdir) qt5_dir = os.path.join(script_dir, "build", "qt5") qt5git_dir = os.path.join(script_dir, "build", "qt5-git") with log.info("Building Qt5..."): webkit_env = None ENV.prependTo("PATH", os.path.join(qt5_dir, "bin")) if (args.rebuild_all or "qt" in args.rebuild) and filesAllExist( [os.path.join(qt5_dir, "translations", "qtdeclarative_uk.qm")] ): log.info("Skipping; Needed files exist.") else: with os_utils.Chdir(qt5git_dir): skip_list = [ "qtactiveqt", "qtandroidextras",