Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Arohan Ajit committed Jan 30, 2025
1 parent 77a0921 commit dbaeae4
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions display/d.mon/render_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ def read_env_file(env_file):
try:
with open(env_file) as fd:
for line in fd:
if line.startswith("width:"):
width = int(line.split(":")[1])
elif line.startswith("height:"):
height = int(line.split(":")[1])
elif line.startswith("legfile:"):
legfile = line.split(":")[1].strip()
line = line.strip()
if line.startswith("#") or not line:
continue
# Split on comment and parse key=value
k, v = line.split("#", 1)[0].strip().split("=", 1)
os.environ[k] = v
if width is None and k == "GRASS_RENDER_WIDTH":
width = int(v)
if height is None and k == "GRASS_RENDER_HEIGHT":
height = int(v)
if legfile is None and k == "GRASS_LEGEND_FILE":
legfile = v
except OSError:
grass.fatal(f"Unable to open file '{env_file}'")

Expand Down

0 comments on commit dbaeae4

Please sign in to comment.