12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- detect.py: replace compile_and_run with compile_and_forget
- This function is only used in setup.py to detect the availability of
- sys/un.h by compiling and running a small test program. Since we're
- cross-compiling we can't run the generated program, however if the
- header is missing the test will fail at the compilation step so
- running the test in unnecessary.
- Signed-off-by: Lionel Flandrin <lionel@svkt.org>
- ---
- buildutils/detect.py | 16 ++++++++--------
- setup.py | 4 ++--
- 2 files changed, 10 insertions(+), 10 deletions(-)
- diff --git a/buildutils/detect.py b/buildutils/detect.py
- index 7a6c115..9520da7 100644
- --- a/buildutils/detect.py
- +++ b/buildutils/detect.py
- @@ -58,7 +58,7 @@ def test_compilation(cfile, compiler=None, **compiler_attrs):
- cc.link_executable(objs, efile, extra_preargs=lpreargs)
- return efile
-
- -def compile_and_run(basedir, src, compiler=None, **compiler_attrs):
- +def compile_and_forget(basedir, src, compiler=None, **compiler_attrs):
- if not os.path.exists(basedir):
- os.makedirs(basedir)
- cfile = pjoin(basedir, os.path.basename(src))
- @@ -66,16 +66,16 @@ def compile_and_run(basedir, src, compiler=None, **compiler_attrs):
- try:
- cc = get_compiler(compiler, **compiler_attrs)
- efile = test_compilation(cfile, compiler=cc)
- - patch_lib_paths(efile, cc.library_dirs)
- - result = Popen(efile, stdout=PIPE, stderr=PIPE)
- - so, se = result.communicate()
- - # for py3k:
- - so = so.decode()
- - se = se.decode()
- + # patch_lib_paths(efile, cc.library_dirs)
- + # result = Popen(efile, stdout=PIPE, stderr=PIPE)
- + # so, se = result.communicate()
- + # # for py3k:
- + # so = so.decode()
- + # se = se.decode()
- finally:
- shutil.rmtree(basedir)
-
- - return result.returncode, so, se
- + return None
-
-
- def detect_zmq(basedir, compiler=None, **compiler_attrs):
- diff --git a/setup.py b/setup.py
- index c3a2879..b8b0aaf 100755
- --- a/setup.py
- +++ b/setup.py
- @@ -54,7 +54,7 @@ from buildutils import (
- info, warn, fatal, debug, line, copy_and_patch_libzmq, localpath,
- fetch_libzmq, stage_platform_hpp,
- bundled_version, customize_mingw,
- - compile_and_run,
- + compile_and_forget,
- patch_lib_paths,
- )
-
- @@ -327,7 +327,7 @@ class Configure(build_ext):
- except Exception:
- pass
- try:
- - compile_and_run(self.tempdir,
- + compile_and_forget(self.tempdir,
- pjoin('buildutils', 'check_sys_un.c'),
- **minus_zmq
- )
- --
- 2.11.0
|