Lines 44-53
Link Here
|
44 |
|
44 |
|
45 |
bsd_chflags = None |
45 |
bsd_chflags = None |
46 |
if os.uname()[0] in ["FreeBSD"]: |
46 |
if os.uname()[0] in ["FreeBSD"]: |
47 |
try: |
47 |
def bsd_chflags(): |
48 |
import freebsd as bsd_chflags |
|
|
49 |
except ImportError: |
50 |
pass |
48 |
pass |
|
|
49 |
def _chflags(path, flags, opts=""): |
50 |
cmd = "chflags %s %o '%s'" % (opts, flags, path) |
51 |
status, output = commands.getstatusoutput(cmd) |
52 |
retval = os.WEXITSTATUS(status) |
53 |
if os.WIFEXITED(status) and retval == os.EX_OK: |
54 |
return |
55 |
e = OSError(retval, output) |
56 |
e.errno = retval |
57 |
e.filename = path |
58 |
e.message = output |
59 |
raise e |
60 |
def _lchflags(path, flags): |
61 |
return _chflags(path, flags, opts="-h") |
62 |
bsd_chflags.chflags = _chflags |
63 |
bsd_chflags.lchflags = _lchflags |
51 |
|
64 |
|
52 |
try: |
65 |
try: |
53 |
from cache.cache_errors import CacheError |
66 |
from cache.cache_errors import CacheError |