Skip to content

Commit

Permalink
refactor: move system_distro, get_installed_programs to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbrayo committed Nov 9, 2024
1 parent 1fb1459 commit 40ecd1d
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions gptme/tools/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@
logger = logging.getLogger(__name__)


@functools.lru_cache
def get_installed_programs() -> set[str]:
candidates = [
candidates = (
# platform-specific
"brew",
"apt-get",
Expand All @@ -35,15 +33,10 @@ def get_installed_programs() -> set[str]:
"pandoc",
"git",
"docker",
]
installed = set()
for candidate in candidates:
if shutil.which(candidate) is not None:
installed.add(candidate)
return installed
)


shell_programs_str = "\n".join(f"- {prog}" for prog in get_installed_programs())
shell_programs_str = "\n".join(f"- {prog}" for prog in get_installed_programs(candidates))
is_macos = sys.platform == "darwin"

instructions = f"""
Expand Down

0 comments on commit 40ecd1d

Please sign in to comment.