~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-11-03 09:39:11 UTC
  • mfrom: (2949.6.2 win32.os.lstat)
  • Revision ID: pqm@pqm.ubuntu.com-20071103093911-4alf7wiad3n3vfz6
windows python has os.lstat

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
# OR with 0 on those platforms
69
69
O_BINARY = getattr(os, 'O_BINARY', 0)
70
70
 
71
 
# On posix, use lstat instead of stat so that we can
72
 
# operate on broken symlinks. On Windows revert to stat.
73
 
lstat = getattr(os, 'lstat', os.stat)
74
71
 
75
72
def make_readonly(filename):
76
73
    """Make a filename read-only."""
77
 
    mod = lstat(filename).st_mode
 
74
    mod = os.lstat(filename).st_mode
78
75
    if not stat.S_ISLNK(mod):
79
76
        mod = mod & 0777555
80
77
        os.chmod(filename, mod)
81
78
 
82
79
 
83
80
def make_writable(filename):
84
 
    mod = lstat(filename).st_mode
 
81
    mod = os.lstat(filename).st_mode
85
82
    if not stat.S_ISLNK(mod):
86
83
        mod = mod | 0200
87
84
        os.chmod(filename, mod)