109 lines
3.9 KiB
Bash
109 lines
3.9 KiB
Bash
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
|
|
|
|
_realname=pip
|
|
pkgbase=mingw-w64-python-${_realname}
|
|
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
|
pkgver=18.1
|
|
pkgrel=2
|
|
pkgdesc="An easy_install replacement for installing pypi python packages (mingw-w64)"
|
|
arch=('any')
|
|
license=('MIT')
|
|
url="http://www.pip-installer.org/"
|
|
# "distro" library doesn't support windows
|
|
_deps=('setuptools' 'appdirs' 'cachecontrol' 'colorama' 'distlib' #'distro'
|
|
'html5lib' 'lockfile' 'msgpack' 'packaging' 'pep517' 'progress' 'pyparsing' 'pytoml'
|
|
'requests' 'retrying' 'six' 'webencodings')
|
|
makedepends=("${_deps[@]/#/${MINGW_PACKAGE_PREFIX}-python3-}" "${_deps[@]/#/${MINGW_PACKAGE_PREFIX}-python2-}"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-ipaddress"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-sphinx")
|
|
source=(${_realname}-${pkgver}.tar.gz::https://github.com/pypa/pip/archive/${pkgver}.tar.gz)
|
|
noextract=(${_realname}-${pkgver}.tar.gz)
|
|
sha256sums=('3ff036bbbce30f27b0ba440134defa66a135740c9e3401bd466e7f0d8153147c')
|
|
|
|
shopt -s extglob
|
|
|
|
prepare() {
|
|
# work around symlinks in pip package that can cause problems with some building
|
|
# where dirs are not removed after being used.
|
|
rm -rf ${_realname}-${pkgver}/tests/data/packages/symlinks/docs || true 2> /dev/nul
|
|
bsdtar zxf ${_realname}-${pkgver}.tar.gz || true
|
|
|
|
# specify that third-party stuff should not be bundled. This is from Archlinux
|
|
rm -rf ${_realname}-${pkgver}/src/pip/_vendor/!(__init__.py)
|
|
sed -i -e 's/DEBUNDLED = False/DEBUNDLED = True/' \
|
|
-e '/cachecontrol/a\ vendored("pep517")' \
|
|
${_realname}-${pkgver}/src/pip/_vendor/__init__.py
|
|
for pver in {2,3}; do
|
|
rm -rf python${pver}-build-${CARCH}| true
|
|
cp -r "${_realname}-${pkgver}" "python${pver}-build-${CARCH}"
|
|
done
|
|
}
|
|
|
|
build() {
|
|
for pver in {2,3}; do
|
|
msg "Python ${pver} build for ${CARCH}"
|
|
cd "${srcdir}/python${pver}-build-${CARCH}"
|
|
${MINGW_PREFIX}/bin/python${pver} setup.py build
|
|
done
|
|
}
|
|
|
|
package_python2-pip() {
|
|
depends=("${_deps[@]/#/${MINGW_PACKAGE_PREFIX}-python2-}" "${MINGW_PACKAGE_PREFIX}-python2-ipaddress")
|
|
|
|
cd "${srcdir}/python2-build-${CARCH}"
|
|
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
|
${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX#\/} --root="${pkgdir}" --optimize=1 --skip-build
|
|
|
|
install -D -m644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE"
|
|
|
|
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
|
|
# fix python command in files
|
|
for _f in "${pkgdir}${MINGW_PREFIX}"/bin/*.py; do
|
|
sed -e "s|/usr/bin/env |${MINGW_PREFIX}|g" \
|
|
-e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${_f}
|
|
done
|
|
|
|
}
|
|
|
|
package_python3-pip() {
|
|
depends=("${_deps[@]/#/${MINGW_PACKAGE_PREFIX}-python3-}")
|
|
|
|
local _mingw_prefix=$(cygpath -wm ${MINGW_PREFIX})
|
|
|
|
cd "${srcdir}/python3-build-${CARCH}"
|
|
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
|
${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX#\/} --root="${pkgdir}" --optimize=1 --skip-build -v
|
|
|
|
# Remove conflicted files
|
|
rm -f ${pkgdir}${MINGW_PREFIX}/bin/pip{.exe,.exe.manifest,-script.py}
|
|
|
|
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
|
|
# fix python command in files
|
|
for _f in "${pkgdir}${MINGW_PREFIX}"/bin/*.py; do
|
|
sed -e "s|/usr/bin/env |${MINGW_PREFIX}|g" \
|
|
-e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${_f}
|
|
done
|
|
|
|
install -D -m644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE"
|
|
}
|
|
|
|
package_mingw-w64-i686-python2-pip() {
|
|
install=${_realname}2-${CARCH}.install
|
|
package_python2-pip
|
|
}
|
|
|
|
package_mingw-w64-i686-python3-pip() {
|
|
install=${_realname}3-${CARCH}.install
|
|
package_python3-pip
|
|
}
|
|
|
|
package_mingw-w64-x86_64-python2-pip() {
|
|
install=${_realname}2-${CARCH}.install
|
|
package_python2-pip
|
|
}
|
|
|
|
package_mingw-w64-x86_64-python3-pip() {
|
|
install=${_realname}3-${CARCH}.install
|
|
package_python3-pip
|
|
}
|