From: Rob Browning Date: Sun, 10 Oct 2010 16:08:16 +0000 (-0500) Subject: Conditionalize build/use of get_linux_file_attr and set_linux_file_attr. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=76543c238cb3845221fc4d66c53545ac26e8fe6b;p=packages%2Fb%2Fbup.git Conditionalize build/use of get_linux_file_attr and set_linux_file_attr. --- diff --git a/lib/bup/_helpers.c b/lib/bup/_helpers.c index 1d0e72a..3fd9b8e 100644 --- a/lib/bup/_helpers.c +++ b/lib/bup/_helpers.c @@ -6,11 +6,15 @@ #include #include #include -#include #include + +#ifdef linux +#include #include #include #include +#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." }, diff --git a/lib/bup/metadata.py b/lib/bup/metadata.py index b41b1f9..a118821 100644 --- a/lib/bup/metadata.py +++ b/lib/bup/metadata.py @@ -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!