summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-06-24 18:25:09 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-06-24 18:25:09 +0100
commit0574eab8bc7d8e72db862ec36815835938a5fdf1 (patch)
tree6588315e33f95de9fbb150f862064471a975050e /python
parent8228eec99045ae720d8ef35851aa8c278f6b4e5c (diff)
downloadlibguestfs-0574eab8bc7d8e72db862ec36815835938a5fdf1.tar.gz
libguestfs-0574eab8bc7d8e72db862ec36815835938a5fdf1.tar.xz
libguestfs-0574eab8bc7d8e72db862ec36815835938a5fdf1.zip
Generated code for 'mkdtemp' command.
Diffstat (limited to 'python')
-rw-r--r--python/guestfs-py.c26
-rw-r--r--python/guestfs.py19
2 files changed, 45 insertions, 0 deletions
diff --git a/python/guestfs-py.c b/python/guestfs-py.c
index b1623fe5..263d3d9f 100644
--- a/python/guestfs-py.c
+++ b/python/guestfs-py.c
@@ -4606,6 +4606,31 @@ py_guestfs_scrub_freespace (PyObject *self, PyObject *args)
return py_r;
}
+static PyObject *
+py_guestfs_mkdtemp (PyObject *self, PyObject *args)
+{
+ PyObject *py_g;
+ guestfs_h *g;
+ PyObject *py_r;
+ char *r;
+ const char *template;
+
+ if (!PyArg_ParseTuple (args, (char *) "Os:guestfs_mkdtemp",
+ &py_g, &template))
+ return NULL;
+ g = get_handle (py_g);
+
+ r = guestfs_mkdtemp (g, template);
+ if (r == NULL) {
+ PyErr_SetString (PyExc_RuntimeError, guestfs_last_error (g));
+ return NULL;
+ }
+
+ py_r = PyString_FromString (r);
+ free (r);
+ return py_r;
+}
+
static PyMethodDef methods[] = {
{ (char *) "create", py_guestfs_create, METH_VARARGS, NULL },
{ (char *) "close", py_guestfs_close, METH_VARARGS, NULL },
@@ -4777,6 +4802,7 @@ static PyMethodDef methods[] = {
{ (char *) "scrub_device", py_guestfs_scrub_device, METH_VARARGS, NULL },
{ (char *) "scrub_file", py_guestfs_scrub_file, METH_VARARGS, NULL },
{ (char *) "scrub_freespace", py_guestfs_scrub_freespace, METH_VARARGS, NULL },
+ { (char *) "mkdtemp", py_guestfs_mkdtemp, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};
diff --git a/python/guestfs.py b/python/guestfs.py
index 0bc041e6..fec12a71 100644
--- a/python/guestfs.py
+++ b/python/guestfs.py
@@ -1704,3 +1704,22 @@ class GuestFS:
"""
return libguestfsmod.scrub_freespace (self._o, dir)
+ def mkdtemp (self, template):
+ u"""This command creates a temporary directory. The
+ "template" parameter should be a full pathname for the
+ temporary directory with the six characters being
+ "XXXXXX".
+
+ For example: "/tmp/tmpXXXXXX" or "/Temp/tmpXXXXXX", the
+ second one being suitable for Windows.
+
+ The name of the temporary directory that was created is
+ returned.
+
+ The caller is responsible for deleting the temporary
+ directory and its contents after use.
+
+ See also: mkdtemp(3)
+ """
+ return libguestfsmod.mkdtemp (self._o, template)
+