py-tensorlow: use mkdtemp for temporary directory. (#20212)
This commit is contained in:
parent
954a3aab62
commit
e575a38d96
@ -4,6 +4,7 @@
|
|||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
class PyTensorflow(Package, CudaPackage):
|
class PyTensorflow(Package, CudaPackage):
|
||||||
@ -523,8 +524,7 @@ def setup_build_environment(self, env):
|
|||||||
# ])
|
# ])
|
||||||
# to not be nfs. This is only valid for Linux and we'd like to
|
# to not be nfs. This is only valid for Linux and we'd like to
|
||||||
# stay at least also OSX compatible
|
# stay at least also OSX compatible
|
||||||
tmp_path = '/tmp/spack/tf'
|
tmp_path = tempfile.mkdtemp(dir='/tmp', prefix='spack')
|
||||||
mkdirp(tmp_path)
|
|
||||||
env.set('TEST_TMPDIR', tmp_path)
|
env.set('TEST_TMPDIR', tmp_path)
|
||||||
|
|
||||||
env.set('TF_SYSTEM_LIBS', 'com_google_protobuf')
|
env.set('TF_SYSTEM_LIBS', 'com_google_protobuf')
|
||||||
@ -743,11 +743,13 @@ def build(self, spec, prefix):
|
|||||||
build_pip_package('--src', buildpath)
|
build_pip_package('--src', buildpath)
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
|
tmp_path = env['TEST_TMPDIR']
|
||||||
buildpath = join_path(self.stage.source_path, 'spack-build')
|
buildpath = join_path(self.stage.source_path, 'spack-build')
|
||||||
with working_dir(buildpath):
|
with working_dir(buildpath):
|
||||||
|
|
||||||
setup_py('install', '--prefix={0}'.format(prefix),
|
setup_py('install', '--prefix={0}'.format(prefix),
|
||||||
'--single-version-externally-managed', '--root=/')
|
'--single-version-externally-managed', '--root=/')
|
||||||
|
remove_linked_tree(tmp_path)
|
||||||
|
|
||||||
@run_after('install')
|
@run_after('install')
|
||||||
@on_package_attributes(run_tests=True)
|
@on_package_attributes(run_tests=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user