mirror of
https://github.com/iiab/iiab.git
synced 2025-02-15 04:32:11 +00:00
27 lines
660 B
Django/Jinja
27 lines
660 B
Django/Jinja
#!/usr/bin/python
|
|
# read xsce.env from python
|
|
|
|
def get_xsce_env(name):
|
|
""" read xsce.env file for a value, return "" if does not exist"""
|
|
try:
|
|
fd = open("/etc/xsce/xsce.env","r")
|
|
for line in fd:
|
|
line = line.lstrip()
|
|
line = line.rstrip('\n')
|
|
if len(line) == 0:
|
|
continue
|
|
if line[0] == "#":
|
|
continue
|
|
if line.find("=") == -1:
|
|
continue
|
|
chunks = line.split('=')
|
|
if chunks[0] == name:
|
|
return chunks[1]
|
|
return("")
|
|
except:
|
|
return("")
|
|
finally:
|
|
fd.close()
|
|
|
|
if __name__ == "__main__":
|
|
print(get_xsce_env("WWWROOT"))
|