From 4723e426a688632cbf30cf79c095c6c695b746a2 Mon Sep 17 00:00:00 2001 From: Jen Herting Date: Mon, 3 May 2021 12:04:56 -0400 Subject: New package: py-tensorflow-hub (#23034) * orginal version of tensorflow-hub * [py-tensorflow-hub] updated url to pypi.io * [py-tensorflow-hub] added version 0.12.0 * [py-tensorflow-hub] flake8 * [py-tensorflow-hub] Full package rewrite from @aweits * [py-tensorflow-hub] added @aweits as maintainer * [py-tensorflow-hub] flake8 * [py-tensorflow-hub] lots of join_path * [py-tensorflow-hub] cleanup tmp_path/insttmp_path post install * [py-tensorflow-hub] depends on setuptools * [py-tensorflow-hub] fixing quoting Co-authored-by: Sid Pendelberry --- .../builtin/packages/py-tensorflow-hub/package.py | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 var/spack/repos/builtin/packages/py-tensorflow-hub/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/py-tensorflow-hub/package.py b/var/spack/repos/builtin/packages/py-tensorflow-hub/package.py new file mode 100644 index 0000000000..f432c8fc8c --- /dev/null +++ b/var/spack/repos/builtin/packages/py-tensorflow-hub/package.py @@ -0,0 +1,75 @@ +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import tempfile + + +class PyTensorflowHub(Package): + """TensorFlow Hub is a library to foster the publication, discovery, and + consumption of reusable parts of machine learning models.""" + + homepage = "https://github.com/tensorflow/hub" + url = "https://github.com/tensorflow/hub/archive/refs/tags/v0.12.0.tar.gz" + + maintainers = ['aweits'] + + version('0.12.0', sha256='b192ef3a9a6cbeaee46142d64b47b979828dbf41fc56d48c6587e08f6b596446') + version('0.11.0', sha256='4715a4212b45531a7c25ada7207d850467d1b5480f1940f16623f8770ad64df4') + + extends('python') + + depends_on('bazel', type='build') + depends_on('py-setuptools', type='build') + depends_on('python@3.6:', type=('build', 'run')) + depends_on('py-numpy@1.12.0:', type=('build', 'run')) + depends_on('py-protobuf@3.8.0:', type=('build', 'run')) + + def install(self, spec, prefix): + tmp_path = tempfile.mkdtemp(prefix='spack') + env['TEST_TMPDIR'] = tmp_path + env['HOME'] = tmp_path + args = [ + # Don't allow user or system .bazelrc to override build settings + '--nohome_rc', + '--nosystem_rc', + # Bazel does not work properly on NFS, switch to /tmp + '--output_user_root=' + tmp_path, + 'build', + # Spack logs don't handle colored output well + '--color=no', + '--jobs={0}'.format(make_jobs), + # Enable verbose output for failures + '--verbose_failures', + # Show (formatted) subcommands being executed + '--subcommands=pretty_print', + '--spawn_strategy=local', + # Ask bazel to explain what it's up to + # Needs a filename as argument + '--explain=explainlogfile.txt', + # Increase verbosity of explanation, + '--verbose_explanations', + # bazel uses system PYTHONPATH instead of spack paths + '--action_env', 'PYTHONPATH={0}'.format(env['PYTHONPATH']), + '//tensorflow_hub/pip_package:build_pip_package', + ] + + bazel(*args) + + runfiles = join_path('bazel-bin', 'tensorflow_hub', 'pip_package', + 'build_pip_package.runfiles', 'org_tensorflow_hub') + insttmp_path = tempfile.mkdtemp(prefix='spack') + install(join_path('tensorflow_hub', 'pip_package', 'setup.py'), insttmp_path) + install(join_path('tensorflow_hub', 'pip_package', 'setup.cfg'), insttmp_path) + install('LICENSE', join_path(insttmp_path, 'LICENSE.txt')) + mkdirp(join_path(insttmp_path, 'tensorflow_hub')) + install_tree(join_path(runfiles, 'tensorflow_hub'), + join_path(insttmp_path, 'tensorflow_hub')) + + with working_dir(insttmp_path): + setup_py('install', '--prefix={0}'.format(prefix), + '--single-version-externally-managed', '--root=/') + + remove_linked_tree(tmp_path) + remove_linked_tree(insttmp_path) -- cgit v1.2.3-60-g2f50