__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
#!/usr/bin/env python3
from __future__ import annotations
import argparse
import subprocess
import shutil
import sys
from pathlib import Path
import typing as T
def run(argsv: T.List[str]) -> int:
commands: T.List[T.List[str]] = [[]]
SEPARATOR = ';;;'
# Generate CMD parameters
parser = argparse.ArgumentParser(description='Wrapper for add_custom_command')
parser.add_argument('-d', '--directory', type=str, metavar='D', required=True, help='Working directory to cwd to')
parser.add_argument('-o', '--outputs', nargs='+', metavar='O', required=True, help='Expected output files')
parser.add_argument('-O', '--original-outputs', nargs='*', metavar='O', default=[], help='Output files expected by CMake')
parser.add_argument('commands', nargs=argparse.REMAINDER, help=f'A "{SEPARATOR}" separated list of commands')
# Parse
args = parser.parse_args(argsv)
directory = Path(args.directory)
dummy_target = None
if len(args.outputs) == 1 and len(args.original_outputs) == 0:
dummy_target = Path(args.outputs[0])
elif len(args.outputs) != len(args.original_outputs):
print('Length of output list and original output list differ')
return 1
for i in args.commands:
if i == SEPARATOR:
commands += [[]]
continue
i = i.replace('"', '') # Remove leftover quotes
commands[-1] += [i]
# Execute
for i in commands:
# Skip empty lists
if not i:
continue
cmd = []
stdout = None
stderr = None
capture_file = ''
for j in i:
if j in {'>', '>>'}:
stdout = subprocess.PIPE
continue
elif j in {'&>', '&>>'}:
stdout = subprocess.PIPE
stderr = subprocess.STDOUT
continue
if stdout is not None or stderr is not None:
capture_file += j
else:
cmd += [j]
try:
directory.mkdir(parents=True, exist_ok=True)
res = subprocess.run(cmd, stdout=stdout, stderr=stderr, cwd=str(directory), check=True)
if capture_file:
out_file = directory / capture_file
out_file.write_bytes(res.stdout)
except subprocess.CalledProcessError:
return 1
if dummy_target:
dummy_target.touch()
return 0
# Copy outputs
zipped_outputs = zip([Path(x) for x in args.outputs], [Path(x) for x in args.original_outputs])
for expected, generated in zipped_outputs:
do_copy = False
if not expected.exists():
if not generated.exists():
print('Unable to find generated file. This can cause the build to fail:')
print(generated)
do_copy = False
else:
do_copy = True
elif generated.exists():
if generated.stat().st_mtime > expected.stat().st_mtime:
do_copy = True
if do_copy:
if expected.exists():
expected.unlink()
shutil.copyfile(str(generated), str(expected))
return 0
if __name__ == '__main__':
sys.exit(run(sys.argv[1:]))
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| __init__.py | File | 303 B | 0644 |
|
| clangformat.py | File | 1.8 KB | 0644 |
|
| clangtidy.py | File | 1.02 KB | 0644 |
|
| cleantrees.py | File | 1004 B | 0644 |
|
| cmake_run_ctgt.py | File | 3.19 KB | 0644 |
|
| cmd_or_ps.ps1 | File | 510 B | 0644 |
|
| copy.py | File | 420 B | 0644 |
|
| coverage.py | File | 10.34 KB | 0644 |
|
| delwithsuffix.py | File | 664 B | 0644 |
|
| depfixer.py | File | 18.8 KB | 0644 |
|
| depscan.py | File | 8.07 KB | 0644 |
|
| dirchanger.py | File | 473 B | 0644 |
|
| env2mfile.py | File | 15.57 KB | 0644 |
|
| externalproject.py | File | 3.57 KB | 0644 |
|
| gettext.py | File | 3.37 KB | 0644 |
|
| gtkdochelper.py | File | 10.86 KB | 0644 |
|
| hotdochelper.py | File | 1.08 KB | 0644 |
|
| itstool.py | File | 2.55 KB | 0644 |
|
| meson_exe.py | File | 4.06 KB | 0644 |
|
| msgfmthelper.py | File | 937 B | 0644 |
|
| pycompile.py | File | 1.77 KB | 0644 |
|
| python_info.py | File | 4.3 KB | 0644 |
|
| regen_checker.py | File | 2.1 KB | 0644 |
|
| run_tool.py | File | 1.95 KB | 0644 |
|
| scanbuild.py | File | 2.04 KB | 0644 |
|
| symbolextractor.py | File | 12.45 KB | 0644 |
|
| tags.py | File | 1.21 KB | 0644 |
|
| test_loaded_modules.py | File | 343 B | 0644 |
|
| uninstall.py | File | 1.14 KB | 0644 |
|
| vcstagger.py | File | 1.2 KB | 0644 |
|
| yasm.py | File | 604 B | 0644 |
|