MCPcopy Create free account
hub / github.com/boostorg/build / writable

Method writable

test/TestCmd.py:547–571  ·  view source on GitHub ↗

Make the specified directory tree writable (write == 1) or not (write == None).

(self, top, write)

Source from the content-addressed store, hash-verified

545 return apply(os.path.join, (self.workdir,) + tuple(args))
546
547 def writable(self, top, write):
548 """
549 Make the specified directory tree writable (write == 1) or not
550 (write == None).
551
552 """
553 def _walk_chmod(arg, dirname, names):
554 st = os.stat(dirname)
555 os.chmod(dirname, arg(st[stat.ST_MODE]))
556 for name in names:
557 fullname = os.path.join(dirname, name)
558 st = os.stat(fullname)
559 os.chmod(fullname, arg(st[stat.ST_MODE]))
560
561 _mode_writable = lambda mode: stat.S_IMODE(mode|0200)
562 _mode_non_writable = lambda mode: stat.S_IMODE(mode&~0200)
563
564 if write:
565 f = _mode_writable
566 else:
567 f = _mode_non_writable
568 try:
569 os.path.walk(top, _walk_chmod, f)
570 except:
571 pass # Ignore any problems changing modes.
572
573 def write(self, file, content, mode='wb'):
574 """

Callers 1

cleanupMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected