Skip to content

Commit

Permalink
simplify env detection logic based on feedback from sourcery.ai
Browse files Browse the repository at this point in the history
Signed-off-by: Charro Gruver <cgruver@redhat.com>
  • Loading branch information
cgruver committed Feb 9, 2025
1 parent 7dcafac commit 4d991a9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ramalama/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ def setup_container(self, args):

# Check for env var RAMALAMA_GPU_DEVICE to explicitly declare the GPU device path
device_override=0
for k, v in os.environ.items():
if k == "RAMALAMA_GPU_DEVICE":
conman_args += ["--device", v]
device_override=1
gpu_device = os.environ.get("RAMALAMA_GPU_DEVICE")
if gpu_device:
conman_args += ["--device", gpu_device]
device_override=1
if device_override != 1:
if (sys.platform == "darwin" and os.path.basename(args.engine) != "docker") or os.path.exists("/dev/dri"):
conman_args += ["--device", "/dev/dri"]
Expand Down

0 comments on commit 4d991a9

Please # to comment.