comparison tests/run-tests.py @ 19419:e823abe577a2

run-tests: test for os.altsep instead of os.name when checking \ for / This tells more explicitly what it is about
author Simon Heimberg <simohe@besonet.ch>
date Sat, 13 Jul 2013 23:57:55 +0200
parents a0699972e75a
children 4f32747879d1
comparison
equal deleted inserted replaced
19418:55b9d98a1ef4 19419:e823abe577a2
603 603
604 def globmatch(el, l): 604 def globmatch(el, l):
605 # The only supported special characters are * and ? plus / which also 605 # The only supported special characters are * and ? plus / which also
606 # matches \ on windows. Escaping of these caracters is supported. 606 # matches \ on windows. Escaping of these caracters is supported.
607 if el + '\n' == l: 607 if el + '\n' == l:
608 if os.name == 'nt': 608 if os.altsep:
609 # matching on "/" is not needed for this line 609 # matching on "/" is not needed for this line
610 log("\nInfo, unnecessary glob: %s (glob)" % el) 610 log("\nInfo, unnecessary glob: %s (glob)" % el)
611 return True 611 return True
612 i, n = 0, len(el) 612 i, n = 0, len(el)
613 res = '' 613 res = ''
619 i += 1 619 i += 1
620 elif c == '*': 620 elif c == '*':
621 res += '.*' 621 res += '.*'
622 elif c == '?': 622 elif c == '?':
623 res += '.' 623 res += '.'
624 elif c == '/' and os.name == 'nt': 624 elif c == '/' and os.altsep:
625 res += '[/\\\\]' 625 res += '[/\\\\]'
626 else: 626 else:
627 res += re.escape(c) 627 res += re.escape(c)
628 return rematch(res, l) 628 return rematch(res, l)
629 629