On Mon, Mar 7, 2016 at 11:23 AM, Francois Bissey <francois.bis...@canterbury.ac.nz> wrote: > The problem is sage’s packaging system is integrated in sage itself at some > level. Although there has been some decoupling lately. > > The problem for downstream like me is that I don’t and can’t rely on sage’s > packaging system. Inside sage there is the possibility of using optional > component. Often the presence of these components is tested by querying > sage’s packaging system through is_package_installed. But I don’t have that > or an equivalent of SAGE_LOCAL/var/lib/sage/installed and sometimes > the Gentoo package could have a slightly different name so you cannot just > try to plug the host packaging system.
Ah, I see what you're saying here. Though in that case I would think one wouldn't want to rely on SAGE_LOCAL at all. Instead it might be nice if each spkg came with a Python-based way to check for it (those checks can and should be cached as well). For pure Python packages, as you suggested, a `try:\ import ... \ except ImportError: ...` should do it, though one might want an optional version check as well*. For non-Python packages it gets a bit trickier, but could include things like trying to run an executable, or using pkgconf, etc. At worst an autoconf-like test program to compile. Most of these can be made fairly generic, and should have graceful fallbacks. Erik * For this purpose I like using this utility function, though the version parsers it uses currently have some rough edges--for example it doesn't handle pre-release versions well. Could easily be fixed though. As is it works for most cases: https://github.com/astropy/astropy/blob/master/astropy/utils/introspection.py#L96 >> On 7/03/2016, at 23:12, Erik Bray <erik.m.b...@gmail.com> wrote: >> >> On Fri, Mar 4, 2016 at 8:14 PM, Francois Bissey >> <francois.bis...@canterbury.ac.nz> wrote: >>> I will hopefully have a bit of forum at sage days 77. I’ll probably want to >>> concentrate on `is_package_installed` considered harmful. >> >> Maybe I'm premature in asking if this is something you want to save >> for SD77, but could you expand on this a little? I didn't know about >> is_package_installed until now--from what it seems it just reads right >> out of $SAGE_LOCAL/var/lib/sage/installed, which of course could be a >> falsehood. But if there's some further context to this I'd be >> interested. >> >> I've been trying my best to read up on old discussions, but there's a >> lot to go through. So bear with me if I ask about stuff that's already >> been discussed ad-infinitum. If it gets annoying just ignore me and >> I'll find the information on my own :) >> >> Erik >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sage-devel" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to sage-devel+unsubscr...@googlegroups.com. >> To post to this group, send email to sage-devel@googlegroups.com. >> Visit this group at https://groups.google.com/group/sage-devel. >> For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.