From 2419d61c2c7c9e0c0f08384b2ba4898bad6887ea Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sat, 3 Apr 2021 07:25:41 +0200 Subject: [PATCH 1/2] Try to fix macos Py3 build, which does not set "$TRAVIS_PYTHON_VERSION" (language: c). --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fbea26a92f6..1ea34724ab3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -151,8 +151,8 @@ before_install: install: - python -c 'import sys; print("Python %s" % (sys.version,))' - - if [ -z "${TRAVIS_PYTHON_VERSION##2.7}" ]; then pip install -r test-requirements-27.txt ; fi - - if [ -n "${TRAVIS_PYTHON_VERSION##*-dev}" -a -n "${TRAVIS_PYTHON_VERSION##2.*}" ]; then pip install -r test-requirements.txt $( [ -z "${TRAVIS_PYTHON_VERSION##pypy*}" -o -z "${TRAVIS_PYTHON_VERSION##3.[478]*}" ] || echo " -r test-requirements-cpython.txt" ) ; fi + - if [ -z "${TRAVIS_PYTHON_VERSION##2.7}" ]; then [ "$TRAVIS_OS_NAME" == "osx" -a "$PY" == "3" ] || pip install -r test-requirements-27.txt ; fi + - if [ -n "${TRAVIS_PYTHON_VERSION##*-dev}" -a -n "${TRAVIS_PYTHON_VERSION##2.*}" ]; then pip install -r test-requirements.txt $( [ -z "${TRAVIS_PYTHON_VERSION##pypy*}" -o -z "${TRAVIS_PYTHON_VERSION##3.[47890]*}" ] || echo " -r test-requirements-cpython.txt" ) ; fi # - CFLAGS="-O2 -ggdb -Wall -Wextra $(python -c 'import sys; print("-fno-strict-aliasing" if sys.version_info[0] == 2 else "")')" python setup.py build before_script: ccache -s || true From 3ae58fea907a5abbc34f1792242a884c194ada5e Mon Sep 17 00:00:00 2001 From: vorfol <39548292+vorfol@users.noreply.github.com> Date: Mon, 12 Apr 2021 21:45:07 +0500 Subject: [PATCH 2/2] Use CFLAGS for compiler defines in test runner (GH-4099) Creating global CDEFS for holding compiler definitions. Then pass it to the distutils. Also add .vscode folder to .gitignore Fixes https://github.com/cython/cython/issues/4096 --- .gitignore | 2 ++ runtests.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 46da36e693e..f59252e3f4b 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,5 @@ MANIFEST /.idea /*.iml +# Visual Studio Code files +.vscode diff --git a/runtests.py b/runtests.py index 9b923612d77..7e76dfea581 100755 --- a/runtests.py +++ b/runtests.py @@ -432,6 +432,7 @@ def get_openmp_compiler_flags(language): INCLUDE_DIRS = [ d for d in os.getenv('INCLUDE', '').split(os.pathsep) if d ] CFLAGS = os.getenv('CFLAGS', '').split() CCACHE = os.getenv('CYTHON_RUNTESTS_CCACHE', '').split() +CDEFS = [] TEST_SUPPORT_DIR = 'testsupport' BACKENDS = ['c', 'cpp'] @@ -1052,6 +1053,7 @@ def run_distutils(self, test_directory, module, workdir, incdir, build_extension.compiler = COMPILER ext_compile_flags = CFLAGS[:] + ext_compile_defines = CDEFS[:] if build_extension.compiler == 'mingw32': ext_compile_flags.append('-Wno-format') @@ -1066,6 +1068,7 @@ def run_distutils(self, test_directory, module, workdir, incdir, module, sources=self.source_files(workdir, module, related_files), extra_compile_args=ext_compile_flags, + define_macros=ext_compile_defines, **extra_extension_args ) @@ -2306,7 +2309,7 @@ def runtests(options, cmd_args, coverage=None): build_in_temp=True, pyxbuild_dir=os.path.join(WORKDIR, "support")) sys.path.insert(0, os.path.split(libpath)[0]) - CFLAGS.append("-DCYTHON_REFNANNY=1") + CDEFS.append(('CYTHON_REFNANNY', '1')) if xml_output_dir and options.fork: # doesn't currently work together