From 1fd978e9c1179d8cb42548ad315ac42bfe9e38ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Wed, 12 Oct 2005 15:19:24 +0000 Subject: [PATCH] =?UTF-8?q?env=5Fupdate=20P=C4=B0S=C4=B0=20i=C3=A7ine...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/update-environ.py | 44 ++++------------------------------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/tools/update-environ.py b/tools/update-environ.py index 9db7c68d..a18f198c 100755 --- a/tools/update-environ.py +++ b/tools/update-environ.py @@ -3,46 +3,10 @@ # Generates /etc/ld.so.conf and /etc/profile.env according to /etc/env.d directory -import os -import re +import sys -def env_update(): - if not os.path.exists("/etc/env.d"): - os.makedirs("/etc/env.d", 0755) - - list = [] - for file in os.listdir("/etc/env.d"): - if not os.path.isdir(os.path.join("/etc/env.d", file)): - list.append(file) - - list.sort() - - keys = {} - for file in list: - f = open(os.path.join("/etc/env.d", file), "r") - for line in f: - if not re.search("^#", line.strip()): - currentLine = line.strip().split("=") - - try: - if keys.has_key(currentLine[0]): - keys[currentLine[0]] += ":" + currentLine[1].replace("\"", "") - else: - keys[currentLine[0]] = currentLine[1].replace("\"", "") - except IndexError: - pass - - keys["PATH"] += ":/bin/:/sbin/:/usr/bin/" - f = open("/etc/profile.env", "w") - for key in keys: - f.write("export %s=\"%s\"\n" % (key, keys[key])) - f.close() - - f = open("/etc/ld.so.conf", "w") - for path in keys["LDPATH"].split(":"): - f.write("%s\n" % path) - f.close() - +sys.path.append('.') +import pisi.util as util if __name__ == "__main__": - env_update() + util.env_update()