Skip to content

Commit 66c62d4

Browse files
committed
setup.py: use default/user CFGDIR if os.geteuid() is not defined
Fixes #384. Change-Id: Ic84358a75192a40fde15e86c986ca98775ea409f
1 parent 03c99ca commit 66c62d4

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

setup.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
#
33
# Copyright (C) 2008-2016 CEA/DAM
4-
# Copyright (C) 2016-2017 Stephane Thiell <[email protected]>
4+
# Copyright (C) 2016-2018 Stephane Thiell <[email protected]>
55
#
66
# This file is part of ClusterShell.
77
#
@@ -23,15 +23,18 @@
2323
from setuptools import setup, find_packages
2424

2525

26-
if os.geteuid() == 0:
27-
# System-wide, out-of-prefix config install (rpmbuild or pip as root)
28-
CFGDIR = '/etc/clustershell'
29-
else:
30-
# User, in-prefix config install (rpmbuild or pip as user)
31-
CFGDIR = 'etc/clustershell'
32-
3326
VERSION = '1.8'
3427

28+
# Default CFGDIR: in-prefix config install (rpmbuild or pip as user)
29+
CFGDIR = 'etc/clustershell'
30+
31+
# Use system-wide CFGDIR instead when installing as root on Unix
32+
try:
33+
if os.geteuid() == 0:
34+
CFGDIR = '/etc/clustershell'
35+
except AttributeError: # Windows?
36+
pass
37+
3538
# Dependencies (for pip install)
3639
REQUIRES = ['PyYAML']
3740

0 commit comments

Comments
 (0)