File: pavement.py

package info (click to toggle)
python-setuptools 33.1.1-1~bpo8%2B1
  • links: PTS
  • area: main
  • in suites: jessie-backports
  • size: 2,852 kB
  • sloc: python: 19,087; ansic: 195; makefile: 97; xml: 14
file content (32 lines) | stat: -rw-r--r-- 902 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import re

from paver.easy import task, path as Path
import pip


def remove_all(paths):
    for path in paths:
        path.rmtree() if path.isdir() else path.remove()


@task
def update_vendored():
    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)
    packaging = vendor / 'packaging'
    for file in packaging.glob('*.py'):
        text = file.text()
        text = re.sub(r' (pyparsing|six)', r' pkg_resources.extern.\1', text)
        file.write_text(text)
    remove_all(vendor.glob('*.dist-info'))
    remove_all(vendor.glob('*.egg-info'))