Fix python installation in comedilib-9999.ebuild.
authorW. Trevor King <wking@drexel.edu>
Thu, 9 Dec 2010 02:39:46 +0000 (21:39 -0500)
committerW. Trevor King <wking@drexel.edu>
Thu, 9 Dec 2010 02:39:46 +0000 (21:39 -0500)
Also:
* Install demo code when `doc` USE flag is set.
* Don't install comedi_calibrate man page, since we don't install a
  comedi_calibrate binary.

sci-libs/comedilib/Manifest
sci-libs/comedilib/comedilib-9999.ebuild
sci-libs/comedilib/files/comedilib-9999-setup.py.patch [new file with mode: 0644]

index cb7805a759aa567e9f8f7e7039482224b3a9ec80..e5cc93da5edd7b5527fb6f776a6bffd5cc2e7d50 100644 (file)
@@ -1,3 +1,4 @@
-EBUILD comedilib-9999.ebuild 1196 RMD160 d6c67195995b59c509553e8643286668e2b4f213 SHA1 0271ff01fb36619157f994e93d503273f2d4d2b0 SHA256 a7d668f9ec5f0a16605b3c2ae1ea5ce975647ae9a9a699f508f5cc26701c8ea9
+AUX comedilib-9999-setup.py.patch 956 RMD160 721be9715cf1058fb2e9407f36da04fa6cb8b95f SHA1 56c894ed915b29ab9f91fd327bd8b5c932c12161 SHA256 74f03d023d93c0cebb7e0463146e95a5abe5140501472fc2fca2ef36cb11e207
+EBUILD comedilib-9999.ebuild 2315 RMD160 28f2de82032185e52c0a0e236757c23d633bd125 SHA1 9a8c39761d158a06828e2e864483655906ecfab4 SHA256 0bf0d85ecd629907bc0e4130de69be16d0fdef98eafd33d7d70c4449f0a63121
 MISC ChangeLog 1168 RMD160 62c9992630de85e02a25d5a4cc077386211b8859 SHA1 bc9d91fff9c4f05804d564f5e55fd63ed99c3426 SHA256 6766a0d3f76055ed559975a91df6f2876289f129248fa739853da0d2606bec9f
 MISC metadata.xml 247 RMD160 6735f3a5dd2d7a2b70589d1693f35d54291b7147 SHA1 c015969fe50967340dd050a44cb9f8a30b5e34a5 SHA256 9e65060e5f9d0a50d28c7a69d9c27fed6c3037fdd3e420cc276627fde2794f72
index 8edeeb8d22106b3eed7fdbe1ff02dc0a6c17dd21..0ca12c6a08e4283adb067e2140692f8c12538c8d 100644 (file)
@@ -4,7 +4,10 @@
 
 EAPI="2"
 
-#inherit eutils
+PYTHON_DEPEND="python? 2"
+RESTRICT_PYTHON_ABIS="3.*"
+
+inherit distutils
 
 if [[ ${PV} == "9999" ]] ; then
        ECVS_SERVER="cvs.comedi.org:/cvs/comedi"
@@ -24,6 +27,9 @@ KEYWORDS="x86"
 LICENSE="LGPL-2.1"
 SLOT="0"
 
+PYTHON_MODNAME="comedi"
+DISTUTILS_SETUP_FILES="${S}/swig/python/setup.py"
+
 DEPEND=">=sci-misc/comedi-headers-${PV}
        sys-devel/flex
        sys-devel/bison
@@ -38,23 +44,77 @@ DEPEND=">=sci-misc/comedi-headers-${PV}
        doc? ( app-text/xmlto )"
 RDEPEND=""
 
-src_compile()
+
+src_prepare()
 {
        if [ "${PV}" == "9999" ] ; then
                ./autogen.sh
        fi
+  if use python ; then
+               epatch "${FILESDIR}/${P}"-setup.py.patch
+               cd "${S}/swig/python"
+               ln -s ../comedi.i
+               distutils_src_prepare
+               cd "${S}"
+       fi
+}
+
+src_configure()
+{
+  #$(use_enable python python-binding)
        econf \
-               $(use_enable python python-binding) \
+               --disable-python-binding \
                $(use_enable ruby ruby-binding) \
-               $(use_enable doc docbook-binding) \
+               $(use_enable doc docbook) \
                || die "econf failed"
+}
+
+src_compile()
+{
        emake || die "emake failed"
+       if use python ; then
+               cd "${S}/swig/python"
+               distutils_src_compile
+               cd "${S}"
+       fi
 }
 
 src_install()
 {
        emake DESTDIR="${D}" install || die "emake install failed"
        keepdir /var/calibrations
+       if use doc ; then
+               local DOCINTO="/usr/share/doc/${PF}"
+               local DDOCINTO="${D}${DOCINTO}"
+               # convert to `dodoc -r` once recursive dodoc is available in EAPI 4
+               insinto ${DOCINTO}
+               doins -r demo || die "doins failed"
+               rm -rf ${DDOCINTO}/demo/CVS
+               rm -rf ${DDOCINTO}/demo/Makefile.am
+               rm -rf ${DDOCINTO}/demo/perl
+               if use python ; then
+                       rm -rf ${DDOCINTO}/demo/python/CVS
+               else
+                       rm -rf ${DDOCINTO}/demo/python
+               fi
+       fi
+       if use python ; then
+               cd "${S}/swig/python"
+               distutils_src_install
+               cd "${S}"
+       fi
        # comedi.h already installed by sci-misc/comedi-headers
        rm ${D}/usr/include/comedi.h || die "failed to remove comedi.h"
+       # comedi_calibrate is a separate package
+       rm ${D}/usr/share/man/man8/comedi_calibrate.8*
+}
+
+pkg_postinst()
+{
+       distutils_pkg_postinst
+}
+
+pkg_postrm()
+{
+       distutils_pkg_postrm
 }
diff --git a/sci-libs/comedilib/files/comedilib-9999-setup.py.patch b/sci-libs/comedilib/files/comedilib-9999-setup.py.patch
new file mode 100644 (file)
index 0000000..e394282
--- /dev/null
@@ -0,0 +1,27 @@
+diff --git a/swig/python/setup.py b/swig/python/setup.py
+index 4c0c1eb..6fc1870 100644
+--- a/swig/python/setup.py
++++ b/swig/python/setup.py
+@@ -3,15 +3,17 @@ from distutils.core import setup, Extension
+ module1 = Extension('_comedi',
+                       define_macros = [('MAJOR_VERSION','0'),
+                                       ('MINOR_VERSION','1')],
+-                      include_dirs = ['../include'],
+-                      library_dirs = ['../lib'],
++                      include_dirs = ['../../include'],
++                      library_dirs = ['../../lib'],
++                      swig_opts=['-I../../include'],
+                       libraries = ['comedi'],
+-                      sources = ['comedi_wrap.c'])
++                      sources = ['comedi.i'])
+                       
+-setup (name='_comedi',
++setup (name='comedi',
+       version = '0.1',
+       description = 'Python wrapper module for the Comedi data-acquisition drivers',
+       author = 'Bryan E. Cole',
+       author_email = 'bryan.cole@teraview.co.uk',
+       long_description = ''' Wrapper for the Comedi data-acquisition library ''',
+-      ext_modules = [module1])
++      ext_modules = [module1],
++      py_modules = ['comedi'])