invoke helper commands directly from local install, not poetry venv

This commit is contained in:
evilchili 2024-03-25 22:32:42 -07:00
parent 76e0b16aef
commit 62dae5f560

View File

@ -21,7 +21,7 @@ class BuildTool:
poetry: Path = Path("poetry") poetry: Path = Path("poetry")
verbose: bool = False verbose: bool = False
def do(self, *command_line) -> bool: def _exec(self, *command_line) -> bool:
""" """
Execute a poetry subprocess. Execute a poetry subprocess.
""" """
@ -48,23 +48,26 @@ class BuildTool:
logger.info(result.stderr) logger.info(result.stderr)
return result.returncode return result.returncode
def run_with_poetry(self, *command_line):
return self._exec(str(self.poetry), *command_line)
def run(self, *command_line): def run(self, *command_line):
""" """
Same as do(), but prepend a 'run' subcommand. Same as run_with_poetry(), but prepend a 'run' subcommand.
""" """
return self.do("run", *command_line) return self._exec("run", *command_line)
def install(self) -> bool: def install(self) -> bool:
return self.do("install") return self.run_with_poetry("install")
def auto_format(self) -> bool: def auto_format(self) -> bool:
self.run("isort", "src", "test") self._exec("isort", "src", "test")
self.run("autoflake", "src", "test") self._exec("autoflake", "src", "test")
self.run("black", "src", "test") self._exec("black", "src", "test")
return 0 return 0
def test(self, args) -> bool: def test(self, args) -> bool:
return self.run("pytest", *args) return self._exec("pytest", *args)
def build(self) -> bool: def build(self) -> bool:
print("Formatting...") print("Formatting...")
@ -74,5 +77,5 @@ class BuildTool:
print("Installing...") print("Installing...")
success += self.install() success += self.install()
print("Building...") print("Building...")
success += self.do("build") success += self.run_with_poetry("build")
return success return success