Fixes to vendoring scripts so they work on Windows

This commit is contained in:
Paul Moore 2018-03-20 14:37:15 +00:00
parent 277bd6b00b
commit c822b765b5
2 changed files with 4 additions and 2 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Patches must have Unix-style line endings, even on Windows
tasks/vendoring/patches/* eol=lf

View File

@ -73,7 +73,7 @@ def rewrite_imports(package_dir, vendored_libs):
def rewrite_file_imports(item, vendored_libs):
"""Rewrite 'import xxx' and 'from xxx import' for vendored_libs"""
text = item.read_text()
text = item.read_text(encoding='utf-8')
# Revendor pkg_resources.extern first
text = re.sub(r'pkg_resources.extern', r'pip._vendor', text)
for lib in vendored_libs:
@ -87,7 +87,7 @@ def rewrite_file_imports(item, vendored_libs):
r'\1from pip._vendor.%s' % lib,
text,
)
item.write_text(text)
item.write_text(text, encoding='utf-8')
def apply_patch(ctx, patch_file_path):