py-tensorflow-estimator: fix build (#15953)

Change the build to work again, and be more in line with the other
tensorflow packages. Add version 2.1.
This commit is contained in:
Andrew W Elble 2020-04-08 23:10:37 -04:00 committed by GitHub
parent d05f25a4d0
commit 8abffd4189
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,16 +13,17 @@ class PyTensorflowEstimator(Package):
homepage = "https://github.com/tensorflow/estimator" homepage = "https://github.com/tensorflow/estimator"
url = "https://github.com/tensorflow/estimator/archive/v1.13.0.tar.gz" url = "https://github.com/tensorflow/estimator/archive/v1.13.0.tar.gz"
version('2.1', sha256='1d74c8181b981748976fa33ad97d3434c3cf2b7e29a0b00861365fe8329dbc4e')
version('2.0.0', sha256='6f4bdf1ab219e1f1cba25d2af097dc820f56479f12a839853d97422fe4d8b465') version('2.0.0', sha256='6f4bdf1ab219e1f1cba25d2af097dc820f56479f12a839853d97422fe4d8b465')
version('1.13.0', sha256='a787b150ff436636df723e507019c72a5d6486cfe506886279d380166953f12f', preferred=True) version('1.13.0', sha256='a787b150ff436636df723e507019c72a5d6486cfe506886279d380166953f12f')
extends('python') extends('python')
depends_on('py-tensorflow@2.1.0:', when='@2.1')
depends_on('py-tensorflow@2.0.0', when='@2.0.0') depends_on('py-tensorflow@2.0.0', when='@2.0.0')
depends_on('py-tensorflow@1.13.1', when='@1.13.0') depends_on('py-tensorflow@1.13.1', when='@1.13.0')
depends_on('bazel@0.19.0', type='build') depends_on('bazel@0.19.0:', type='build')
depends_on('py-pip', type='build')
depends_on('py-funcsigs@1.0.2:', type=('build', 'run')) depends_on('py-funcsigs@1.0.2:', type=('build', 'run'))
def install(self, spec, prefix): def install(self, spec, prefix):
@ -33,15 +34,37 @@ def install(self, spec, prefix):
env['TEST_TMPDIR'] = tmp_path env['TEST_TMPDIR'] = tmp_path
env['HOME'] = tmp_path env['HOME'] = tmp_path
# bazel uses system PYTHONPATH instead of spack paths args = [
bazel('--action_env', 'PYTHONPATH={0}'.format(env['PYTHONPATH']), # Don't allow user or system .bazelrc to override build settings
'//tensorflow_estimator/tools/pip_package:build_pip_package') '--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',
# 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_estimator/tools/pip_package:build_pip_package',
]
bazel(*args)
build_pip_package = Executable(join_path( build_pip_package = Executable(join_path(
'bazel-bin/tensorflow_estimator/tools', 'bazel-bin/tensorflow_estimator/tools',
'pip_package/build_pip_package')) 'pip_package/build_pip_package'))
build_pip_package(tmp_path) buildpath = join_path(self.stage.source_path, 'spack-build')
build_pip_package('--src', buildpath)
pip = Executable('pip') with working_dir(buildpath):
pip('install', '--prefix={0}'.format(prefix), setup_py('install', '--prefix={0}'.format(prefix),
'--find-links={0}'.format(tmp_path), 'tensorflow-estimator') '--single-version-externally-managed', '--root=/')