-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to build
x86_64
only on macOS
- Loading branch information
Showing
5 changed files
with
99 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import os, pytest | ||
import utils | ||
|
||
|
||
pytestmark = pytest.mark.skipif(utils.platform != 'macos', 'these tests are only relevant to the macOS build') | ||
|
||
project_dir = os.path.dirname(__file__) | ||
|
||
|
||
def test(): | ||
# build the wheels | ||
actual_wheels = utils.cibuildwheel_run(project_dir, add_env={ | ||
'CIBW_MACOS_MACHINE': 'x86_64', | ||
}) | ||
# also check that we got the right wheels | ||
expected_wheels = [w.replace('intel', 'x86_64') for w in utils.expected_wheels('spam', '0.1.0')] | ||
assert set(actual_wheels) == set(expected_wheels) |
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,12 @@ | ||
import os | ||
|
||
from setuptools import setup, Extension | ||
|
||
if os.environ.get('CIBUILDWHEEL', '0') != '1': | ||
raise Exception('CIBUILDWHEEL environment variable is not set to 1') | ||
|
||
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) | ||
} |