Skip to content

Commit

Permalink
Vendoring: Make sure to only rewrite relevant imports
Browse files Browse the repository at this point in the history
If there is an import from hamster, while we vendor ham, we should
not rewrite it.

Fixes #5347
  • Loading branch information
hroncok committed Apr 28, 2018
1 parent daaa0fd commit 461d946
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/5347.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the revendoring script no to rewrite unrelated import that starts suspicious.
4 changes: 2 additions & 2 deletions tasks/vendoring/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ def rewrite_file_imports(item, vendored_libs):
text,
)
text = re.sub(
r'(\n\s*)from %s' % lib,
r'\1from pip._vendor.%s' % lib,
r'(\n\s*)from %s(\.|\s+)' % lib,
r'\1from pip._vendor.%s\2' % lib,
text,
)
item.write_text(text, encoding='utf-8')
Expand Down

0 comments on commit 461d946

Please sign in to comment.