Skip to content

Commit

Permalink
change install dir preferences
Browse files Browse the repository at this point in the history
priorities: /opt/homebrew/share then /usr/local/share then /usr/share/ramalama

Co-Authored-By: boredsquirrel <[email protected]>
Signed-off-by: Eric Curtin <[email protected]>
  • Loading branch information
boredsquirrel authored and ericcurtin committed Sep 26, 2024
1 parent 9331d0f commit c16ea8b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
7 changes: 3 additions & 4 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,11 @@ def setup_ramalama(bindir, tmp_dir):
to_file = os.path.join(tmp_dir, from_file)
download(url, to_file)
ramalama_bin = os.path.join(bindir, binfile)
syspath = "/usr/share/ramalama"
sharedirs = ["/opt/homebrew/share", "/usr/local/share", "/usr/share"]
syspath = next((d for d in sharedirs if os.path.exists(d)), None)
syspath += "/ramalama"
if sys.platform == "darwin":
install_mac_dependencies()
sharedirs = ["/opt/homebrew/share", "/usr/local/share"]
syspath = next((d for d in sharedirs if os.path.exists(d)), None)
syspath += "/ramalama"

subprocess.run(["install", "-m755", "-d", syspath], check=True)
syspath += "/ramalama"
Expand Down
7 changes: 2 additions & 5 deletions ramalama.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@


def main(args):
syspath = "/usr/share/ramalama"
if sys.platform == "darwin":
sharedirs = ["/opt/homebrew/share/ramalama", "/usr/local/share/ramalama"]
syspath = next((d for d in sharedirs if os.path.exists(d)), None)

sharedirs = ["/opt/homebrew/share/ramalama", "/usr/local/share/ramalama", "/usr/share/ramalama"]
syspath = next((d for d in sharedirs if os.path.exists(d)), None)
sys.path.insert(0, syspath)

import ramalama
Expand Down

0 comments on commit c16ea8b

Please sign in to comment.