Add mingw-w64-python-theano package (#4889)
* Add mingw-w64-python-theano package * correct LICENSE file name
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
--- Theano-rel-1.0.4.orig/theano/gof/cmodule.py 2019-01-20 10:35:30.607760200 +0800
|
||||
+++ Theano-rel-1.0.4/theano/gof/cmodule.py 2019-01-20 10:47:09.262721000 +0800
|
||||
@@ -315,6 +315,11 @@
|
||||
warnings.filterwarnings("ignore",
|
||||
message="numpy.ndarray size changed")
|
||||
rval = __import__(module_name, {}, {}, [module_name])
|
||||
+ # Value of rval.__file__ contains path seperator '\\' causing
|
||||
+ # fullpath.startswith(rval.__file__) is false.
|
||||
+ # Perhaps, it is a bug of mingw-w64 python3 __import__ function!
|
||||
+ # Now, we just replace all '\\' to '/'.
|
||||
+ rval.__file__ = rval.__file__.replace('\\','/')
|
||||
t1 = time.time()
|
||||
import_time += t1 - t0
|
||||
if not rval:
|
||||
@@ -1641,10 +1646,10 @@
|
||||
# installation directory, in case the user defined a custom
|
||||
# installation directory.
|
||||
python_version = distutils.sysconfig.get_python_version()
|
||||
- libname = 'python' + python_version.replace('.', '')
|
||||
+ libname = 'python' + python_version + '.dll'
|
||||
# Also add directory containing the Python library to the library
|
||||
# directories.
|
||||
- python_lib_dirs = [os.path.join(os.path.dirname(python_inc), 'libs')]
|
||||
+ python_lib_dirs = [os.path.join(os.path.dirname(os.path.dirname(python_inc)), 'lib')]
|
||||
if "Canopy" in python_lib_dirs[0]:
|
||||
# Canopy stores libpython27.a and libmsccr90.a in this directory.
|
||||
# For some reason, these files are needed when compiling Python
|
||||
125
mingw-w64-python-theano/PKGBUILD
Normal file
125
mingw-w64-python-theano/PKGBUILD
Normal file
@@ -0,0 +1,125 @@
|
||||
# Maintainer: gym603 <gui_yuan_miao@163.com>
|
||||
|
||||
_realname=theano
|
||||
pkgbase=mingw-w64-python-${_realname}
|
||||
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
||||
pkgver=1.0.4
|
||||
pkgrel=1
|
||||
pkgdesc="Python library that allows you to define, optimize, and evaluate mathematical expressions involving multi-dimensional arrays efficiently. (mingw-w64)"
|
||||
arch=('any')
|
||||
url="https://github.com/Theano/Theano"
|
||||
license=('BSD')
|
||||
_archive=Theano-rel-${pkgver}
|
||||
source=(${_archive}.tar.gz::https://github.com/Theano/Theano/archive/rel-${pkgver}.tar.gz
|
||||
0001-cmodule-obtain-mingw-w64-python-library.patch)
|
||||
sha256sums=('DEB711BBB8A8F6021D4AD6F255A890DF51507CB1111DD3FC471EF40F23F7B88D'
|
||||
'FD4A66AAC925ABDD9316BB142784C97E63D42EF590DDDDDF5D1771E69EA189DF')
|
||||
noextract=(${_archive}.tar.gz)
|
||||
|
||||
_deps=('numpy' 'scipy' 'six')
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-python3-setuptools"
|
||||
"${MINGW_PACKAGE_PREFIX}-python2-setuptools")
|
||||
|
||||
# Helper macros to help make tasks easier #
|
||||
apply_patch_with_msg() {
|
||||
for _patch in "$@"
|
||||
do
|
||||
msg2 "Applying ${_patch}"
|
||||
patch -b -p1 -i "${srcdir}/${_patch}"
|
||||
done
|
||||
}
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}"
|
||||
bsdtar zxf ${_archive}.tar.gz || true
|
||||
|
||||
cd "${srcdir}/${_archive}"
|
||||
apply_patch_with_msg \
|
||||
0001-cmodule-obtain-mingw-w64-python-library.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "${srcdir}"
|
||||
rm -rf python{2,3}-build
|
||||
for builddir in python{2,3}-build; do
|
||||
cp -r ${_archive} ${builddir}
|
||||
pushd $builddir
|
||||
${MINGW_PREFIX}/bin/${builddir%-build} setup.py build
|
||||
# ${MINGW_PREFIX}/bin/${builddir%-build} setup.py test
|
||||
popd
|
||||
done
|
||||
}
|
||||
|
||||
package_python3-theano() {
|
||||
depends=("${MINGW_PACKAGE_PREFIX}-python3" "${_deps[@]/#/${MINGW_PACKAGE_PREFIX}-python3-}")
|
||||
|
||||
local _mingw_prefix=$(cygpath -am ${MINGW_PREFIX})
|
||||
|
||||
cd "${srcdir}/python3-build"
|
||||
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
||||
${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" -O1
|
||||
|
||||
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
|
||||
|
||||
for f in theano-cache theano-nose ; do
|
||||
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,3}.exe
|
||||
if [ -f "${pkgdir}${MINGW_PREFIX}"/bin/${f}.exe.manifest ]; then
|
||||
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,3}.exe.manifest
|
||||
sed -e "s|${f}|${f}3|g" -i "${pkgdir}${MINGW_PREFIX}"/bin/${f}3.exe.manifest
|
||||
fi
|
||||
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,3}-script.py
|
||||
done
|
||||
|
||||
install -Dm644 doc/LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE"
|
||||
}
|
||||
|
||||
package_python2-theano() {
|
||||
depends=("${MINGW_PACKAGE_PREFIX}-python2" "${_deps[@]/#/${MINGW_PACKAGE_PREFIX}-python2-}")
|
||||
|
||||
cd "${srcdir}/python2-build"
|
||||
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
||||
${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" -O1
|
||||
|
||||
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
|
||||
|
||||
for f in theano-cache theano-nose ; do
|
||||
cp "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}.exe
|
||||
if [ -f "${pkgdir}${MINGW_PREFIX}"/bin/${f}.exe.manifest ]; then
|
||||
cp "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}.exe.manifest
|
||||
sed -e "s|${f}|${f}2|g" -i "${pkgdir}${MINGW_PREFIX}"/bin/${f}2.exe.manifest
|
||||
fi
|
||||
cp "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}-script.py
|
||||
done
|
||||
|
||||
install -Dm644 doc/LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE"
|
||||
}
|
||||
|
||||
package_mingw-w64-i686-python2-theano() {
|
||||
install=${_realname}2-${CARCH}.install
|
||||
package_python2-theano
|
||||
}
|
||||
|
||||
package_mingw-w64-i686-python3-theano() {
|
||||
install=${_realname}3-${CARCH}.install
|
||||
package_python3-theano
|
||||
}
|
||||
|
||||
package_mingw-w64-x86_64-python2-theano() {
|
||||
install=${_realname}2-${CARCH}.install
|
||||
package_python2-theano
|
||||
}
|
||||
|
||||
package_mingw-w64-x86_64-python3-theano() {
|
||||
install=${_realname}3-${CARCH}.install
|
||||
package_python3-theano
|
||||
}
|
||||
14
mingw-w64-python-theano/theano2-i686.install
Normal file
14
mingw-w64-python-theano/theano2-i686.install
Normal file
@@ -0,0 +1,14 @@
|
||||
post_install() {
|
||||
cd mingw32
|
||||
local _prefix=$(pwd -W)
|
||||
cd -
|
||||
local _it
|
||||
for _it in theano-cache theano-nose theano-cache2 theano-nose2 ; do
|
||||
sed -e "s|/mingw32|${_prefix}|g" \
|
||||
-i mingw32/bin/${_it}-script.py
|
||||
done
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
post_install
|
||||
}
|
||||
14
mingw-w64-python-theano/theano2-x86_64.install
Normal file
14
mingw-w64-python-theano/theano2-x86_64.install
Normal file
@@ -0,0 +1,14 @@
|
||||
post_install() {
|
||||
cd mingw64
|
||||
local _prefix=$(pwd -W)
|
||||
cd -
|
||||
local _it
|
||||
for _it in theano-cache theano-nose theano-cache2 theano-nose2 ; do
|
||||
sed -e "s|/mingw64|${_prefix}|g" \
|
||||
-i mingw64/bin/${_it}-script.py
|
||||
done
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
post_install
|
||||
}
|
||||
14
mingw-w64-python-theano/theano3-i686.install
Normal file
14
mingw-w64-python-theano/theano3-i686.install
Normal file
@@ -0,0 +1,14 @@
|
||||
post_install() {
|
||||
cd mingw32
|
||||
local _prefix=$(pwd -W)
|
||||
cd -
|
||||
local _it
|
||||
for _it in theano-cache3 theano-nose3 ; do
|
||||
sed -e "s|/mingw32|${_prefix}|g" \
|
||||
-i mingw32/bin/${_it}-script.py
|
||||
done
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
post_install
|
||||
}
|
||||
14
mingw-w64-python-theano/theano3-x86_64.install
Normal file
14
mingw-w64-python-theano/theano3-x86_64.install
Normal file
@@ -0,0 +1,14 @@
|
||||
post_install() {
|
||||
cd mingw64
|
||||
local _prefix=$(pwd -W)
|
||||
cd -
|
||||
local _it
|
||||
for _it in theano-cache3 theano-nose3 ; do
|
||||
sed -e "s|/mingw64|${_prefix}|g" \
|
||||
-i mingw64/bin/${_it}-script.py
|
||||
done
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
post_install
|
||||
}
|
||||
Reference in New Issue
Block a user