def __init__(self, target=None, files=[], dependencies=[], import_paths=[], output_style='expanded', sass_path=None, imported=[], source_map=None): self.source_map = source_map if self.source_map is None: self.source_map = output_style == 'expanded' if sass_path is None: sass_path = os_utils.which('sass') if sass_path is None: log.warn( 'Unable to find sass on this OS. Is it in PATH? Remember to run `npm install -g sass`!' ) super().__init__(target, files, dependencies, import_paths=import_paths, output_style=output_style, sass_path=sass_path, imported=imported)
def __init__(self, target=None, files=[], dependencies=[], j2coffee_opts=['-i', '2'], js2coffee_path=None): if js2coffee_path is None: js2coffee_path = os_utils.which('js2coffee') if js2coffee_path is None: log.warn('Unable to find coffee on this OS. Is it in PATH? Remember to run `gem install -g js2coffee`!') self.js2coffee_path = js2coffee_path super(JS2CoffeeBuildTarget, self).__init__(target, files, [os.path.abspath(__file__)]+dependencies) self.js2coffee_opts = j2coffee_opts
def __init__(self, target=None, files=[], dependencies=[], sass_convert_path=None): super(SCSSConvertTarget, self).__init__(target, files, dependencies) if sass_convert_path is None: sass_convert_path = os_utils.which('sass-convert') if sass_convert_path is None: log.warn( 'Unable to find sass-convert on this OS. Is it in PATH? Remember to run `gem install sass compass`!' ) self.sass_convert_path = sass_convert_path
def __init__(self, target=None, files=[], dependencies=[], coffee_opts=['--no-header','-bc'], coffee_executable=None, make_map=False, coffee_concat_executable=None): if coffee_executable is None: coffee_executable = os_utils.which('coffee') if coffee_executable is None: log.warn('Unable to find coffee on this OS. Is it in PATH? Remember to run `gem install -g coffee-script`!') if coffee_concat_executable is None: coffee_concat_executable = os_utils.which('coffee-concat') if coffee_concat_executable is None: log.warn('Unable to find coffee-concat on this OS. Is it in PATH? Remember to run `yarn global add coffee-concat`!') self.coffee_executable = coffee_executable self.coffee_concat_executable = coffee_concat_executable if make_map: coffee_opts += ['-M'] super(CoffeeBuildTarget, self).__init__(target, files, dependencies) self.coffee_opts=coffee_opts
def __init__(self, target, source, dependencies=[], svgo_opts=['-q'], svgo_executable=None): self.source = source self.svgo_opts = svgo_opts self.svgo_cmd = os_utils.which('svgo') if svgo_executable is not None: self.svgo_cmd = svgo_executable if self.svgo_cmd is None: log.warn( 'Unable to find svgo on this OS. Is it in PATH? Remember to run `npm install -g svgo`!' ) super(MinifySVGTarget, self).__init__(target, dependencies=dependencies, files=[self.source, os.path.abspath(__file__)])
def __init__(self, target=None, files=[], dependencies=[], compass=False, import_paths=[], output_style='compact', sass_path=None, imported=[]): if sass_path is None: sass_path = os_utils.which('sass') if sass_path is None: log.warn( 'Unable to find sass on this OS. Is it in PATH? Remember to run `gem install sass compass`!' ) super().__init__(target, files, dependencies, import_paths=import_paths, output_style=output_style, sass_path=sass_path, imported=imported) self.compass = compass
def build(self): gitmodules = {} with open(self.gitmodulesfile, 'r') as tomlf: smid = None for line in tomlf: line = line.strip() m = REG_SUBMODULE_SECTION.match(line) if m is not None: smid = m.group(1).strip() gitmodules[smid] = {} if '=' in line: k, v = line.split('=', 2) gitmodules[smid][k.strip()] = v.strip() gitconfig = {} with open(self.gitconfigfile, 'r') as tomlf: smid = None for line in tomlf: line = line.strip() #print(line) m = REG_SUBMODULE_SECTION.match(line) if m is not None: smid = m.group(1).strip() gitconfig[smid] = {} if smid is not None and '=' in line: #print(line) k, v = line.split('=', 2) gitconfig[smid][k.strip()] = v.strip() ''' with open(self.gitmodulesfile + '.yml', 'w') as f: yaml.dump(gitmodules, f, default_flow_style=False) with open('.gitconfig.yml', 'w') as f: yaml.dump(gitconfig, f, default_flow_style=False) ''' for repoID, repoconf in gitconfig.items(): if repoID not in gitmodules.keys(): with log.warn('Submodule %s is present in .git/config but not .gitmodules!', repoID): pathspec = repoconf.get('path', repoID) path = os.path.abspath(pathspec) tag = repoconf.get('tag', None) branch = repoconf.get('branch', 'HEAD' if tag is None else None) log.info('path = %s', pathspec) for repoID, repoconf in gitmodules.items(): if repoID not in gitconfig.keys(): with log.warn('Submodule %s is present in .gitmodules but not .git/config!', repoID): pathspec = repoconf.get('path', repoID) path = os.path.abspath(pathspec) tag = repoconf.get('tag', None) branch = repoconf.get('branch', 'HEAD' if tag is None else None) opts = [] if branch != 'HEAD': opts += ['-b', branch] log.info('path = %s', pathspec) if os.path.isdir(path): log.warn('Removing existing %s directory.', path) shutil.rmtree(path) cmd = ['git', 'submodule', 'add']+opts+['-f', '--name', repoID, '--', repoconf.get('url'), pathspec] os_utils.cmd(cmd, critical=True, echo=self.should_echo_commands(), show_output=True) #log.error('Would exec: %s', ' '.join(cmd)) for repoID, repoconf in gitmodules.items(): with log.info('Checking %s...', repoID): pathspec = repoconf.get('path', repoID) path = os.path.abspath(pathspec) tag = repoconf.get('tag', None) branch = repoconf.get('branch', 'HEAD' if tag is None else None) if os.path.isdir(path): desired_commit = '' cmdline = ['git', 'ls-tree', Git.GetBranch(), pathspec] stdout, stderr = os_utils.cmd_output(cmdline, echo=self.should_echo_commands(), critical=True) skip_this = False for line in (stdout+stderr).decode('utf-8').splitlines(): if line.startswith('error:') or line.startswith('fatal:'): log.critical(line) raise error.SubprocessThrewError(cmdline, line) line,repoID = line.strip().split('\t') _, _, desired_commit = line.split(' ') if not skip_this: with os_utils.Chdir(path, quiet=not self.should_echo_commands()): cur_commit = Git.GetCommit(short=False, quiet=not self.should_echo_commands()) #log.info(desired_commit) #log.info(cur_commit) if cur_commit == desired_commit: log.info('Commits are synced, skipping.') continue repo = GitRepository(path, origin_uri=repoconf['url'], submodule=True) if repo.CheckForUpdates(branch=branch, quiet=False): if os.path.isdir(path): os_utils.cmd(['git', 'submodule', 'sync', '--', pathspec], critical=True, echo=self.should_echo_commands(), show_output=True) os_utils.cmd(['git', 'submodule', 'update', '--init', '--recursive', pathspec], critical=True, echo=self.should_echo_commands(), show_output=True)
cmake.setFlag('CMAKE_INSTALL_PREFIX', os.path.join(script_dir, 'build', 'zlib')) # This LOOKS wrong but it's actually fine. cmake.generator = 'NMake Makefiles' cmake.run(CMAKE=EXECUTABLES['cmake']) cmake.build(target='install', CMAKE=EXECUTABLES['cmake']) """ winopenssl_dir = os.path.join(script_dir, "build", "win{}openssl".format(nbits)) libeay = "libeay32MD.lib" ssleay = "ssleay32MD.lib" libeay_path = os.path.join(winopenssl_dir, "lib", "VC", "static", libeay) ssleay_path = os.path.join(winopenssl_dir, "lib", "VC", "static", ssleay) with log.info("Installing Win{}OpenSSL...".format(nbits)): if not args.rebuild_all and os.path.isfile(libeay_path) and os.path.isfile(ssleay_path): log.info("Skipping; Both libeay and ssleay are present.") else: log.warn("*" * 30) log.warn( "Because of stuff outside of my control, you will get a UAC prompt (probably) and a warning about command prompts." ) log.warn('1. Hit "Yes" on the UAC prompt (assuming you get one).') log.warn('2. Press "OK" on the warning about command prompts.') log.warn("*" * 30) os_utils.cmd( [ os.path.join(script_dir, "download", prerequisites["win{}openssl".format(nbits)]["filename"]), "/VERYSILENT", "/DIR={}".format(winopenssl_dir), ], echo=True, critical=True, show_output=False,