diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2011-04-21 17:57:17 +0000 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2011-04-21 17:57:17 +0000 |
commit | eb544ff99a16a443bb62eeaa5606d1ac6665cbdc (patch) | |
tree | 3394e9da50d54245136914cf7b8fa2a4bd45b2d7 | |
parent | 55c8494a7dab0221735b747733517615b166f269 (diff) | |
download | pysendfile-eb544ff99a16a443bb62eeaa5606d1ac6665cbdc.tar.gz |
raise platform not supported in setup.pt
-rw-r--r-- | sendfilemodule.c | 6 | ||||
-rw-r--r-- | setup.py | 12 |
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 @@ -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 |