"""
# end of bup preamble
-from sys import stderr
-import sys
-
+from __future__ import absolute_import, print_function
+import os, sys
if sys.platform.startswith('cygwin'):
- if sys.getwindowsversion()[0] > 5:
- # Sounds like the situation is much more complicated here
- print >> stderr, "can't detect root status for OS version > 5; assuming not root"
- print 'none'
- import ctypes
- if ctypes.cdll.shell32.IsUserAnAdmin():
- print 'root'
+ groups = os.getgroups()
+ if 544 in groups or 0 in groups:
+ print('root')
else:
- print 'none'
+ print('none')
else:
- import os
if os.environ.get('FAKEROOTKEY'):
- print 'fake'
+ print('fake')
else:
if os.geteuid() == 0:
- print 'root'
+ print('root')
else:
- print 'none'
+ print('none')