Correct way to write a hook for pygraphviz (which has hidden dependencies to graphviz)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Correct way to write a hook for pygraphviz (which has hidden dependencies to graphviz)

Krister Swenson
Hello,

I'm trying to package an app that depends heavily on graphviz and pygraphviz. The dependencies do not get automatically pulled in as there is to pygraphviz hook. I would like to write one but need some guidance.

I stared with a simple hook to include the graphviz executables along with the dynamic libararies (I'm on macos and linux, but will include only the macos lines here)...

binaries=[
          ('/usr/local/bin/dot', '.'),
          ('/usr/local/bin/nop', '.'),         #There are others to include (e.g. neato).
          ('/usr/local/Cellar/graphviz/*/lib/*.dylib', '.'),
          ('/usr/local/Cellar/graphviz/*/lib/graphviz/*.dylib', 'graphviz'),
         ] #+ libs

datas=[
       ('/usr/local/Cellar/graphviz/*/lib/graphviz/config6', 'graphviz'),
      ]

This is not sufficient, since graphviz depends on packages like libtool (that's the name in brew) so I add `          ('/usr/local/Cellar/libtool/*/lib/*.dylib', '.'),` to the list of binaries. Yet there are a ton of dependencies for graphviz:

 => brew deps graphviz
cairo
fontconfig
freetype
fribidi
gd
gdbm
gettext
glib
graphite2
gts
harfbuzz
icu4c
jasper
jpeg
libffi
libpng
libtiff
libtool
lzo
netpbm
openssl@1.1
pango
pcre
pixman
python
readline
sqlite
webp
xz

I assume that there is a function in pyinstaller that would recursively include dynamic libraries but I haven't found it. For example, the function `depend.bindepend.findSystemLibrary`, which I assume would be used by such a recursive function is only called in gi.py, and nowhere else. Are we expected to write this function ourselves?

Thanks for the help!

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/3c0f14ae-56e1-4aea-ab42-c7f03ca18e74o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Correct way to write a hook for pygraphviz (which has hidden dependencies to graphviz)

Krister Swenson
It turns out that pyinstaller does try to recursively resolve shared library dependencies. In this case, there are dependencies that are not found. When I include those manually, AND WITHOUT WILDCARDS, then pyinstaller will follow recursively the dependencies. So the wildcards in the binaries is the main problem keeping the .spec file from working.

I'm working on a hook for pygraphviz  here: https://github.com/pyinstaller/pyinstaller/issues/4938

kms

On Tuesday, June 16, 2020 at 10:07:13 AM UTC+2, Krister Swenson wrote:
Hello,

I'm trying to package an app that depends heavily on graphviz and pygraphviz. The dependencies do not get automatically pulled in as there is to pygraphviz hook. I would like to write one but need some guidance.

I stared with a simple hook to include the graphviz executables along with the dynamic libararies (I'm on macos and linux, but will include only the macos lines here)...

binaries=[
          ('/usr/local/bin/dot', '.'),
          ('/usr/local/bin/nop', '.'),         #There are others to include (e.g. neato).
          ('/usr/local/Cellar/graphviz/*/lib/*.dylib', '.'),
          ('/usr/local/Cellar/graphviz/*/lib/graphviz/*.dylib', 'graphviz'),
         ] #+ libs

datas=[
       ('/usr/local/Cellar/graphviz/*/lib/graphviz/config6', 'graphviz'),
      ]

This is not sufficient, since graphviz depends on packages like libtool (that's the name in brew) so I add `          ('/usr/local/Cellar/libtool/*/lib/*.dylib', '.'),` to the list of binaries. Yet there are a ton of dependencies for graphviz:

 => brew deps graphviz
cairo
fontconfig
freetype
fribidi
gd
gdbm
gettext
glib
graphite2
gts
harfbuzz
icu4c
jasper
jpeg
libffi
libpng
libtiff
libtool
lzo
netpbm
openssl@1.1
pango
pcre
pixman
python
readline
sqlite
webp
xz

I assume that there is a function in pyinstaller that would recursively include dynamic libraries but I haven't found it. For example, the function `depend.bindepend.findSystemLibrary`, which I assume would be used by such a recursive function is only called in gi.py, and nowhere else. Are we expected to write this function ourselves?

Thanks for the help!

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/pyinstaller/360157b6-6377-4f03-80a8-3625d0bb3a1eo%40googlegroups.com.