]> arthur.barton.de Git - bup.git/blobdiff - t/root-status
Make PackWriter a "with" context manager
[bup.git] / t / root-status
index 5024ed3afb29b1976c5dfc4635542895adf34ccf..28e2347357b6a0bc1a9ff7e595a3c9f869b10c04 100755 (executable)
@@ -5,20 +5,28 @@ exec "$bup_python" "$0" ${1+"$@"}
 """
 # end of bup preamble
 
+from __future__ import absolute_import, print_function
+from sys import stderr
 import sys
 
+
 if sys.platform.startswith('cygwin'):
+    if sys.getwindowsversion()[0] > 5:
+        # Sounds like the situation is much more complicated here
+        print("can't detect root status for OS version > 5; assuming not root",
+              file=stderr)
+        print('none')
     import ctypes
     if ctypes.cdll.shell32.IsUserAnAdmin():
-        print 'root'
+        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')