[opensuse-packaging] Python binding chicken and egg situation
![](https://seccdn.libravatar.org/avatar/25bbc96d9c53647354cb724e744b2222.jpg?s=120&d=mm&r=g)
All, I'm trying to package yara with sub-projects of libyara3 and python-yara. https://build.opensuse.org/package/show/home:gregfreemyer:Tools-for-forensic... I have the "python setup.py build" commented out for now because it fails because libyara.so is not available. libyara3 as a dependency doesn't make sense because it is a sub-package of the same package (yara). Not sure how to resolve this. Ideas welcome. (One option is to just create an entire second package (python-yara) that only addresses the python binding, then have that BuildRequire libyara-devel.) Thanks Greg -- Greg Freemyer -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
![](https://seccdn.libravatar.org/avatar/5b748275c3dbb1ceee18ed554486547d.jpg?s=120&d=mm&r=g)
On Wednesday 2014-09-24 20:38, Greg Freemyer wrote:
All,
I'm trying to package yara with sub-projects of libyara3 and python-yara. [...] libyara3 as a dependency doesn't make sense because it is a sub-package of the same package (yara).
If the just-built python interface requires a just-built libyara, then, both ought to be produced in one go, from one specfile (and thus, one build invocation). Like... sssd.spec. This also produces a bunch of shared libs and some python interfaces.
(One option is to just create an entire second package (python-yara) that only addresses the python binding, then have that BuildRequire libyara-devel.)
Such is only necessary in the bootstrap phase/when requirements shoot through the roof (like with util-linux-systemd). -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
![](https://seccdn.libravatar.org/avatar/25bbc96d9c53647354cb724e744b2222.jpg?s=120&d=mm&r=g)
On Wed, Sep 24, 2014 at 4:58 PM, Jan Engelhardt <jengelh@inai.de> wrote:
On Wednesday 2014-09-24 20:38, Greg Freemyer wrote:
All,
I'm trying to package yara with sub-projects of libyara3 and python-yara. [...] libyara3 as a dependency doesn't make sense because it is a sub-package of the same package (yara).
If the just-built python interface requires a just-built libyara, then, both ought to be produced in one go, from one specfile (and thus, one build invocation).
Like... sssd.spec. This also produces a bunch of shared libs and some python interfaces.
(One option is to just create an entire second package (python-yara) that only addresses the python binding, then have that BuildRequire libyara-devel.)
Such is only necessary in the bootstrap phase/when requirements shoot through the roof (like with util-linux-systemd).
Jan, That makes sense conceptually, but what;s the best way to fix it. How's this prep section? It allows the python setup.py to find the library after "make" creates it, but before it is installed: ============ %prep %setup -q cd yara-python sed -i "/libraries=\['yara'\],/a library_dirs=['%_builddir/%name-%version/libyara/.libs']," setup.py ============ That sed line is very dependent on "/libraries=\['yara'\]," being an existing line in setup.py, but a patch would be equally dependant. I think I have enough macros in the line I'm adding that it will work for a reasonable period of time going forward. A patch would not let me use macros as far as I know. For clarity of what the sed statement is doing, this is the same thing in a patch with no macros: ==== --- yara-3.1.0.orig/yara-python/setup.py +++ yara-3.1.0/yara-python/setup.py @@ -24,5 +24,6 @@ setup(name='yara-python', name='yara', sources=['yara-python.c'], libraries=['yara'], + library_dirs=['/home/abuild/rpmbuild/BUILD/yara-3.1.0/libyara/.libs'], include_dirs=['../windows/include', '../libyara/include'], )]) ==== Thanks Greg -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
![](https://seccdn.libravatar.org/avatar/5b748275c3dbb1ceee18ed554486547d.jpg?s=120&d=mm&r=g)
On Thursday 2014-09-25 00:33, Greg Freemyer wrote:
If the just-built python interface requires a just-built libyara, then, both ought to be produced in one go, from one specfile (and thus, one build invocation).
Like... sssd.spec. This also produces a bunch of shared libs and some python interfaces.
That makes sense conceptually, but what;s the best way to fix it.
How's this prep section? It allows the python setup.py to find the library after "make" creates it, but before it is installed:
============ %prep %setup -q cd yara-python sed -i "/libraries=\['yara'\],/a library_dirs=['%_builddir/%name-%version/libyara/.libs']," setup.py ============
An idealized software package which builds both .so and python interfaces normally seems to build the python parts on its own, during `make` and `make install`, such that you need not run `python setup.py` and `python setup.py install` yourself, respectively. If that is not the case, then yes, you will need to hack something up involving a hardcoded location like .libs. Do put all that in %build though, quilt is sensitive to running molasses of commands in %prep. %prep %setup -q %build perl -i -pe "s{(\s+)(libraries=\['yara'\])} {${1}library_dirs=['$PWD/libyara/.libs']\n$1$2}g" setup.py make python setup.py build -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (2)
-
Greg Freemyer
-
Jan Engelhardt