]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #31855 - alexcrichton:fix-tidy, r=nikomatsakis
authorbors <bors@rust-lang.org>
Wed, 24 Feb 2016 01:55:45 +0000 (01:55 +0000)
committerbors <bors@rust-lang.org>
Wed, 24 Feb 2016 01:55:45 +0000 (01:55 +0000)
The MinGW-based Python implementations would automatically do this, but if we
want to use Python from the official downloads our usage of `/` instead of `\`
can wreak havoc. In a few select locations just use `os.path.normpath` do do the
conversions properly for us.

src/etc/licenseck.py
src/etc/tidy.py

index 889b2c95a7ea88c5a740c8a4bfda2e607801d006..aa2a00beae58365c2b1ad0c13ee0836e5abdb36b 100644 (file)
@@ -9,6 +9,7 @@
 # except according to those terms.
 
 import re
+import os
 
 license_re = re.compile(
 u"""(#|//) Copyright .* The Rust Project Developers. See the COPYRIGHT
@@ -40,8 +41,9 @@ exceptions = [
 ]
 
 def check_license(name, contents):
+    name = os.path.normpath(name)
     # Whitelist check
-    if any(name.endswith(e) for e in exceptions):
+    if any(name.endswith(os.path.normpath(e)) for e in exceptions):
         return True
 
     # Xfail check
index ea34a803ccb4054a18c133ca8436cbb3cd920f08..ce774d31b081fe2a34d727e8d17d291a30376b7a 100644 (file)
@@ -122,7 +122,8 @@ try:
             'src/liblibc',
         }
 
-        if any(d in dirpath for d in skippable_dirs):
+        dirpath = os.path.normpath(dirpath)
+        if any(os.path.normpath(d) in dirpath for d in skippable_dirs):
             continue
 
         file_names = [os.path.join(dirpath, f) for f in filenames