~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
149
149
    try:
150
150
        return _mapper(_lstat(f).st_mode)
151
151
    except OSError, e:
152
 
        if getattr(e, 'errno', None) == errno.ENOENT:
 
152
        if getattr(e, 'errno', None) in (errno.ENOENT, errno.ENOTDIR):
153
153
            raise errors.NoSuchFile(f)
154
154
        raise
155
155
 
360
360
 
361
361
 
362
362
def _mac_getcwd():
363
 
    return unicodedata.normalize('NFKC', os.getcwdu())
 
363
    return unicodedata.normalize('NFC', os.getcwdu())
364
364
 
365
365
 
366
366
# Default is to just use the python builtins, but these can be rebound on
849
849
        return False
850
850
 
851
851
 
 
852
def has_hardlinks():
 
853
    if getattr(os, 'link', None) is not None:
 
854
        return True
 
855
    else:
 
856
        return False
 
857
 
 
858
 
852
859
def contains_whitespace(s):
853
860
    """True if there are any whitespace characters in s."""
854
861
    # string.whitespace can include '\xa0' in certain locales, because it is
1014
1021
    On platforms where the system does not normalize filenames 
1015
1022
    (Windows, Linux), you have to access a file by its exact path.
1016
1023
 
1017
 
    Internally, bzr only supports NFC/NFKC normalization, since that is 
 
1024
    Internally, bzr only supports NFC normalization, since that is 
1018
1025
    the standard for XML documents.
1019
1026
 
1020
1027
    So return the normalized path, and a flag indicating if the file
1021
1028
    can be accessed by that path.
1022
1029
    """
1023
1030
 
1024
 
    return unicodedata.normalize('NFKC', unicode(path)), True
 
1031
    return unicodedata.normalize('NFC', unicode(path)), True
1025
1032
 
1026
1033
 
1027
1034
def _inaccessible_normalized_filename(path):
1028
1035
    __doc__ = _accessible_normalized_filename.__doc__
1029
1036
 
1030
 
    normalized = unicodedata.normalize('NFKC', unicode(path))
 
1037
    normalized = unicodedata.normalize('NFC', unicode(path))
1031
1038
    return normalized, normalized == path
1032
1039
 
1033
1040