Commit 7dd1e4e6 authored by Jason R. Coombs's avatar Jason R. Coombs

Extract common functionality into reusable functions

parent 929acc4e
......@@ -25,6 +25,18 @@ def rewrite_packaging(pkg_files, new_root):
file.write_text(text)
def clean(vendor):
"""
Remove all files out of the vendor directory except the meta
data (as pip uninstall doesn't support -t).
"""
remove_all(
path
for path in vendor.glob('*')
if path.basename() != 'vendored.txt'
)
def install(vendor):
clean(vendor)
install_args = [
......@@ -35,37 +47,16 @@ def install(vendor):
pip.main(install_args)
remove_all(vendor.glob('*.dist-info'))
remove_all(vendor.glob('*.egg-info'))
(vendor / '__init__.py').write_text('')
def update_pkg_resources():
vendor = Path('pkg_resources/_vendor')
# pip uninstall doesn't support -t, so do it manually
remove_all(vendor.glob('packaging*'))
remove_all(vendor.glob('six*'))
remove_all(vendor.glob('pyparsing*'))
remove_all(vendor.glob('appdirs*'))
install_args = [
'install',
'-r', str(vendor / 'vendored.txt'),
'-t', str(vendor),
]
pip.main(install_args)
rewrite_packaging(vendor / 'packaging', 'pkg_resources.extern.')
remove_all(vendor.glob('*.dist-info'))
remove_all(vendor.glob('*.egg-info'))
install(vendor)
rewrite_packaging(vendor / 'packaging', 'pkg_resources.extern')
def update_setuptools():
vendor = Path('setuptools/_vendor')
# pip uninstall doesn't support -t, so do it manually
remove_all(vendor.glob('packaging*'))
remove_all(vendor.glob('six*'))
remove_all(vendor.glob('pyparsing*'))
install_args = [
'install',
'-r', str(vendor / 'vendored.txt'),
'-t', str(vendor),
]
pip.main(install_args)
install(vendor)
rewrite_packaging(vendor / 'packaging', 'setuptools.extern')
remove_all(vendor.glob('*.dist-info'))
remove_all(vendor.glob('*.egg-info'))
......@@ -8,9 +8,9 @@ import os
import platform
import sys
from pkg_resources.extern..pyparsing import ParseException, ParseResults, stringStart, stringEnd
from pkg_resources.extern..pyparsing import ZeroOrMore, Group, Forward, QuotedString
from pkg_resources.extern..pyparsing import Literal as L # noqa
from pkg_resources.extern.pyparsing import ParseException, ParseResults, stringStart, stringEnd
from pkg_resources.extern.pyparsing import ZeroOrMore, Group, Forward, QuotedString
from pkg_resources.extern.pyparsing import Literal as L # noqa
from ._compat import string_types
from .specifiers import Specifier, InvalidSpecifier
......
......@@ -6,10 +6,10 @@ from __future__ import absolute_import, division, print_function
import string
import re
from pkg_resources.extern..pyparsing import stringStart, stringEnd, originalTextFor, ParseException
from pkg_resources.extern..pyparsing import ZeroOrMore, Word, Optional, Regex, Combine
from pkg_resources.extern..pyparsing import Literal as L # noqa
from pkg_resources.extern..six.moves.urllib import parse as urlparse
from pkg_resources.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
from pkg_resources.extern.pyparsing import ZeroOrMore, Word, Optional, Regex, Combine
from pkg_resources.extern.pyparsing import Literal as L # noqa
from pkg_resources.extern.six.moves.urllib import parse as urlparse
from .markers import MARKER_EXPR, Marker
from .specifiers import LegacySpecifier, Specifier, SpecifierSet
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment