diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index 1344c9ff..3bd0df79 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -92,7 +92,7 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef call(['python', '--version'], env=env) # install pip & wheel - call(['python', get_pip_script, '--no-setuptools', '--no-wheel'], env=env) + call(['python', get_pip_script, '--no-setuptools', '--no-wheel'], env=env, cwd="/tmp") assert os.path.exists(os.path.join(installation_bin_path, 'pip')) call(['pip', '--version'], env=env) call(['pip', 'install', '--upgrade', 'setuptools', 'wheel', 'delocate'], env=env) diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index e5d3240d..7c03f815 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -124,7 +124,7 @@ def build(project_dir, output_dir, test_command, test_requires, test_extras, bef # make sure pip is installed if not os.path.exists(os.path.join(config_python_path, 'Scripts', 'pip.exe')): - simple_shell(['python', get_pip_script], env=env) + simple_shell(['python', get_pip_script], env=env, cwd="C:\\cibw") assert os.path.exists(os.path.join(config_python_path, 'Scripts', 'pip.exe')) # prepare the Python environment diff --git a/test/09_setup_cfg/cibuildwheel_test.py b/test/09_setup_cfg/cibuildwheel_test.py new file mode 100644 index 00000000..9e9ffce6 --- /dev/null +++ b/test/09_setup_cfg/cibuildwheel_test.py @@ -0,0 +1,13 @@ +import os +import utils + + +project_dir = os.path.dirname(__file__) + +def test(): + # build the wheels + actual_wheels = utils.cibuildwheel_run(project_dir) + + # check that the expected wheels are produced + expected_wheels = utils.expected_wheels('spam', '0.1.0') + assert set(actual_wheels) == set(expected_wheels) diff --git a/test/09_setup_cfg/setup.cfg b/test/09_setup_cfg/setup.cfg new file mode 100644 index 00000000..b42c221a --- /dev/null +++ b/test/09_setup_cfg/setup.cfg @@ -0,0 +1,6 @@ +[metadata] +name = spam +version = attr: spam.__version__ + +[options] +packages = find: \ No newline at end of file diff --git a/test/09_setup_cfg/setup.py b/test/09_setup_cfg/setup.py new file mode 100644 index 00000000..0fbbe75e --- /dev/null +++ b/test/09_setup_cfg/setup.py @@ -0,0 +1,8 @@ +import os + +from setuptools import setup, Extension + + +setup( + ext_modules=[Extension('spam.spam', sources=['spam/spam.c'])], +) diff --git a/test/09_setup_cfg/spam/__init__.py b/test/09_setup_cfg/spam/__init__.py new file mode 100644 index 00000000..a68927d6 --- /dev/null +++ b/test/09_setup_cfg/spam/__init__.py @@ -0,0 +1 @@ +__version__ = "0.1.0" \ No newline at end of file diff --git a/test/09_setup_cfg/spam/spam.c b/test/09_setup_cfg/spam/spam.c new file mode 100644 index 00000000..d1ab0f22 --- /dev/null +++ b/test/09_setup_cfg/spam/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) +}