/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: Vincent Ladeuil
  • Date: 2007-11-04 15:29:17 UTC
  • mfrom: (2961 +trunk)
  • mto: (2961.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 2962.
  • Revision ID: v.ladeuil+lp@free.fr-20071104152917-nrsumxpk3dikso2c
Merge bzr.dev

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)