/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: 2019-03-04 05:10:44 UTC
  • mfrom: (7293 work)
  • mto: This revision was merged to the branch mainline in revision 7294.
  • Revision ID: jelmer@jelmer.uk-20190304051044-vph4s8p9qvpy2qe9
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
    )
71
71
 
72
72
 
73
 
# Cross platform wall-clock time functionality with decent resolution.
74
 
# On Linux ``time.clock`` returns only CPU time. On Windows, ``time.time()``
75
 
# only has a resolution of ~15ms. Note that ``time.clock()`` is not
76
 
# synchronized with ``time.time()``, this is only meant to be used to find
77
 
# delta times by subtracting from another call to this function.
78
 
timer_func = time.time
79
 
if sys.platform == 'win32':
80
 
    timer_func = time.clock
81
 
 
82
73
# On win32, O_BINARY is used to indicate the file should
83
74
# be opened in binary mode, rather than text mode.
84
75
# On other platforms, O_BINARY doesn't exist, because
1035
1026
 
1036
1027
def splitpath(p):
1037
1028
    """Turn string into list of parts."""
1038
 
    # split on either delimiter because people might use either on
1039
 
    # Windows
1040
 
    if isinstance(p, bytes):
1041
 
        ps = re.split(b'[\\\\/]', p)
 
1029
    if os.path.sep == '\\':
 
1030
        # split on either delimiter because people might use either on
 
1031
        # Windows
 
1032
        if isinstance(p, bytes):
 
1033
            ps = re.split(b'[\\\\/]', p)
 
1034
        else:
 
1035
            ps = re.split(r'[\\/]', p)
1042
1036
    else:
1043
 
        ps = re.split(r'[\\/]', p)
 
1037
        if isinstance(p, bytes):
 
1038
            ps = p.split(b'/')
 
1039
        else:
 
1040
            ps = p.split('/')
1044
1041
 
1045
1042
    rps = []
1046
1043
    for f in ps:
2603
2600
    if sys.platform == "win32" and win32utils._is_pywintypes_error(evalue):
2604
2601
        return True
2605
2602
    return False
 
2603
 
 
2604
 
 
2605
if PY3:
 
2606
    perf_counter = time.perf_counter
 
2607
else:
 
2608
    perf_counter = time.clock