/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/tests/__init__.py

  • Committer: Martin Pool
  • Date: 2010-02-18 04:45:24 UTC
  • mto: (4634.139.7 2.0)
  • mto: This revision was merged to the branch mainline in revision 5160.
  • Revision ID: mbp@sourcefrog.net-20100218044524-jzx58c52t5qxr0oa
Backport fix for permissions of backup.bzr 
from https://code.edge.launchpad.net/~parthm/bzr/262450/+merge/19483

Show diffs side-by-side

added added

removed removed

Lines of Context:
4106
4106
            return result
4107
4107
except ImportError:
4108
4108
    pass
 
4109
 
 
4110
class _PosixPermissionsFeature(Feature):
 
4111
 
 
4112
    def _probe(self):
 
4113
        def has_perms():
 
4114
            # create temporary file and check if specified perms are maintained.
 
4115
            import tempfile
 
4116
 
 
4117
            write_perms = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
 
4118
            f = tempfile.mkstemp(prefix='bzr_perms_chk_')
 
4119
            fd, name = f
 
4120
            os.close(fd)
 
4121
            os.chmod(name, write_perms)
 
4122
 
 
4123
            read_perms = os.stat(name).st_mode & 0777
 
4124
            os.unlink(name)
 
4125
            return (write_perms == read_perms)
 
4126
 
 
4127
        return (os.name == 'posix') and has_perms()
 
4128
 
 
4129
    def feature_name(self):
 
4130
        return 'POSIX permissions support'
 
4131
 
 
4132
PosixPermissionsFeature = _PosixPermissionsFeature()
 
4133