diff options
author | Nicolargo <nicolas@nicolargo.com> | 2014-11-29 11:15:08 +0100 |
---|---|---|
committer | Nicolargo <nicolas@nicolargo.com> | 2014-11-29 11:15:08 +0100 |
commit | b245136d8d2295a7364a99145f176dd7ba4fd995 (patch) | |
tree | 252a274bd0c86e34cbd9d076db53b001598b2f05 /setup.py | |
parent | 1bc15ad7c0f91e03f151e82c8b321adf540d3bac (diff) |
Add patch for pip user install (thk to @asergi) (correct issue #383)
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -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'): |