summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2011-04-21 17:57:17 +0000
committerGiampaolo Rodola <g.rodola@gmail.com>2011-04-21 17:57:17 +0000
commiteb544ff99a16a443bb62eeaa5606d1ac6665cbdc (patch)
tree3394e9da50d54245136914cf7b8fa2a4bd45b2d7
parent55c8494a7dab0221735b747733517615b166f269 (diff)
downloadpysendfile-eb544ff99a16a443bb62eeaa5606d1ac6665cbdc.tar.gz
raise platform not supported in setup.pt
-rw-r--r--sendfilemodule.c6
-rw-r--r--setup.py12
2 files changed, 9 insertions, 9 deletions
diff --git a/sendfilemodule.c b/sendfilemodule.c
index 6c0bb0b..1a74b78 100644
--- a/sendfilemodule.c
+++ b/sendfilemodule.c
@@ -57,8 +57,6 @@ _parse_off_t(PyObject* arg, void* addr)
}
-int unsupported = 0;
-
/* --- begin FreeBSD / Dragonfly / OSX --- */
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
#include <sys/types.h>
@@ -471,10 +469,6 @@ void initsendfile(void)
INITERROR;
}
- if (unsupported == 1) {
- PyErr_SetString(PyExc_NotImplementedError, "platform not supported");
- }
-
#if PY_MAJOR_VERSION >= 3
return module;
#endif
diff --git a/setup.py b/setup.py
index 4e68f85..e5183b2 100644
--- a/setup.py
+++ b/setup.py
@@ -41,10 +41,16 @@ def main():
sources=['sendfilemodule.c'],
libraries=libraries)],
)
+ # check for NotImplementedError exception if platform is not supported
+ import sendfile
+ try:
+ sendfile.sendfile(0, 0, 0, 0)
+ except NotImplementedError:
+ raise NotImplementedError("platorm not supported")
+ except:
+ pass
+
if __name__ == '__main__':
main()
- # this will cause NotImplementedError to be raised if platform
- # is not supported
- import sendfile