-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from YannickJadoul/alternative-docker-images
Option for alternative docker images for manylinux1
- Loading branch information
Showing
6 changed files
with
94 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"CIBW_MANYLINUX1_X86_64_IMAGE": "dockcross/manylinux-x64", | ||
"CIBW_MANYLINUX1_I686_IMAGE": "dockcross/manylinux-x86" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import os, sys | ||
|
||
from setuptools import setup, Extension | ||
|
||
if sys.argv[-1] != '--name': | ||
# check that we're running in the correct docker image as specified in the | ||
# environment options CIBW_MANYLINUX1_*_IMAGE | ||
if 'linux' in sys.platform and not os.path.exists('/dockcross'): | ||
raise Exception('/dockcross directory not found. Is this test running in the correct docker image?') | ||
|
||
setup( | ||
name="spam", | ||
ext_modules=[Extension('spam', sources=['spam.c'])], | ||
version="0.1.0", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include <Python.h> | ||
|
||
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) | ||
} |