/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

Merge 2.0 into 2.1 including fixes for #262450, #373898, #498409

Show diffs side-by-side

added added

removed removed

Lines of Context:
4376
4376
            return result
4377
4377
except ImportError:
4378
4378
    pass
 
4379
 
 
4380
class _PosixPermissionsFeature(Feature):
 
4381
 
 
4382
    def _probe(self):
 
4383
        def has_perms():
 
4384
            # create temporary file and check if specified perms are maintained.
 
4385
            import tempfile
 
4386
 
 
4387
            write_perms = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR
 
4388
            f = tempfile.mkstemp(prefix='bzr_perms_chk_')
 
4389
            fd, name = f
 
4390
            os.close(fd)
 
4391
            os.chmod(name, write_perms)
 
4392
 
 
4393
            read_perms = os.stat(name).st_mode & 0777
 
4394
            os.unlink(name)
 
4395
            return (write_perms == read_perms)
 
4396
 
 
4397
        return (os.name == 'posix') and has_perms()
 
4398
 
 
4399
    def feature_name(self):
 
4400
        return 'POSIX permissions support'
 
4401
 
 
4402
posix_permissions_feature = _PosixPermissionsFeature()