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

[merge] bzr.dev 2255

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
from shutil import (
41
41
    rmtree,
42
42
    )
43
 
import string
44
43
import tempfile
45
44
from tempfile import (
46
45
    mkdtemp,
777
776
 
778
777
def contains_whitespace(s):
779
778
    """True if there are any whitespace characters in s."""
780
 
    for ch in string.whitespace:
 
779
    # string.whitespace can include '\xa0' in certain locales, because it is
 
780
    # considered "non-breaking-space" as part of ISO-8859-1. But it
 
781
    # 1) Isn't a breaking whitespace
 
782
    # 2) Isn't one of ' \t\r\n' which are characters we sometimes use as
 
783
    #    separators
 
784
    # 3) '\xa0' isn't unicode safe since it is >128.
 
785
    # So we are following textwrap's example and hard-coding our own.
 
786
    # We probably could ignore \v and \f, too.
 
787
    for ch in u' \t\n\r\v\f':
781
788
        if ch in s:
782
789
            return True
783
790
    else:
915
922
    return sys.platform != "win32"
916
923
 
917
924
 
 
925
def supports_posix_readonly():
 
926
    """Return True if 'readonly' has POSIX semantics, False otherwise.
 
927
 
 
928
    Notably, a win32 readonly file cannot be deleted, unlike POSIX where the
 
929
    directory controls creation/deletion, etc.
 
930
 
 
931
    And under win32, readonly means that the directory itself cannot be
 
932
    deleted.  The contents of a readonly directory can be changed, unlike POSIX
 
933
    where files in readonly directories cannot be added, deleted or renamed.
 
934
    """
 
935
    return sys.platform != "win32"
 
936
 
 
937
 
918
938
def set_or_unset_env(env_variable, value):
919
939
    """Modify the environment, setting or removing the env_variable.
920
940