~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
O_BINARY = getattr(os, 'O_BINARY', 0)
78
78
 
79
79
 
 
80
def get_unicode_argv():
 
81
    try:
 
82
        user_encoding = get_user_encoding()
 
83
        return [a.decode(user_encoding) for a in sys.argv[1:]]
 
84
    except UnicodeDecodeError:
 
85
        raise errors.BzrError(("Parameter '%r' is unsupported by the current "
 
86
                                                            "encoding." % a))
 
87
 
 
88
 
80
89
def make_readonly(filename):
81
90
    """Make a filename read-only."""
82
91
    mod = os.lstat(filename).st_mode
390
399
    def rmtree(path, ignore_errors=False, onerror=_win32_delete_readonly):
391
400
        """Replacer for shutil.rmtree: could remove readonly dirs/files"""
392
401
        return shutil.rmtree(path, ignore_errors, onerror)
 
402
 
 
403
    f = win32utils.get_unicode_argv     # special function or None
 
404
    if f is not None:
 
405
        get_unicode_argv = f
 
406
 
393
407
elif sys.platform == 'darwin':
394
408
    getcwd = _mac_getcwd
395
409