strict linting template

This commit is contained in:
Vladimir Mandic
2023-04-14 21:27:29 -04:00
parent b28b7c7a98
commit bf949a5307
8 changed files with 258 additions and 90 deletions
+9 -9
View File
@@ -37,11 +37,11 @@ def run(command, desc=None, errdesc=None, custom_env=None, live=False):
if desc is not None:
print(desc)
if live:
result = subprocess.run(command, shell=True, env=os.environ if custom_env is None else custom_env)
result = subprocess.run(command, check=False, shell=True, env=os.environ if custom_env is None else custom_env)
if result.returncode != 0:
raise RuntimeError(f"""{errdesc or 'Error running command'} Command: {command} Error code: {result.returncode}""")
return ''
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, env=os.environ if custom_env is None else custom_env)
result = subprocess.run(command, stdout=subprocess.PIPE, check=False, stderr=subprocess.PIPE, shell=True, env=os.environ if custom_env is None else custom_env)
if result.returncode != 0:
raise RuntimeError(f"""{errdesc or 'Error running command'}: {command} code: {result.returncode}
{result.stdout.decode(encoding="utf8", errors="ignore") if len(result.stdout)>0 else ''}
@@ -51,7 +51,7 @@ def run(command, desc=None, errdesc=None, custom_env=None, live=False):
def check_run(command):
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
result = subprocess.run(command, check=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
return result.returncode == 0
@@ -67,21 +67,21 @@ def run_python(code, desc=None, errdesc=None):
return run(f'"{sys.executable}" -c "{code}"', desc, errdesc)
def run_pip(args, desc=None):
def run_pip(pkg, desc=None):
index_url_line = f' --index-url {index_url}' if index_url != '' else ''
return run(f'"{sys.executable}" -m pip {args} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}")
return run(f'"{sys.executable}" -m pip {pkg} --prefer-binary{index_url_line}', desc=f"Installing {desc}", errdesc=f"Couldn't install {desc}")
def check_run_python(code):
return check_run(f'"{sys.executable}" -c "{code}"')
def git_clone(url, dir, name, commithash=None):
setup.clone(url, dir, commithash)
def git_clone(url, tgt, _name, commithash=None):
setup.clone(url, tgt, commithash)
def run_extension_installer(dir):
setup.run_extension_installer(dir)
def run_extension_installer(ext_dir):
setup.run_extension_installer(ext_dir)
if __name__ == "__main__":