Configurable temp dir.
authorCarl Hetherington <cth@carlh.net>
Thu, 10 Dec 2020 20:03:30 +0000 (21:03 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 10 Dec 2020 20:03:30 +0000 (21:03 +0100)
cdist

diff --git a/cdist b/cdist
index a82c188ef428f2689129648aee2d0351c79a5961..68ff4172da7f51efe6ea37046076d7eef4f796d4 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -35,8 +35,6 @@ import sys
 import tempfile
 import time
 
 import tempfile
 import time
 
-TEMPORARY_DIRECTORY = '/var/tmp'
-
 class Error(Exception):
     def __init__(self, value):
         self.value = value
 class Error(Exception):
     def __init__(self, value):
         self.value = value
@@ -122,7 +120,8 @@ class Config:
                          BoolOption('docker_no_user'),
                          Option('docker_hub_repository'),
                          Option('flatpak_state_dir'),
                          BoolOption('docker_no_user'),
                          Option('docker_hub_repository'),
                          Option('flatpak_state_dir'),
-                         Option('parallel', multiprocessing.cpu_count()) ]
+                         Option('parallel', multiprocessing.cpu_count()),
+                         Option('temp', '/var/tmp')]
 
         config_dir = '%s/.config' % os.path.expanduser('~')
         if not os.path.exists(config_dir):
 
         config_dir = '%s/.config' % os.path.expanduser('~')
         if not os.path.exists(config_dir):
@@ -414,7 +413,7 @@ class Target(object):
         self.build_dependencies = True
 
         if directory is None:
         self.build_dependencies = True
 
         if directory is None:
-            self.directory = tempfile.mkdtemp('', 'tmp', TEMPORARY_DIRECTORY)
+            self.directory = tempfile.mkdtemp('', 'tmp', config.get('temp'))
             self.rmdir = True
             self.set('CCACHE_BASEDIR', os.path.realpath(self.directory))
             self.set('CCACHE_NOHASHDIR', '')
             self.rmdir = True
             self.set('CCACHE_BASEDIR', os.path.realpath(self.directory))
             self.set('CCACHE_NOHASHDIR', '')