/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 breezy/osutils.py

  • Committer: Jelmer Vernooij
  • Date: 2020-05-24 00:42:36 UTC
  • mto: This revision was merged to the branch mainline in revision 7505.
  • Revision ID: jelmer@jelmer.uk-20200524004236-jdj6obo4k5lznqw2
Cleanup Windows functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
        self.timezone = timezone
84
84
 
85
85
 
86
 
def get_unicode_argv():
87
 
    return sys.argv[1:]
88
 
 
89
 
 
90
86
def make_readonly(filename):
91
87
    """Make a filename read-only."""
92
88
    mod = os.lstat(filename).st_mode
311
307
    return path
312
308
 
313
309
 
314
 
def _posix_path_from_environ(key):
315
 
    """Get unicode path from `key` in environment or None if not present
316
 
 
317
 
    Note that posix systems use arbitrary byte strings for filesystem objects,
318
 
    so a path that raises BadFilenameEncoding here may still be accessible.
319
 
    """
320
 
    return os.environ.get(key, None)
321
 
 
322
 
 
323
310
def _posix_get_home_dir():
324
311
    """Get the home directory of the current user as a unicode path"""
325
312
    path = posixpath.expanduser("~")
430
417
realpath = _posix_realpath
431
418
pathjoin = os.path.join
432
419
normpath = _posix_normpath
433
 
path_from_environ = _posix_path_from_environ
434
420
_get_home_dir = _posix_get_home_dir
435
421
getuser_unicode = _posix_getuser_unicode
436
422
getcwd = _getcwd
488
474
        """Replacer for shutil.rmtree: could remove readonly dirs/files"""
489
475
        return shutil.rmtree(path, ignore_errors, onerror)
490
476
 
491
 
    get_unicode_argv = getattr(win32utils, 'get_unicode_argv', get_unicode_argv)
492
 
    path_from_environ = win32utils.get_environ_unicode
493
477
    _get_home_dir = win32utils.get_home_location
494
478
    getuser_unicode = win32utils.get_user_name
495
479
 
2585
2569
            raise exception_class(path)
2586
2570
 
2587
2571
 
2588
 
def is_environment_error(evalue):
2589
 
    """True if exception instance is due to a process environment issue
2590
 
 
2591
 
    This includes OSError and IOError, but also other errors that come from
2592
 
    the operating system or core libraries but are not subclasses of those.
2593
 
    """
2594
 
    if isinstance(evalue, (EnvironmentError, select.error)):
2595
 
        return True
2596
 
    if sys.platform == "win32" and win32utils._is_pywintypes_error(evalue):
2597
 
        return True
2598
 
    return False
2599
 
 
2600
 
 
2601
2572
def read_mtab(path):
2602
2573
    """Read an fstab-style file and extract mountpoint+filesystem information.
2603
2574