Skip to content

Commit

Permalink
cython: Fix patching shebang
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexpux committed Jun 20, 2018
1 parent d0c39af commit c1a6f49
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions mingw-w64-cython/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ _realname=cython
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-cython" "${MINGW_PACKAGE_PREFIX}-cython2")
pkgver=0.28.3
pkgrel=1
pkgrel=2
pkgdesc="C-Extensions for Python (mingw-w64)"
arch=('any')
url="http://www.cython.org"
Expand Down Expand Up @@ -33,27 +33,29 @@ package_cython() {
cd "${srcdir}/python3-build-${CARCH}"
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
DISTUTILS_DEBUG=1 \
${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} \
--root="${pkgdir}" --optimize=1
${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} \
--root="${pkgdir}" --optimize=1

# Our setuptools {gui,cli}{,-32,-64}.exe have special-case handling for /usr/bin/env such that
# they look in PATH.
# sed -i 's|#!.*|#!/usr/bin/env python3|' ${pkgdir}/${MINGW_PREFIX}/bin/cy{gdb,thon}-script.py
sed -i "s|#!.*|#!${MINGW_PREFIX}/bin/python3|" ${pkgdir}/${MINGW_PREFIX}/bin/cy{gdb,thon}-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|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${_f}
done
}

package_cython2() {
depends=("${MINGW_PACKAGE_PREFIX}-python2-setuptools")
cd "${srcdir}/python2-build-${CARCH}"
DISTUTILS_DEBUG=1 \
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} \
--root="${pkgdir}" --optimize=1
${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} \
--root="${pkgdir}" --optimize=1

# Our setuptools {gui,cli}{,-32,-64}.exe have special-case handling for /usr/bin/env such that
# they look in PATH.
# sed -i 's|#!.*|#!/usr/bin/env python2|' ${pkgdir}/${MINGW_PREFIX}/bin/cy{gdb,thon}-script.py
sed -i "s|#!.*|#!${MINGW_PREFIX}/bin/python2|" ${pkgdir}/${MINGW_PREFIX}/bin/cy{gdb,thon}-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|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${_f}
done

mv ${pkgdir}${MINGW_PREFIX}/bin/cygdb{,2}.exe
mv ${pkgdir}${MINGW_PREFIX}/bin/cython{,2}.exe
Expand All @@ -70,7 +72,7 @@ package_cython2() {
}

package_mingw-w64-i686-cython() {
install=${_realname}2-${CARCH}.install
install=${_realname}-${CARCH}.install
package_cython
}

Expand All @@ -80,7 +82,7 @@ package_mingw-w64-i686-cython2() {
}

package_mingw-w64-x86_64-cython() {
install=${_realname}2-${CARCH}.install
install=${_realname}-${CARCH}.install
package_cython
}

Expand Down

0 comments on commit c1a6f49

Please sign in to comment.