# Description: A tool for installing and managing Python packages.
# URL: https://pypi.python.org/pypi/pip/
# Maintainer: CRUX System Team, core-ports at crux dot nu
# Depends on: python3-setuptools

name=python3-pip
version=24.0
release=1
source=(https://files.pythonhosted.org/packages/source/${name:8:1}/${name#*-}/${name#*-}-$version.tar.gz
  EXTERNALLY-MANAGED.in)

build() {
	cd ${name#*-}-$version

	/usr/bin/python3 setup.py build

	/usr/bin/python3 setup.py install \
		--prefix=/usr --root=$PKG --optimize=1

	rm $PKG/usr/bin/pip

	_pyver=$(/usr/bin/python3 -c 'import sys; print("%s.%s" % sys.version_info[:2])')
	# again why does this happen?
	find $PKG/usr/lib/python${_pyver}/site-packages -type f \
		-exec chmod o-w '{}' \+

	install -m 644 $SRC/EXTERNALLY-MANAGED.in $PKG/usr/lib/python${_pyver}/EXTERNALLY-MANAGED
}
