From 16449a80e28af2209916cc66d19c9a44ca2b90d9 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 20 Feb 2019 15:11:50 +0000 Subject: gentoo resync : 20.02.2019 --- sci-libs/tensorflow-estimator/Manifest | 4 + ...-modularize-build-script-to-allow-distros.patch | 153 +++++++++++++++++++++ sci-libs/tensorflow-estimator/metadata.xml | 16 +++ .../tensorflow-estimator-1.13.0_rc0.ebuild | 61 ++++++++ 4 files changed, 234 insertions(+) create mode 100644 sci-libs/tensorflow-estimator/Manifest create mode 100644 sci-libs/tensorflow-estimator/files/0001-pip_package-modularize-build-script-to-allow-distros.patch create mode 100644 sci-libs/tensorflow-estimator/metadata.xml create mode 100644 sci-libs/tensorflow-estimator/tensorflow-estimator-1.13.0_rc0.ebuild (limited to 'sci-libs/tensorflow-estimator') diff --git a/sci-libs/tensorflow-estimator/Manifest b/sci-libs/tensorflow-estimator/Manifest new file mode 100644 index 000000000000..1ca67369b4f8 --- /dev/null +++ b/sci-libs/tensorflow-estimator/Manifest @@ -0,0 +1,4 @@ +AUX 0001-pip_package-modularize-build-script-to-allow-distros.patch 4250 BLAKE2B 79702d82e629e2159cbe33efe8dd91536d904536f4bbf3d4ad02186916a09786cde6ce29a63acaafe3169dbd7904448461f2b557f33218651351fd87d42ed613 SHA512 42bb57433f61b3a9b1a93c897202bacdf44a8277ea0e64257ac3b60c9b964a6441345c9b222fb26afb1d66a53323fe38c29811adfd6354032cb5d3f85dde0816 +DIST tensorflow-estimator-1.13.0_rc0.tar.gz 531012 BLAKE2B 1398fdec5b81a7bab7ccfb2d37b8094c4ef4b96562e2c6b8b4e565cad3c234245b5d8dfb30a79b73302fc0764b1d3503d4ee2d4363a9d2e635b36fb8e2b726b4 SHA512 c8ad78d0df294c7471f1577880905be08edcc038878e9d197b975f33f91192e9c413d13fa70e8fa1ff760ad6bf6141f199322bf2076568690e75fa38bd5a4cf4 +EBUILD tensorflow-estimator-1.13.0_rc0.ebuild 1329 BLAKE2B ed4451574acbc5067715148a5a365017d3b4b42a99aece10be94d6b3d1683f3d0cc758ff6dc89c7c4b1d9ac1974969b9ab3f320d6434014f16ef1d405d137dc1 SHA512 5db769ca08138e3fe4a696708049b96eb442c2e2484b737f821eff5da89575d671a57c156fc583819f345d53e4a800503df3517355d76cd4440af2ac6410ae61 +MISC metadata.xml 580 BLAKE2B fb81098968d0fdf34a3f28dabee76df16be5393cb9ea79ee4fa670af985ef3f70bb83f14be84a0cc0e564e6626007c2977851f8299460b483f88325be155f4cc SHA512 6aef6523502a3bcf0b2ca59cf7480b92032b53020cccfa715203e5a48c960ecc92c94fa75f98a234da2d51662d43e0c1a85a1537f3ab67287cdb8183476a0efa diff --git a/sci-libs/tensorflow-estimator/files/0001-pip_package-modularize-build-script-to-allow-distros.patch b/sci-libs/tensorflow-estimator/files/0001-pip_package-modularize-build-script-to-allow-distros.patch new file mode 100644 index 000000000000..140e23c84bb5 --- /dev/null +++ b/sci-libs/tensorflow-estimator/files/0001-pip_package-modularize-build-script-to-allow-distros.patch @@ -0,0 +1,153 @@ +From 897b25418ae0f77bcee7fdd7070d5c22677dc218 Mon Sep 17 00:00:00 2001 +From: Jason Zaman +Date: Sat, 2 Feb 2019 15:19:44 +0800 +Subject: [PATCH] pip_package: modularize build script to allow distros to + install more flexibly + +Gentoo Linux handles python modules slightly differently and packaging +wheels is complicated. We prefer to run setup.py directly ourselves +rather than build a wheel and then install from there. + +This modularizes build_pip_package.sh to allow running parts separately. +using --src srcdir will prepare the package in a known dir so the distro +package can take it from there. If only dstdir is given (either with +--dst or as the only argument to preserve backwards compat) then +behaviour is the same as before, the sources are prepared and the wheel +is built and placed in dstdir. + +Signed-off-by: Jason Zaman +--- + .../tools/pip_package/build_pip_package.sh | 73 +++++++++++++++++-- + 1 file changed, 66 insertions(+), 7 deletions(-) + +diff --git a/tensorflow_estimator/tools/pip_package/build_pip_package.sh b/tensorflow_estimator/tools/pip_package/build_pip_package.sh +index 5d06dd6..1667169 100755 +--- a/tensorflow_estimator/tools/pip_package/build_pip_package.sh ++++ b/tensorflow_estimator/tools/pip_package/build_pip_package.sh +@@ -23,10 +23,8 @@ function real_path() { + is_absolute "$1" && echo "$1" || echo "$PWD/${1#./}" + } + +-function build_wheel() { ++function prepare_src() { + TMPDIR="$1" +- DEST="$2" +- PROJECT_NAME="$3" + + mkdir -p "$TMPDIR" + echo $(date) : "=== Preparing sources in dir: ${TMPDIR}" +@@ -67,6 +65,17 @@ function build_wheel() { + touch "${TMPDIR}/tensorflow_estimator/contrib/estimator/python/__init__.py" + touch "${TMPDIR}/tensorflow_estimator/contrib/estimator/python/estimator/__init__.py" + fi ++} ++ ++function build_wheel() { ++ if [ $# -lt 2 ] ; then ++ echo "No src and dest dir provided" ++ exit 1 ++ fi ++ ++ TMPDIR="$1" ++ DEST="$2" ++ PROJECT_NAME="$3" + + pushd ${TMPDIR} > /dev/null + echo $(date) : "=== Building wheel" +@@ -75,15 +84,39 @@ function build_wheel() { + cp dist/* ${DEST} + popd > /dev/null + echo $(date) : "=== Output wheel file is in: ${DEST}" +- rm -rf "${TMPDIR}" ++} ++ ++function usage() { ++ echo "Usage:" ++ echo "$0 [--src srcdir] [--dst dstdir] [options]" ++ echo "$0 dstdir [options]" ++ echo "" ++ echo " --src prepare sources in srcdir" ++ echo " will use temporary dir if not specified" ++ echo "" ++ echo " --dst build wheel in dstdir" ++ echo " if dstdir is not set do not build, only prepare sources" ++ echo "" ++ echo " Options:" ++ echo " --project_name set project name to name" ++ echo " --nightly build tensorflow_estimator nightly" ++ echo "" ++ exit 1 + } + + function main() { + NIGHTLY_BUILD=0 ++ PROJECT_NAME="" ++ SRCDIR="" ++ DSTDIR="" ++ CLEANSRC=1 + + while true; do + if [[ -z "$1" ]]; then + break ++ elif [[ "$1" == "--help" ]]; then ++ usage ++ exit 1 + elif [[ "$1" == "--nightly" ]]; then + NIGHTLY_BUILD=1 + elif [[ "$1" == "--project_name" ]]; then +@@ -92,6 +125,19 @@ function main() { + break + fi + PROJECT_NAME="$1" ++ elif [[ "$1" == "--src" ]]; then ++ shift ++ if [[ -z "$1" ]]; then ++ break ++ fi ++ SRCDIR="$(real_path $1)" ++ CLEANSRC=0 ++ elif [[ "$1" == "--dst" ]]; then ++ shift ++ if [[ -z "$1" ]]; then ++ break ++ fi ++ DSTDIR="$(real_path $1)" + else + DSTDIR="$(real_path $1)" + fi +@@ -105,16 +151,29 @@ function main() { + fi + fi + +- SRCDIR="$(mktemp -d -t tmp.XXXXXXXXXX)" +- +- if [[ -z "$DSTDIR" ]]; then ++ if [[ -z "$DSTDIR" ]] && [[ -z "$SRCDIR" ]]; then + echo "No destination dir provided" ++ usage + exit 1 + fi + ++ if [[ -z "$SRCDIR" ]]; then ++ # make temp srcdir if none set ++ SRCDIR="$(mktemp -d -t tmp.XXXXXXXXXX)" ++ fi + ++ prepare_src "$SRCDIR" ++ ++ if [[ -z "$DSTDIR" ]]; then ++ # only want to prepare sources ++ exit ++ fi + + build_wheel "$SRCDIR" "$DSTDIR" "$PROJECT_NAME" ++ ++ if [[ $CLEANSRC -ne 0 ]]; then ++ rm -rf "${TMPDIR}" ++ fi + } + + main "$@" +-- +2.19.2 + diff --git a/sci-libs/tensorflow-estimator/metadata.xml b/sci-libs/tensorflow-estimator/metadata.xml new file mode 100644 index 000000000000..2d40af6762c9 --- /dev/null +++ b/sci-libs/tensorflow-estimator/metadata.xml @@ -0,0 +1,16 @@ + + + + + perfinion@gentoo.org + Jason Zaman + + + TensorFlow Estimator is a high-level TensorFlow API that greatly + simplifies machine learning programming. Estimators encapsulate + training, evaluation, prediction, and exporting for your model. + + + tensorflow/estimator + + diff --git a/sci-libs/tensorflow-estimator/tensorflow-estimator-1.13.0_rc0.ebuild b/sci-libs/tensorflow-estimator/tensorflow-estimator-1.13.0_rc0.ebuild new file mode 100644 index 000000000000..766a3206621e --- /dev/null +++ b/sci-libs/tensorflow-estimator/tensorflow-estimator-1.13.0_rc0.ebuild @@ -0,0 +1,61 @@ +# Copyright 1999-2019 Jason Zaman +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python2_7 python{3_5,3_6} ) +MY_PN="estimator" +MY_PV=${PV/_rc/-rc} +MY_P=${MY_PN}-${MY_PV} + +inherit bazel distutils-r1 flag-o-matic toolchain-funcs + +DESCRIPTION="A high-level TensorFlow API that greatly simplifies machine learning programming" +HOMEPAGE="https://www.tensorflow.org/" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64" +IUSE="" + +SRC_URI="https://github.com/tensorflow/${MY_PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz" + +RDEPEND="sci-libs/tensorflow[python,${PYTHON_USEDEP}]" +DEPEND="${RDEPEND}" +BDEPEND=" + dev-java/java-config" + +S="${WORKDIR}/${MY_P}" + +PATCHES=( + "${FILESDIR}/0001-pip_package-modularize-build-script-to-allow-distros.patch" +) +DOCS=( CONTRIBUTING.md README.md ) + +src_prepare() { + bazel_setup_bazelrc + default +} + +src_compile() { + export JAVA_HOME=$(java-config --jre-home) + + ebazel build //tensorflow_estimator/tools/pip_package:build_pip_package + ebazel shutdown + + local srcdir="${T}/src" + mkdir -p "${srcdir}" || die + bazel-bin/tensorflow_estimator/tools/pip_package/build_pip_package --src "${srcdir}" || die +} + +src_install() { + do_install() { + cd "${T}/src" || die + esetup.py install + python_optimize + } + python_foreach_impl do_install + + cd "${S}" || die + einstalldocs +} -- cgit v1.2.3