def pingChecker(): f = File('_logs/local/pingchecker.log', w='') p = shell('ping www.google.com') while True: line = p.readline() if len(line) == 0: log('pingchecker got EOF') f.append(f'({toc_str()})got EOF') break else: f.append(f'({toc_str()}){utf_decode(line)}')
def write_reqs(cls): File('environment.yml').write(shell('conda env export').all_output()) reqs_conda = spshell( f'{HOME}/miniconda3/bin/conda list -n {pwdf().name} -e' ).readlines_and_raise_if_err().filtered( lambda l: 'pypi' not in l and (not l.strip().startswith("#")) ) File('reqs_conda.txt').write('\n'.join(reqs_conda)) conda_prune(just_cache=True) good2go = conda_prune() return reqs_conda, good2go
def compile_coffeescript(cs) -> str: # '--map' # '--compile' # '--print' with Temp('temp.coffee', w=cs) as f: with Temp('temp.js', w='') as ff: p = shell([ '/usr/local/bin/coffee', '-b', '-o', ff.abspath, '--compile', f.abspath ]) p.interact() return ff.read()
def smallify(): err('dev') files = glob.glob(sys.argv[1] + "/**/*.png", recursive=True) i = 0 log('found ' + str(len(files)) + ' images') with Progress(len(files)) as prog: for f in files: p = shell(['convert', f, '-resize', '20x20', f], silent=True) p.interact() i = i + 1 prog.tick() log('resized ' + str(i) + ' images') sys.exit()
def py_deps(start, output): start = File(start).abspath output = File(output).abspath if not output.endswith('.svg'): output = output + '.svg' return shell( '/Users/matt/miniconda3/bin/python', '-m', 'pydeps', '-o', output, '-T', 'svg', # default '--noshow', # '--display','IntelliJ IDEA' # Verbosity stuff # '-vvv', # very verbose # '--show-deps', # '--show-raw-deps', # '--show-dot', # '--no-output', # '--show-cycles', # ' --noise-level INT', # '--max-bacon', '2', # default, '--max-bacon', '3', # default, '--pylib', # '--pylib-all', # '--include-missing', # --x PATTERN, --exclude PATTERN # --xx MODULE, --exclude-exact MODULE # --only MODULE_PATH '--cluster', '--min-cluster-size', '2', # DEFAULT '--max-cluster-size', '10', # DEFAULT # '--externals', #causes stuff to print but no svg # '--keep-target-cluster', # '--rmprefix PREFIX' # --reverse start ).interact()
def _shell(self, command): return shell(command)
def osascriptReturn(script): return shell("osascript", "-e", script).all_output()
def push_docs(): shell('git reset').interact() shell('git add docs').interact() shell('git commit docs -m "auto-gen docs"').interact() shell('git push').interact()