snapcraft conda plug-in?

Zygmunt Krynicki zygmunt.krynicki at canonical.com
Thu Jun 16 08:09:43 UTC 2016


On Wed, Jun 15, 2016 at 9:49 PM, Bill Janssen <janssen at parc.com> wrote:

> I've got a big package, multiple programs, that I assemble in one
> directory under /opt/goodstuff, using conda as the packaging system --
> the goodstuff directory tree is a conda 'env'.  It seems that this
> should be easy to re-package as a snap.  However, conda does a few
> things that have to be changed, or undone, for snap:
>
>   1) It mungs shebangs; that is, a header like "#!/usr/bin/env python"
>   gets changed to "#!/opt/goodstuff/bin/python".  I think that would
>   have to be undone; what snapcraft stage should that occur in?
>

Hey

Remember that your snap will most likely ship python by itself. The shebang
line doesn't matter because the root filesystem at the time your snap will
execute is not going to show much of the host distribution file system.



>
>   2) It symlinks in some of the binaries; for example,
>   /opt/goodstuff/bin/conda is a symlink to /opt/conda/bin/conda.  Those
>   would have to be reified (copied), perhaps in the "pull" stage?
>

In general, you should install your snap to "anything you want" and that
will show up under /snap/conda/current/. In this case you would have
/snap/conda/current/opt/conda/bin/conda. You should try to simplify the
structure though it matters little in practice.


>
>   3) It rewrites RPATH on some platforms (OS X), but perhaps not on
>   Linux, I'll have to check.  That should be redone to accord with snap.
>

This should be harmless but note that currently snapcraft has a bug when
executables use rpath. It is better to strip rpath and rely on
LD_LIBRARY_PATH that snapcraft and snapd automatically arrange for you.


>   4) It's not a completely clean package.  There are some dependencies,
>   like "python-dbus", that are hard to build, and therefore installed
>   via apt-get.
>

That's okay.



>
> Seems to me that the way to this is with a conda plug-in for snapcraft
> that would take a conda env and package it; "copy" with fixes for conda.
>
> Any suggestions about this?  What would be a good plug-in to use as a
> template?


You can put a custom plugin alongside your snapcraft.yaml file. You can
experiment with the make plugin since makefiles are familiar to many people
and you can use that as a way to just put files in various places and see
what happens.

Oh and while you experiment, do use "snap try", it will be much faster than
rebuilding the snap all the time.

Best regards
ZK



>
> Bill
>
> --
> Snapcraft mailing list
> Snapcraft at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/snapcraft
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20160616/3fefd6ce/attachment.html>


More information about the Snapcraft mailing list