1 # Maintainer: Angel Velasquez <angvp@archlinux.org>
2 # Maintainer: Felix Yan <felixonmars@archlinux.org>
3 # Contributor: Eli Schwartz <eschwartz@archlinux.org>
5 pkgname=python2-setuptools
9 pkgdesc="Easily download, build, install, upgrade, and uninstall Python packages"
12 url="https://pypi.org/project/setuptools/"
13 depends=('python2-appdirs' 'python2-packaging' 'python2-ordered-set')
15 provides=('python2-distribute')
16 replaces=('python2-distribute')
17 source=("$pkgname-$pkgver.tar.gz::https://github.com/pypa/setuptools/archive/v$pkgver.tar.gz")
18 sha512sums=('aabddfbd62b95ce7d8e68d582362361d32b91e65e6d00c393593521a2c1c383552e324ae64974049ae9880072c8741e2393e6482cd07ff7dd30615e91e9e1450')
20 export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0
23 rm -r setuptools-$pkgver/{pkg_resources,setuptools}/{extern,_vendor}
25 # Upstream devendoring logic is badly broken, see:
26 # https://bugs.archlinux.org/task/58670
27 # https://github.com/pypa/pip/issues/5429
28 # https://github.com/pypa/setuptools/issues/1383
29 # The simplest fix is to simply rewrite import paths to use the canonical
30 # location in the first place
31 for _module in setuptools pkg_resources '' ; do
32 find setuptools-$pkgver -name \*.py -exec sed -i \
33 -e 's/from '$_module.extern' import/import/' \
34 -e 's/from '$_module.extern'./from /' \
35 -e 's/import '$_module.extern'./import /' \
36 -e "s/__import__('$_module.extern./__import__('/" \
40 # Remove post-release tag since we are using stable tags
41 sed -e '/tag_build = .post/d' \
42 -e '/tag_date = 1/d' \
43 -i setuptools-$pkgver/setup.cfg
45 cd "$srcdir"/setuptools-$pkgver
46 sed -i -e "s|^#\!.*/usr/bin/env python|#!/usr/bin/env python2|" setuptools/command/easy_install.py
52 python2 setup.py build
57 python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 --skip-build
58 rm "$pkgdir"/usr/bin/easy_install