rules 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/usr/bin/make -f
  2. CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
  3. CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
  4. CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS)
  5. LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
  6. # Callable functions to determine the correct PYTHONPATH
  7. pythonpath = $$(ls -d $(CURDIR)/build/lib.*-$(1))
  8. pythonpath_dbg = $$(ls -d $(CURDIR)/build/lib_d.*-$(1) 2>/dev/null || ls -d $(CURDIR)/build/lib.*$(1)-pydebug)
  9. pyflavours = python2,python3
  10. pyflavours += $(shell which pypy >/dev/null && echo ,pypy)
  11. %:
  12. dh $* --with $(pyflavours) --buildsystem=python_distutils
  13. override_dh_auto_build:
  14. dh_auto_build
  15. override_dh_auto_clean:
  16. dh_auto_clean
  17. rm -rf build*
  18. rm -f dulwich/*.so dulwich/*.o
  19. override_dh_auto_test:
  20. ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
  21. $(MAKE) check PYTHON=python
  22. $(MAKE) check PYTHON=python3
  23. ifneq (,$(findstring pypy,$(pyflavours)))
  24. $(MAKE) check PYTHON=pypy
  25. endif
  26. endif
  27. override_dh_auto_install:
  28. dh_auto_install
  29. set -ex; for python in $(shell py3versions -r); do \
  30. $$python setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
  31. done;
  32. ifneq (,$(findstring pypy,$(pyflavours)))
  33. pypy setup.py build -b build-pypy install --root=$(CURDIR)/debian/tmp --install-layout deb
  34. rm -rf debian/tmp/usr/lib/pypy/bin
  35. endif
  36. # Install everything excluding the *_d.so debug extensions to python-dulwich and python3-dulwich
  37. dh_install -X"*_d.so" "debian/tmp/usr/lib/python2*/*-packages" -p python-dulwich
  38. dh_install -X"*_d.so" "debian/tmp/usr/lib/python3*/*-packages" -p python3-dulwich
  39. # Install the debug extensions to python-dulwich-dbg
  40. dh_install "debian/tmp/usr/lib/python*/*-packages/dulwich/*_d.so" -p python-dulwich-dbg
  41. ifneq (,$(findstring pypy,$(pyflavours)))
  42. # Install the pypy files to pypy-dulwich
  43. dh_install "debian/tmp/usr/lib/pypy/" -p pypy-dulwich
  44. endif
  45. override_dh_installdocs:
  46. dh_installdocs -ppython-dulwich-dbg --link-doc=python-dulwich
  47. dh_installdocs -ppython3-dulwich-dbg --link-doc=python3-dulwich
  48. dh_installdocs -ppython-dulwich docs/tutorial -X.gitignore -XMakefile
  49. dh_installdocs -ppython3-dulwich docs/tutorial -X.gitignore -XMakefile
  50. ifneq (,$(findstring pypy,$(pyflavours)))
  51. dh_installdocs -ppypy-dulwich docs/tutorial -X.gitignore -XMakefile
  52. endif
  53. override_dh_strip:
  54. dh_strip -p python-dulwich --dbg-package=python-dulwich-dbg
  55. dh_strip -p python3-dulwich --dbg-package=python3-dulwich-dbg
  56. ifneq (,$(findstring pypy,$(pyflavours)))
  57. # For the moment, there is no dbg package for pypy-dulwich.
  58. dh_strip -p pypy-dulwich
  59. endif
  60. override_dh_installchangelogs:
  61. dh_installchangelogs NEWS