summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorNicolargo <nicolas@nicolargo.com>2014-11-29 11:15:08 +0100
committerNicolargo <nicolas@nicolargo.com>2014-11-29 11:15:08 +0100
commitb245136d8d2295a7364a99145f176dd7ba4fd995 (patch)
tree252a274bd0c86e34cbd9d076db53b001598b2f05 /setup.py
parent1bc15ad7c0f91e03f151e82c8b321adf540d3bac (diff)
Add patch for pip user install (thk to @asergi) (correct issue #383)
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/setup.py b/setup.py
index a823d15b..4028bd70 100755
--- a/setup.py
+++ b/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'):