diff --git a/test/04_skip/environment.json b/test/04_skip/environment.json new file mode 100644 index 00000000..a19912ba --- /dev/null +++ b/test/04_skip/environment.json @@ -0,0 +1,3 @@ +{ + "CIBW_SKIP": "cp26-* cp33-*" +} diff --git a/test/04_skip/setup.py b/test/04_skip/setup.py new file mode 100644 index 00000000..8d25ca60 --- /dev/null +++ b/test/04_skip/setup.py @@ -0,0 +1,15 @@ +from setuptools import setup, Extension +import sys + +if sys.argv[-1] != '--name': + # explode if run on Python 2.6 or Python 3.3 (these should be skipped) + if sys.version_info[0:2] == (2, 6): + raise Exception('Python 2.6 should be skipped') + if sys.version_info[0:2] == (3, 3): + raise Exception('Python 3.3 should be skipped') + +setup( + name="spam", + ext_modules=[Extension('spam', sources=['spam.c'])], + version="0.1.0", +) diff --git a/test/04_skip/spam.c b/test/04_skip/spam.c new file mode 100644 index 00000000..d1ab0f22 --- /dev/null +++ b/test/04_skip/spam.c @@ -0,0 +1,48 @@ +#include + +static PyObject * +spam_system(PyObject *self, PyObject *args) +{ + const char *command; + int sts; + + if (!PyArg_ParseTuple(args, "s", &command)) + return NULL; + sts = system(command); + return PyLong_FromLong(sts); +} + +/* Module initialization */ + +#if PY_MAJOR_VERSION >= 3 + #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) + #define MOD_DEF(m, name, doc, methods, module_state_size) \ + static struct PyModuleDef moduledef = { \ + PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ + m = PyModule_Create(&moduledef); + #define MOD_RETURN(m) return m; +#else + #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) + #define MOD_DEF(m, name, doc, methods, module_state_size) \ + m = Py_InitModule3(name, methods, doc); + #define MOD_RETURN(m) return; +#endif + +static PyMethodDef module_methods[] = { + {"system", (PyCFunction)spam_system, METH_VARARGS, + "Execute a shell command."}, + {NULL} /* Sentinel */ +}; + +MOD_INIT(spam) +{ + PyObject* m; + + MOD_DEF(m, + "spam", + "Example module", + module_methods, + -1) + + MOD_RETURN(m) +} diff --git a/test/04_skip/version.txt b/test/04_skip/version.txt new file mode 100644 index 00000000..3e4354cb --- /dev/null +++ b/test/04_skip/version.txt @@ -0,0 +1,2 @@ +3.6.0 (default, Feb 7 2017, 23:55:32) +[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] \ No newline at end of file