if readline:
readline.set_completer_delims(' \t\n\r/')
readline.set_completer(completer)
- if platform.system() == 'Darwin':
+ if sys.platform.startswith('darwin'):
# MacOS uses a slighly incompatible clone of libreadline
readline.parse_and_bind('bind ^I rl_complete')
readline.parse_and_bind('tab: complete')
"""Helper functions and classes for bup."""
import sys, os, pwd, subprocess, errno, socket, select, mmap, stat, re, struct
-import hashlib, heapq, operator, time, platform, grp
+import hashlib, heapq, operator, time, grp
from bup import _version, _helpers
import bup._helpers as _helpers
def is_superuser():
- if platform.system().startswith('CYGWIN'):
+ if sys.platform.startswith('cygwin'):
import ctypes
return ctypes.cdll.shell32.IsUserAnAdmin()
else:
#
# This code is covered under the terms of the GNU Library General
# Public License as described in the bup LICENSE file.
-import errno, os, sys, stat, time, platform, pwd, grp
+import errno, os, sys, stat, time, pwd, grp
from cStringIO import StringIO
from bup import vint, xstat
from bup.drecurse import recursive_dirlist
from bup.xstat import utime, lutime
xattr = None
-if 'Linux' in platform.system():
+if sys.platform.startswith('linux'):
try:
import xattr
except ImportError:
xattr = None
posix1e = None
-if not 'CYGWIN' in platform.system():
+if not sys.platform.startswith('cygwin'):
try:
import posix1e
except ImportError:
-import glob, grp, platform, pwd, stat, tempfile, subprocess
+import glob, grp, pwd, stat, tempfile, subprocess
import bup.helpers as helpers
from bup import git, metadata, vfs
from bup.helpers import clear_errors, detect_fakeroot, is_superuser
def setup_testfs():
- assert('Linux' in platform.system())
+ assert(sys.platform.startswith('linux'))
# Set up testfs with user_xattr, etc.
subprocess.call(['umount', 'testfs'])
ex('dd', 'if=/dev/zero', 'of=testfs.img', 'bs=1M', 'count=32')
def test_apply_to_path_restricted_access():
if is_superuser() or detect_fakeroot():
return
- if 'CYGWIN' in platform.system():
+ if sys.platform.startswith('cygwin'):
return # chmod 000 isn't effective.
tmpdir = tempfile.mkdtemp(prefix='bup-tmetadata-')
try: