Fix local path handling to reflect new source layout

This commit is contained in:
Alessio Sergi 2014-03-10 17:40:10 +01:00
parent bd78f25f12
commit c5c58f69b7
2 changed files with 3 additions and 10 deletions

View File

@ -50,7 +50,6 @@ class Config:
self.parser = RawConfigParser()
self.load()
def load(self):
"""
Load a config file from the list of paths, if it exists
@ -69,14 +68,12 @@ class Config:
sys.exit(1)
break
def get_config_path(self):
"""
Return the readed configuration file path
"""
return self.config_path
def get_paths_list(self):
"""
Get a list of config file paths, taking into account of the OS,
@ -95,7 +92,7 @@ class Config:
* {/usr/local,}/etc directory (system-wide settings)
"""
paths = []
conf_path = os.path.realpath(os.path.join(work_path, '..', 'conf'))
conf_path = os.path.realpath(os.path.join(work_path, '..', '..', 'conf'))
if self.location is not None:
paths.append(self.location)
@ -126,21 +123,18 @@ class Config:
return paths
def items(self, section):
"""
Return the items list of a section
"""
return self.parser.items(section)
def has_section(self, section):
"""
Return info about the existence of a section
"""
return self.parser.has_section(section)
def get_option(self, section, option):
"""
Get the float value of an option, if it exists
@ -152,7 +146,6 @@ class Config:
else:
return value
def get_raw_option(self, section, option):
"""
Get the raw value of an option, if it exists

View File

@ -47,7 +47,7 @@ psutil_version = tuple([int(num) for num in __psutil_version__.split('.')])
if psutil_version < (0, 5, 0):
print('PsUtil version %s detected.' % '.'.join(psutil_version))
print('PsUtil 0.5.1 or higher is needed. Glances cannot start.')
sys.exit(1)
sys.exit(1)
# Path definitions
work_path = os.path.realpath(os.path.dirname(__file__))
@ -65,7 +65,7 @@ is_Windows = sys.platform.startswith('win')
locale.setlocale(locale.LC_ALL, '')
gettext_domain = 'glances'
# get locale directory
i18n_path = os.path.realpath(os.path.join(work_path, '..', 'i18n'))
i18n_path = os.path.realpath(os.path.join(work_path, '..', '..', 'i18n'))
sys_i18n_path = os.path.join(sys_prefix, 'share', 'locale')
if os.path.exists(i18n_path):
locale_dir = i18n_path