/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Alexander Belchenko
  • Date: 2007-11-04 11:45:30 UTC
  • mfrom: (2961 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2968.
  • Revision ID: bialix@ukr.net-20071104114530-30jl2zjawaxe375f
merge bzr.dev

Show diffs side-by-side

added added

removed removed

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