aboutsummaryrefslogblamecommitdiffstats
path: root/main/py3-setuptools/APKBUILD
blob: 36897c3103ff7ab229c053fd543a2dac0d46ea0f (plain) (tree)
1
2
3
4
5
6
7
8





                                                               
             
        




                                                             
                                                           










                                                                                            


















                                                                                 



















                                                                                                          
                                                                                                                                                                       
# Contributor: Andrew Manison <amanison@anselsystems.com>
# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Leo <thinkabit.ukim@gmail.com>
pkgname=py3-setuptools
_pkgname=${pkgname#py3-}
pkgver=51.3.3
pkgrel=0
pkgdesc="Collection of enhancements to the Python3 distutils"
options="!check" # Tests require packages out of main/
url="https://pypi.python.org/pypi/setuptools"
arch="noarch"
license="MIT"
depends="python3 py3-ordered-set py3-appdirs py3-packaging"
source="$_pkgname-$pkgver.tar.gz::https://github.com/pypa/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

provides="py-setuptools=$pkgver-r$pkgrel" # Backwards compatibility
replaces="py-setuptools" # Backwards compatiblity

export SETUPTOOLS_INSTALL_WINDOWS_SPECIFIC_FILES=0

prepare() {
	default_prepare

	# Unbundle
	rm -rf pkg_resources/extern pkg_resources/_vendor \
		setuptools/extern setuptools/_vendor

	# Upstream devendoring logic is badly broken, see:
	# https://bugs.archlinux.org/task/58670
	# https://github.com/pypa/pip/issues/5429
	# https://github.com/pypa/setuptools/issues/1383
	# The simplest fix is to simply rewrite import paths to use the canonical
	# location in the first place
	for _module in setuptools pkg_resources '' ; do
		find . -name \*.py -exec sed -i \
			-e 's/from '$_module.extern' import/import/' \
			-e 's/from '$_module.extern'./from /' \
			-e 's/import '$_module.extern'./import /' \
			-e "s/__import__('$_module.extern./__import__('/" \
			{} +
	done

	# Fix post-release tag
	sed -e '/tag_build = .post/d' \
		-e '/tag_date = 1/d' \
		-i setup.cfg

	# Fix shebang
	sed -i -e "s|^#\!.*/usr/bin/env python|#!/usr/bin/env python3|" setuptools/command/easy_install.py

	python3 bootstrap.py
}

build() {
	python3 setup.py build
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
	# we don't provide a non-suffixed easy_install
	rm -f "$pkgdir"/usr/bin/easy_install
}
sha512sums="b032ea31ea250c4cefd1de914a46018bce2fb140739835a160ef096c59781a4aec1f05feeef03855241fe085707f535145fd77b446261fc6369bc2c39e5a4a22  setuptools-51.3.3.tar.gz"