Moving MACOSX_DEPLOYMENT_TARGET from test utils' expected_wheels to run_cibuildwheel, and some minor style fixes
This commit is contained in:
committed by
Grzegorz Bokota
parent
1f784a1a29
commit
0d5a2a7843
@@ -6,53 +6,55 @@ import pytest
|
|||||||
import utils
|
import utils
|
||||||
|
|
||||||
|
|
||||||
def test_cpp11(tmp_path):
|
|
||||||
add_env = {"CIBW_SKIP": "cp27-win*", "CIBW_ENVIRONMENT": "STANDARD=11"}
|
|
||||||
# VC for python 2.7 do not support modern standards
|
|
||||||
if utils.platform == "macos":
|
|
||||||
add_env["MACOSX_DEPLOYMENT_TARGET"] = "10.9"
|
|
||||||
project_dir = os.path.dirname(__file__)
|
project_dir = os.path.dirname(__file__)
|
||||||
# this test checks if c++11 standard is supported.
|
|
||||||
|
def test_cpp11(tmp_path):
|
||||||
|
# This test checks that the C++11 standard is supported
|
||||||
|
|
||||||
|
add_env = {'CIBW_SKIP': 'cp27-win*', 'CIBW_ENVIRONMENT': 'STANDARD=11'}
|
||||||
|
# VC++ for Python 2.7 does not support modern standards
|
||||||
|
if utils.platform == 'macos':
|
||||||
|
add_env['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
|
||||||
|
|
||||||
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env)
|
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env)
|
||||||
expected_wheels = [x for x in utils.expected_wheels('spam', '0.1.0',
|
expected_wheels = [x for x in utils.expected_wheels(
|
||||||
macosx_deployment_target="10.9") if "cp27-cp27m-win" not in x]
|
'spam', '0.1.0', macosx_deployment_target='10.9')
|
||||||
|
if 'cp27-cp27m-win' not in x]
|
||||||
assert set(actual_wheels) == set(expected_wheels)
|
assert set(actual_wheels) == set(expected_wheels)
|
||||||
|
|
||||||
|
|
||||||
def test_cpp14():
|
def test_cpp14():
|
||||||
add_env = {"CIBW_SKIP": "cp27-win* cp35-win*", "CIBW_ENVIRONMENT": "STANDARD=14"}
|
# This test checks that the C++14 standard is supported
|
||||||
# VC for python 2.7 do not support modern standards
|
|
||||||
# manylinux1 docker image do not support compilers with standards newer than c++11
|
add_env = {'CIBW_SKIP': 'cp27-win* cp35-win*', 'CIBW_ENVIRONMENT': 'STANDARD=14'}
|
||||||
# python 3.4 and 3.5 are compiled with MSVC 10. which not support c++14
|
# VC++ for Python 2.7 does not support modern standards
|
||||||
if utils.platform == "macos":
|
# The manylinux1 docker image does not have a compiler which supports C++11
|
||||||
add_env["MACOSX_DEPLOYMENT_TARGET"] = "10.9"
|
# Python 3.4 and 3.5 are compiled with MSVC 10, which does not support C++14
|
||||||
project_dir = os.path.dirname(__file__)
|
if utils.platform == 'macos':
|
||||||
# this test checks if c++14 standard is supported.
|
add_env['MACOSX_DEPLOYMENT_TARGET'] = '10.9'
|
||||||
|
|
||||||
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env)
|
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env)
|
||||||
expected_wheels = [x for x in utils.expected_wheels(
|
expected_wheels = [x for x in utils.expected_wheels(
|
||||||
'spam', '0.1.0', macosx_deployment_target="10.9")
|
'spam', '0.1.0', macosx_deployment_target='10.9')
|
||||||
if "cp27-cp27m-win" not in x and "cp35-cp35m-win" not in x]
|
if 'cp27-cp27m-win' not in x and 'cp35-cp35m-win' not in x]
|
||||||
assert set(actual_wheels) == set(expected_wheels)
|
assert set(actual_wheels) == set(expected_wheels)
|
||||||
|
|
||||||
|
|
||||||
def test_cpp17():
|
def test_cpp17():
|
||||||
# python 2.7 use `register` keyword which is forbidden in c++17 standard
|
# This test checks that the C++17 standard is supported
|
||||||
# manylinux1 docker image do not support compilers with standards newer than c++11
|
|
||||||
# python 3.4 and 3.5 are compiled with MSVC 10. which not support c++17
|
|
||||||
if os.environ.get("APPVEYOR_BUILD_WORKER_IMAGE", "") == "Visual Studio 2015":
|
|
||||||
pytest.skip("Visual Studio 2015 does not support c++17")
|
|
||||||
|
|
||||||
add_env = {"CIBW_SKIP": "cp27-win* cp35-win*", "CIBW_ENVIRONMENT": "STANDARD=17"}
|
# Python 2.7 uses the `register` keyword which is forbidden in the C++17 standard
|
||||||
if utils.platform == "macos":
|
# The manylinux1 docker image does not have a compiler which supports C++11
|
||||||
add_env["MACOSX_DEPLOYMENT_TARGET"] = "10.13"
|
# Python 3.4 and 3.5 are compiled with MSVC 10, which does not support C++17
|
||||||
|
if os.environ.get('APPVEYOR_BUILD_WORKER_IMAGE', '') == 'Visual Studio 2015':
|
||||||
|
pytest.skip('Visual Studio 2015 does not support C++17')
|
||||||
|
|
||||||
project_dir = os.path.dirname(__file__)
|
add_env = {'CIBW_SKIP': 'cp27-win* cp35-win*', 'CIBW_ENVIRONMENT': 'STANDARD=17'}
|
||||||
# this test checks if c++17 standard is supported.
|
if utils.platform == 'macos':
|
||||||
|
add_env['MACOSX_DEPLOYMENT_TARGET'] = '10.13'
|
||||||
|
|
||||||
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env)
|
actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env)
|
||||||
expected_wheels = [x for x in utils.expected_wheels('spam', '0.1.0',
|
expected_wheels = [x for x in utils.expected_wheels(
|
||||||
macosx_deployment_target="10.13")
|
'spam', '0.1.0', macosx_deployment_target='10.13')
|
||||||
if "cp27-cp27m-win" not in x and "cp35-cp35m-win" not in x]
|
if 'cp27-cp27m-win' not in x and 'cp35-cp35m-win' not in x]
|
||||||
assert set(actual_wheels) == set(expected_wheels)
|
assert set(actual_wheels) == set(expected_wheels)
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
#include <Python.h>
|
#include <Python.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
// Depending on the requested standard, use a modern C++ feature
|
||||||
|
// that was introduced in that standard.
|
||||||
#if STANDARD == 11
|
#if STANDARD == 11
|
||||||
#include <array>
|
#include <array>
|
||||||
#elif STANDARD == 14
|
#elif STANDARD == 14
|
||||||
@@ -11,9 +14,6 @@ auto a = std::pair(5.0, false);
|
|||||||
#error Standard needed
|
#error Standard needed
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define STR_HELPER(x) #x
|
|
||||||
#define STR(x) STR_HELPER(x)
|
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
spam_system(PyObject *self, PyObject *args)
|
spam_system(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ def cibuildwheel_run(project_path, env=None, add_env=None, output_dir=None):
|
|||||||
'''
|
'''
|
||||||
if env is None:
|
if env is None:
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
|
# If present in the host environment, remove the MACOSX_DEPLOYMENT_TARGET for consistency
|
||||||
|
env.pop('MACOSX_DEPLOYMENT_TARGET', None)
|
||||||
|
|
||||||
if add_env is not None:
|
if add_env is not None:
|
||||||
env.update(add_env)
|
env.update(add_env)
|
||||||
@@ -94,20 +96,15 @@ def expected_wheels(package_name, package_version, manylinux_versions=['manylinu
|
|||||||
return ['win32', 'win_amd64']
|
return ['win32', 'win_amd64']
|
||||||
|
|
||||||
elif platform == 'macos':
|
elif platform == 'macos':
|
||||||
if macosx_deployment_target is not None:
|
|
||||||
tag = macosx_deployment_target.replace(".", "_")
|
|
||||||
tag1 = macosx_deployment_target.replace(".", "_")
|
|
||||||
else:
|
|
||||||
tag = os.environ.get("MACOSX_DEPLOYMENT_TARGET", "10_6").replace(".", "_")
|
|
||||||
tag1 = os.environ.get("MACOSX_DEPLOYMENT_TARGET", "10_9").replace(".", "_")
|
|
||||||
|
|
||||||
def get_platform_tags(python_abi_tag):
|
def get_platform_tags(python_abi_tag):
|
||||||
if python_abi_tag == 'cp38-cp38':
|
if python_abi_tag == 'cp38-cp38':
|
||||||
return ['macosx_' + tag1 + '_x86_64']
|
return ['macosx_' + (macosx_deployment_target or "10.9").replace(".", "_") + '_x86_64']
|
||||||
else:
|
else:
|
||||||
return ['macosx_' + tag + '_intel']
|
return ['macosx_' + (macosx_deployment_target or "10.6").replace(".", "_") + '_intel']
|
||||||
else:
|
else:
|
||||||
raise Exception('unsupported platform')
|
raise Exception('unsupported platform')
|
||||||
|
|
||||||
templates = []
|
templates = []
|
||||||
for python_abi_tag in python_abi_tags:
|
for python_abi_tag in python_abi_tags:
|
||||||
for platform_tag in get_platform_tags(python_abi_tag):
|
for platform_tag in get_platform_tags(python_abi_tag):
|
||||||
|
|||||||
Reference in New Issue
Block a user