#!/usr/bin/make -f

DEB_PYTHON2_MODULE_PACKAGES=snimpy

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk

# .so file get installed in the wrong place and we need the matching
# .c file to avoid recompilation
install/snimpy::
	for buildver in $(cdbs_curpythonbuildversions); do \
		lib=$(call cdbs_expand_python_distutils_installdir,python$$buildver) ; \
		rm debian/snimpy/$$lib/*.so ; \
		mkdir debian/snimpy/$$lib/snimpy/__pycache__ ; \
		cp snimpy/__pycache__/_cffi* debian/snimpy/$$lib/snimpy/__pycache__ ; \
	done

clean::
	rm -f snimpy/__pycache__/*.so
	rm -f snimpy/__pycache__/snimpy/__pycache__/*.o
