Skip to content

Commit

Permalink
system: _run_command(): remove obsolete code
Browse files Browse the repository at this point in the history
  • Loading branch information
Obijuan committed Mar 4, 2024
1 parent 836336b commit c97ff2e
Showing 1 changed file with 8 additions and 48 deletions.
56 changes: 8 additions & 48 deletions apio/managers/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import re
import platform
from pathlib import Path
from os.path import isfile
import click

from apio import util
Expand Down Expand Up @@ -178,54 +177,15 @@ def _run_command(self, command: str, silent=False) -> dict:
on_stdout = None if silent else self._on_stdout
on_stderr = self._on_stderr

# -- Check if the executable exists
if isfile(executable_file):
# -- Execute the command!
result = util.exec_command(
executable_file,
stdout=util.AsyncPipe(on_stdout),
stderr=util.AsyncPipe(on_stderr),
)
# -- Execute the command!
result = util.exec_command(
executable_file,
stdout=util.AsyncPipe(on_stdout),
stderr=util.AsyncPipe(on_stderr),
)

# -- Return the result of the execution
return result

# -- The command does not exist in the tools-oss-cad-suite package
# -- Try with the tool-system package (old-package,
# -- (for compatibility reasons)

# -- Get the package base dir
system_base_dir = util.get_package_dir("tools-system")
print(f"System_base_dir: {system_base_dir}")

# -- Get the folder were the binary file is locateds
system_bin_dir = Path(system_base_dir) / "bin"
print(f"System bin dir: {system_bin_dir}")

# -- Get the executable filename
executable_file = system_bin_dir / (command + self.ext)
print(f"Executable file: {executable_file}")

# -- Check if the executable exists
if isfile(executable_file):
# -- Execute the command!
result = util.exec_command(
executable_file,
stdout=util.AsyncPipe(on_stdout),
stderr=util.AsyncPipe(on_stderr),
)

# -- Return the result of the execution
return result

# -- The command was not in the oss-cad-suit package
# -- The command was not in the old system package
# -- Show the error message and a hint on how to install the package
print("ERROR!!!!!!")
util.show_package_path_error(self.package_name)
util.show_package_install_instructions(self.package_name)

return None
# -- Return the result of the execution
return result

@staticmethod
def _on_stdout(line):
Expand Down

0 comments on commit c97ff2e

Please sign in to comment.