diff options
author | Thomas Matthijs <axxo@gentoo.org> | 2005-06-21 21:25:54 +0000 |
---|---|---|
committer | Thomas Matthijs <axxo@gentoo.org> | 2005-06-21 21:25:54 +0000 |
commit | e29ca70fbd66edb8f07a06fe1d78c4ba3eea7c28 (patch) | |
tree | ce160ef4d600e7e7649ec088724262f217c05461 /src | |
parent | move things around a bit more ;) (diff) | |
download | java-config-e29ca70fbd66edb8f07a06fe1d78c4ba3eea7c28.tar.gz java-config-e29ca70fbd66edb8f07a06fe1d78c4ba3eea7c28.tar.bz2 java-config-e29ca70fbd66edb8f07a06fe1d78c4ba3eea7c28.zip |
formatting fix, and allow wildcards in prefs
svn path=/java-config-ng/branches/axxo/; revision=204
Diffstat (limited to 'src')
-rw-r--r-- | src/java_config/PreferenceManager.py | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/src/java_config/PreferenceManager.py b/src/java_config/PreferenceManager.py index d60cc50..ab11eb8 100644 --- a/src/java_config/PreferenceManager.py +++ b/src/java_config/PreferenceManager.py @@ -12,37 +12,36 @@ import os,glob,re import os.path class PreferenceManager: - def __init__(self): - self.pref_files = ['/etc/java-config/jdk.conf', '/usr/share/java-config/config/jdk-defaults.conf'] - self.load() - - def load(self): - self.prefs = [] - for file in self.pref_files: - if os.path.exists(file): - self.prefs = self.prefs + PrefsFile(file).get_prefs() - - - def get_vm(self, version): - for pref in self.prefs: - if pref[0] == version: - for vm in pref[1]: - gvm = self.find_vm(vm,version) - if gvm is not None: - return gvm - return self.find_vm("", version) - - def find_vm(self, vm, version): - vm_list = EnvironmentManager().find_vm(vm) - #print vm_list - vm_list.sort() - vm_list.reverse() - for vm in vm_list: - if vm.version() >= version: - return vm - return None - - + def __init__(self): + self.pref_files = ['/etc/java-config/jdk.conf', '/usr/share/java-config/config/jdk-defaults.conf'] + self.load() + + def load(self): + self.prefs = [] + for file in self.pref_files: + if os.path.exists(file): + self.prefs = self.prefs + PrefsFile(file).get_prefs() + + + def get_vm(self, version): + for pref in self.prefs: + if pref[0] == version or pref[0] == "*": + for vm in pref[1]: + gvm = self.find_vm(vm, version) + if gvm is not None: + return gvm + return self.find_vm("", version) + + def find_vm(self, vm, version): + vm_list = EnvironmentManager().find_vm(vm) + vm_list.sort() + vm_list.reverse() + for vm in vm_list: + if vm.version() >= version: + return vm + return None + + #man=PreferenceManager() #print "1.3: " + str(man.get_vm("1.3")) #print "1.4: " + str(man.get_vm("1.4")) |