python-2.7-005-staging-headers-libs.patch 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. Tell setup.py the location of headers/libraries
  2. Allow the libraries detection routine to look for headers and libs in
  3. other directories than /usr/include or /usr/lib through the
  4. environment variables PYTHON_MODULES_INCLUDE and PYTHON_MODULES_LIB.
  5. We can then use it to look for libraries in the buildroot staging
  6. directory.
  7. Patch ported to python2.7 by Maxime Ripard <ripard@archos.com>
  8. ---
  9. setup.py | 13 +++++++++++++
  10. 1 file changed, 13 insertions(+)
  11. Index: Python-2.7.2/setup.py
  12. ===================================================================
  13. --- Python-2.7.2.orig/setup.py
  14. +++ Python-2.7.2/setup.py
  15. @@ -372,6 +372,19 @@
  16. os.unlink(tmpfile)
  17. def detect_modules(self):
  18. + try:
  19. + modules_include_dirs = os.environ["PYTHON_MODULES_INCLUDE"].split()
  20. + except KeyError:
  21. + modules_include_dirs = ['/usr/include']
  22. + try:
  23. + modules_lib_dirs = os.environ["PYTHON_MODULES_LIB"].split()
  24. + except KeyError:
  25. + modules_lib_dirs = ['/usr/lib']
  26. + for dir in modules_include_dirs:
  27. + add_dir_to_list(self.compiler.include_dirs, dir)
  28. + for dir in modules_lib_dirs:
  29. + add_dir_to_list(self.compiler.library_dirs, dir)
  30. +
  31. # Ensure that /usr/local is always used
  32. if os.environ.get('CROSS_COMPILING') != 'yes':
  33. add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')