mirror of https://github.com/pypa/pip
Fix the vendoring script to cover relative imports
This commit is contained in:
parent
50ab3bf51e
commit
caabd1f8b2
|
@ -2,7 +2,7 @@ import os
|
|||
import errno
|
||||
import sys
|
||||
|
||||
from .extern import six
|
||||
from pip._vendor import six
|
||||
|
||||
|
||||
def _makedirs_31(path, exist_ok=False):
|
||||
|
|
|
@ -37,7 +37,7 @@ C{"<salutation>, <addressee>!"}), built up using L{Word}, L{Literal}, and L{And}
|
|||
(L{'+'<ParserElement.__add__>} operator gives L{And} expressions, strings are auto-converted to
|
||||
L{Literal} expressions)::
|
||||
|
||||
from pyparsing import Word, alphas
|
||||
from pip._vendor.pyparsing import Word, alphas
|
||||
|
||||
# define grammar of a greeting
|
||||
greet = Word(alphas) + "," + Word(alphas) + "!"
|
||||
|
@ -1594,7 +1594,7 @@ class ParserElement(object):
|
|||
after importing pyparsing.
|
||||
|
||||
Example::
|
||||
import pyparsing
|
||||
from pip._vendor import pyparsing
|
||||
pyparsing.ParserElement.enablePackrat()
|
||||
"""
|
||||
if not ParserElement._packratEnabled:
|
||||
|
|
|
@ -75,7 +75,8 @@ def rewrite_file_imports(item, vendored_libs):
|
|||
"""Rewrite 'import xxx' and 'from xxx import' for vendored_libs"""
|
||||
text = item.read_text(encoding='utf-8')
|
||||
# Revendor pkg_resources.extern first
|
||||
text = re.sub(r'pkg_resources.extern', r'pip._vendor', text)
|
||||
text = re.sub(r'pkg_resources\.extern', r'pip._vendor', text)
|
||||
text = re.sub(r'from \.extern', r'from pip._vendor', text)
|
||||
for lib in vendored_libs:
|
||||
text = re.sub(
|
||||
r'(\n\s*|^)import %s(\n\s*)' % lib,
|
||||
|
|
Loading…
Reference in New Issue