X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Futils.py;h=6135a19f6f8bdf303d4978f7ce06868f9eef9c4a;hb=aeff0b009db845e9a924853846eff6fbb8e3f07b;hp=fd790b5930df56d0e49804a13178db33f7bca090;hpb=a899dd75db5899e29a24d90f69a80fdf879cda63;p=dak.git diff --git a/daklib/utils.py b/daklib/utils.py index fd790b59..6135a19f 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -1484,6 +1484,20 @@ def temp_filename(directory=None, prefix="dak", suffix=""): ################################################################################ +def temp_dirname(parent=None, prefix="dak", suffix=""): + """ + Return a secure and unique directory by pre-creating it. + If 'parent' is non-null, it will be the directory the directory is pre-created in. + If 'prefix' is non-null, the filename will be prefixed with it, default is dak. + If 'suffix' is non-null, the filename will end with it. + + Returns a pathname to the new directory + """ + + return tempfile.mkdtemp(suffix, prefix, directory) + +################################################################################ + def is_email_alias(email): """ checks if the user part of the email is listed in the alias file """ global alias_cache @@ -1525,4 +1539,4 @@ apt_pkg.ReadConfigFileISC(Cnf,default_config) if which_conf_file() != default_config: apt_pkg.ReadConfigFileISC(Cnf,which_conf_file()) -################################################################################ +###############################################################################