aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Matthijs <axxo@gentoo.org>2005-07-03 13:41:45 +0000
committerThomas Matthijs <axxo@gentoo.org>2005-07-03 13:41:45 +0000
commitda21a7219ee5ff56f6ee2d71f9b84a49a702402b (patch)
treeffac273892f7404f7efb727f5ed0e8552cf3ce66
parentbye (diff)
downloadjava-config-da21a7219ee5ff56f6ee2d71f9b84a49a702402b.tar.gz
java-config-da21a7219ee5ff56f6ee2d71f9b84a49a702402b.tar.bz2
java-config-da21a7219ee5ff56f6ee2d71f9b84a49a702402b.zip
remove some code duplication
svn path=/java-config-ng/branches/axxo/; revision=301
-rw-r--r--src/java_config/EnvironmentManager.py23
1 files changed, 6 insertions, 17 deletions
diff --git a/src/java_config/EnvironmentManager.py b/src/java_config/EnvironmentManager.py
index 377fcca..725fa49 100644
--- a/src/java_config/EnvironmentManager.py
+++ b/src/java_config/EnvironmentManager.py
@@ -217,19 +217,9 @@ class EnvironmentManager:
classpath = re.sub(':+', ':', classpath)
classpath.strip(':')
- if os.path.isfile(env_file):
- try:
- os.remove(env_file)
- except IOError:
- raise PermissionError
-
- try:
- stream = open(env_file, 'w')
- except IOError:
- raise PermissionError
+ self.clean_classpath(env_file)
- stream.write("CLASSPATH=%s\n" % (classpath))
- stream.close()
+ self_write_classpath(env_file, classpath)
def append_classpath(self, env_file, pkgs):
classpath = self.query_packages(pkgs, "CLASSPATH")
@@ -255,12 +245,11 @@ class EnvironmentManager:
classpath = oldClasspath + ':' + classpath
- if os.path.isfile(env_file):
- try:
- os.remove(env_file)
- except IOError:
- raise PermissionError
+ self.clean_classpath(env_file)
+
+ self_write_classpath(env_file, classpath)
+ def write_classpath(self, env_file, classpath):
try:
stream = open(env_file, 'w')
except IOError: