0002-replace-compile_and_run-with-compile_and_forget.patch 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. detect.py: replace compile_and_run with compile_and_forget
  2. This function is only used in setup.py to detect the availability of
  3. sys/un.h by compiling and running a small test program. Since we're
  4. cross-compiling we can't run the generated program, however if the
  5. header is missing the test will fail at the compilation step so
  6. running the test in unnecessary.
  7. Signed-off-by: Lionel Flandrin <lionel@svkt.org>
  8. ---
  9. buildutils/detect.py | 16 ++++++++--------
  10. setup.py | 4 ++--
  11. 2 files changed, 10 insertions(+), 10 deletions(-)
  12. diff --git a/buildutils/detect.py b/buildutils/detect.py
  13. index 7a6c115..9520da7 100644
  14. --- a/buildutils/detect.py
  15. +++ b/buildutils/detect.py
  16. @@ -58,7 +58,7 @@ def test_compilation(cfile, compiler=None, **compiler_attrs):
  17. cc.link_executable(objs, efile, extra_preargs=lpreargs)
  18. return efile
  19. -def compile_and_run(basedir, src, compiler=None, **compiler_attrs):
  20. +def compile_and_forget(basedir, src, compiler=None, **compiler_attrs):
  21. if not os.path.exists(basedir):
  22. os.makedirs(basedir)
  23. cfile = pjoin(basedir, os.path.basename(src))
  24. @@ -66,16 +66,16 @@ def compile_and_run(basedir, src, compiler=None, **compiler_attrs):
  25. try:
  26. cc = get_compiler(compiler, **compiler_attrs)
  27. efile = test_compilation(cfile, compiler=cc)
  28. - patch_lib_paths(efile, cc.library_dirs)
  29. - result = Popen(efile, stdout=PIPE, stderr=PIPE)
  30. - so, se = result.communicate()
  31. - # for py3k:
  32. - so = so.decode()
  33. - se = se.decode()
  34. + # patch_lib_paths(efile, cc.library_dirs)
  35. + # result = Popen(efile, stdout=PIPE, stderr=PIPE)
  36. + # so, se = result.communicate()
  37. + # # for py3k:
  38. + # so = so.decode()
  39. + # se = se.decode()
  40. finally:
  41. shutil.rmtree(basedir)
  42. - return result.returncode, so, se
  43. + return None
  44. def detect_zmq(basedir, compiler=None, **compiler_attrs):
  45. diff --git a/setup.py b/setup.py
  46. index c3a2879..b8b0aaf 100755
  47. --- a/setup.py
  48. +++ b/setup.py
  49. @@ -54,7 +54,7 @@ from buildutils import (
  50. info, warn, fatal, debug, line, copy_and_patch_libzmq, localpath,
  51. fetch_libzmq, stage_platform_hpp,
  52. bundled_version, customize_mingw,
  53. - compile_and_run,
  54. + compile_and_forget,
  55. patch_lib_paths,
  56. )
  57. @@ -327,7 +327,7 @@ class Configure(build_ext):
  58. except Exception:
  59. pass
  60. try:
  61. - compile_and_run(self.tempdir,
  62. + compile_and_forget(self.tempdir,
  63. pjoin('buildutils', 'check_sys_un.c'),
  64. **minus_zmq
  65. )
  66. --
  67. 2.11.0