Remove "dir=/tmp" when using tempfile.mkdtemp in packages (#29866)

From the tempfile module docs:

  The default directory is chosen from a platform-dependent list, but the
  user of the application can control the directory location by setting
  the TMPDIR, TEMP or TMP environment variables
This commit is contained in:
Gianluca Ficarelli 2022-04-04 11:40:09 +02:00 committed by GitHub
parent a3de8eb8bb
commit fbf50fbfa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 8 deletions

View File

@ -87,9 +87,9 @@ def patch(self):
def installcheck(self):
# We have to clean this tmpdir ourself later as it contains readonly directories
self.test_path = tempfile.mkdtemp(dir='/tmp',
prefix='tmp-spack-check-nix-{0}-'.
format(self.spec.version))
self.test_path = tempfile.mkdtemp(
prefix='tmp-spack-check-nix-{0}-'.format(self.spec.version)
)
mkdir(self.test_path + '/nix-test')
mkdir(self.test_path + '/tests')
os.environ['TMPDIR'] = self.test_path

View File

@ -28,7 +28,7 @@ def clean(self):
remove_linked_tree(self.tmp_path)
def patch(self):
self.tmp_path = tempfile.mkdtemp(dir='/tmp', prefix='spack')
self.tmp_path = tempfile.mkdtemp(prefix='spack')
env['TEST_TMPDIR'] = self.tmp_path
env['HOME'] = self.tmp_path
args = [

View File

@ -84,7 +84,7 @@ def patch(self):
@when('@2.5.0:')
def install(self, spec, prefix):
self.tmp_path = tempfile.mkdtemp(dir='/tmp', prefix='spack')
self.tmp_path = tempfile.mkdtemp(prefix='spack')
env['HOME'] = self.tmp_path
args = [

View File

@ -71,7 +71,7 @@ def patch(self):
'.bazelrc')
def setup_build_environment(self, env):
self.tmp_path = tempfile.mkdtemp(dir='/tmp', prefix='spack')
self.tmp_path = tempfile.mkdtemp(prefix='spack')
env.set('TEST_TMPDIR', self.tmp_path)
def configure(self, spec, prefix):

View File

@ -47,7 +47,7 @@ class PyTensorflowEstimator(Package):
depends_on('py-funcsigs@1.0.2:', type=('build', 'run'), when='^python@:3.2')
def install(self, spec, prefix):
self.tmp_path = tempfile.mkdtemp(dir='/tmp', prefix='spack')
self.tmp_path = tempfile.mkdtemp(prefix='spack')
env['TEST_TMPDIR'] = self.tmp_path
env['HOME'] = self.tmp_path

View File

@ -44,7 +44,7 @@ class PyTensorflowProbability(Package):
depends_on('bazel@3.2.0:', type='build')
def install(self, spec, prefix):
self.tmp_path = tempfile.mkdtemp(dir='/tmp', prefix='spack')
self.tmp_path = tempfile.mkdtemp(prefix='spack')
env['TEST_TMPDIR'] = self.tmp_path
env['HOME'] = self.tmp_path