]> arthur.barton.de Git - bup.git/commitdiff
Conditionalize build/use of get_linux_file_attr and set_linux_file_attr.
authorRob Browning <rlb@defaultvalue.org>
Sun, 10 Oct 2010 16:08:16 +0000 (11:08 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 10 Oct 2010 16:08:16 +0000 (11:08 -0500)
lib/bup/_helpers.c
lib/bup/metadata.py

index 1d0e72ac4d000d1ce2a4fca993149c44699cf0e3..3fd9b8e94e0836092e55e7822c8aa134310ec49c 100644 (file)
@@ -6,11 +6,15 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <arpa/inet.h>
-#include <linux/fs.h>
 #include <stdint.h>
+
+#ifdef linux
+#include <linux/fs.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/time.h>
+#endif
+
 
 static PyObject *selftest(PyObject *self, PyObject *args)
 {
@@ -200,6 +204,7 @@ static PyObject *fadvise_done(PyObject *self, PyObject *args)
 }
 
 
+#ifdef linux
 static PyObject *bup_get_linux_file_attr(PyObject *self, PyObject *args)
 {
     int rc;
@@ -251,6 +256,7 @@ static PyObject *bup_set_linux_file_attr(PyObject *self, PyObject *args)
     close(fd);
     Py_RETURN_TRUE;
 }
+#endif /* def linux */
 
 
 #if _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
@@ -386,10 +392,12 @@ static PyMethodDef helper_methods[] = {
        "open() the given filename for read with O_NOATIME if possible" },
     { "fadvise_done", fadvise_done, METH_VARARGS,
        "Inform the kernel that we're finished with earlier parts of a file" },
+#ifdef linux
     { "get_linux_file_attr", bup_get_linux_file_attr, METH_VARARGS,
       "Return the Linux attributes for the given file." },
     { "set_linux_file_attr", bup_set_linux_file_attr, METH_VARARGS,
       "Set the Linux attributes for the given file." },
+#endif
 #ifdef HAVE_BUP_UTIMENSAT
     { "utimensat", bup_utimensat, METH_VARARGS,
       "Change file timestamps with nanosecond precision." },
index b41b1f94953633d1ac1431987ad81269bb0c77a2..a1188217b4082681a2f35ddc0a13098682b549de 100644 (file)
@@ -10,7 +10,10 @@ import errno, os, sys, stat, pwd, grp, struct, xattr, posix1e, re
 from cStringIO import StringIO
 from bup import vint
 from bup.helpers import add_error, mkdirp, log, utime, lutime, lstat
-from bup._helpers import get_linux_file_attr, set_linux_file_attr
+import bup._helpers as _helpers
+
+if _helpers.get_linux_file_attr:
+    from bup._helpers import get_linux_file_attr, set_linux_file_attr
 
 # WARNING: the metadata encoding is *not* stable yet.  Caveat emptor!