mirror of https://github.com/nicolargo/glances.git
Add patch for pip user install (thk to @asergi) (correct issue #383)
This commit is contained in:
parent
1bc15ad7c0
commit
b245136d8d
1
NEWS
1
NEWS
|
|
@ -16,6 +16,7 @@ Enhancements and news features:
|
|||
|
||||
Bugs corrected:
|
||||
|
||||
* Correct a bug with Glances pip install --user (issue #383)
|
||||
* Correct issue on battery stat update (issue #433)
|
||||
* Correct issue on process no longer exist (issues #414 and #432)
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ class Config(object):
|
|||
The list is built taking into account of the OS, priority and location.
|
||||
|
||||
* running from source: /path/to/glances/conf
|
||||
* per-user install: ~/.local/etc/glances (Unix-like only)
|
||||
* Linux: ~/.config/glances, /etc/glances
|
||||
* BSD: ~/.config/glances, /usr/local/etc/glances
|
||||
* Mac: ~/Library/Application Support/glances, /usr/local/etc/glances
|
||||
|
|
@ -97,6 +98,7 @@ class Config(object):
|
|||
The config file will be searched in the following order of priority:
|
||||
* /path/to/file (via -C flag)
|
||||
* /path/to/glances/conf
|
||||
* user's local directory (per-user install settings)
|
||||
* user's home directory (per-user settings)
|
||||
* {/usr/local,}/etc directory (system-wide settings)
|
||||
"""
|
||||
|
|
@ -110,6 +112,9 @@ class Config(object):
|
|||
if os.path.exists(conf_path):
|
||||
paths.append(os.path.join(conf_path, self.config_filename))
|
||||
|
||||
if not is_windows:
|
||||
paths.append(os.path.join(os.path.expanduser('~/.local'), 'etc', appname, self.config_filename))
|
||||
|
||||
if is_linux or is_bsd:
|
||||
paths.append(os.path.join(
|
||||
os.environ.get('XDG_CONFIG_HOME') or os.path.expanduser(
|
||||
|
|
|
|||
|
|
@ -49,16 +49,18 @@ plugins_path = os.path.realpath(os.path.join(work_path, '..', 'plugins'))
|
|||
sys_path = sys.path[:]
|
||||
sys.path.insert(0, plugins_path)
|
||||
|
||||
|
||||
def get_locale_path(paths):
|
||||
for path in paths:
|
||||
if os.path.exists(path):
|
||||
return path
|
||||
|
||||
# i18n
|
||||
gettext_domain = appname
|
||||
i18n_path = os.path.realpath(os.path.join(work_path, '..', '..', 'i18n'))
|
||||
user_i18n_path = os.path.join(os.path.expanduser('~/.local'), 'share', 'locale')
|
||||
sys_i18n_path = os.path.join(sys_prefix, 'share', 'locale')
|
||||
if os.path.exists(i18n_path):
|
||||
locale_dir = i18n_path
|
||||
elif os.path.exists(sys_i18n_path):
|
||||
locale_dir = sys_i18n_path
|
||||
else:
|
||||
locale_dir = None
|
||||
locale_dir = get_locale_path([i18n_path, user_i18n_path, sys_i18n_path])
|
||||
|
||||
# Create and init the logging instance
|
||||
logger = glancesLogger()
|
||||
|
|
|
|||
23
setup.py
23
setup.py
|
|
@ -6,6 +6,7 @@ import sys
|
|||
|
||||
from setuptools import setup
|
||||
|
||||
|
||||
def get_data_files():
|
||||
data_files = [
|
||||
('share/doc/glances', ['AUTHORS', 'COPYING', 'NEWS', 'README.rst',
|
||||
|
|
@ -14,21 +15,29 @@ def get_data_files():
|
|||
('share/man/man1', ['man/glances.1'])
|
||||
]
|
||||
|
||||
if hasattr(sys, 'real_prefix') or 'bsd' in sys.platform:
|
||||
if os.name == 'posix' and os.getuid() == 0: # Unix-like + root privileges
|
||||
if 'bsd' in sys.platform:
|
||||
conf_path = os.path.join(sys.prefix, 'etc', 'glances')
|
||||
elif 'linux' in sys.platform:
|
||||
conf_path = os.path.join('/etc', 'glances')
|
||||
elif 'darwin' in sys.platform:
|
||||
conf_path = os.path.join('/usr/local', 'etc', 'glances')
|
||||
elif hasattr(sys, 'real_prefix'): # virtualenv
|
||||
conf_path = os.path.join(sys.prefix, 'etc', 'glances')
|
||||
elif not hasattr(sys, 'real_prefix') and 'linux' in sys.platform:
|
||||
conf_path = os.path.join('/etc', 'glances')
|
||||
elif 'darwin' in sys.platform:
|
||||
conf_path = os.path.join('/usr/local', 'etc', 'glances')
|
||||
elif 'win32' in sys.platform:
|
||||
elif 'win32' in sys.platform: # windows
|
||||
conf_path = os.path.join(os.environ.get('APPDATA'), 'glances')
|
||||
else: # Unix-like + per-user install
|
||||
conf_path = os.path.join('etc', 'glances')
|
||||
|
||||
data_files.append((conf_path, ['conf/glances.conf']))
|
||||
|
||||
for mo in glob.glob('i18n/*/LC_MESSAGES/*.mo'):
|
||||
data_files.append((os.path.dirname(mo).replace('i18n/', 'share/locale/'), [mo]))
|
||||
data_files.append(
|
||||
(os.path.dirname(mo).replace('i18n/', 'share/locale/'), [mo]))
|
||||
|
||||
return data_files
|
||||
|
||||
|
||||
def get_requires():
|
||||
requires = ['psutil>=2.0.0']
|
||||
if sys.platform.startswith('win'):
|
||||
|
|
|
|||
Loading…
Reference in New Issue