From bd9878335a386fff56c1f5ba2880c7522f6b10db Mon Sep 17 00:00:00 2001 From: Siarhei Siniak <siarheisiniak@gmail.com> Date: Sun, 24 Nov 2024 19:47:36 +0300 Subject: [PATCH] [~] add host_deps command --- Makefile | 3 +++ _m.py | 16 +++++++++++++--- requirements-archlinux.txt | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 requirements-archlinux.txt diff --git a/Makefile b/Makefile index 1bf321e..52a8b92 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +host_deps: + ./m host_deps + python_clean: rm -fr \ ~/.local/bin/env3 \ diff --git a/_m.py b/_m.py index e732d7d..46c0766 100644 --- a/_m.py +++ b/_m.py @@ -259,9 +259,17 @@ def inside_env() -> bool: # ruff = 'ruff' # m2 = 'm2' -Command_args = ['js', 'mypy', 'env', 'ruff', 'm2'] +def host_deps(argv: list[str]) -> None: + if sys.platform in ['linux']: + subprocess.check_call(r''' + exec yay -S $(cat requirements-archlinux.txt) + ''', shell=True,) + else: + raise NotImplementedError -Command : TypeAlias = Literal['js', 'mypy', 'env', 'ruff', 'm2'] +Command_args = ['js', 'mypy', 'env', 'ruff', 'm2', 'host_deps',] + +Command : TypeAlias = Literal['js', 'mypy', 'env', 'ruff', 'm2', 'host_deps',] def run(argv: Optional[list[str]] = None) -> None: logging.basicConfig( @@ -297,6 +305,8 @@ def run(argv: Optional[list[str]] = None) -> None: if options.command == 'js': js(args) + elif options.command == 'host_deps': + host_deps(args) elif options.command == 'env': env(args) elif options.command == 'mypy': @@ -316,4 +326,4 @@ def run(argv: Optional[list[str]] = None) -> None: raise NotImplementedError if __name__ == '__main__': - run(sys.argv[1:]) + run(sys.argv[1:]) \ No newline at end of file diff --git a/requirements-archlinux.txt b/requirements-archlinux.txt new file mode 100644 index 0000000..162b1f7 --- /dev/null +++ b/requirements-archlinux.txt @@ -0,0 +1 @@ +python-build