"""Helper functions and classes for bup."""
import sys, os, pwd, subprocess, errno, socket, select, mmap, stat, re, struct
-import heapq, operator, time
+import heapq, operator, time, platform
from bup import _version, _helpers
import bup._helpers as _helpers
return os.getenv("FAKEROOTKEY") != None
+def is_superuser():
+ if platform.system().startswith('CYGWIN'):
+ import ctypes
+ return ctypes.cdll.shell32.IsUserAnAdmin()
+ else:
+ return os.geteuid() == 0
+
+
_username = None
def username():
"""Get the user's login name."""