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. With the exception of module_list.py most of these calls are unnecessary and could be replaced by a presence check like --- src.orig/sage/game_theory/normal_form_game.py 2016-02-19 10:34:58.653146369 +1300 +++ src/sage/game_theory/normal_form_game.py 2016-02-19 10:35:27.539215800 +1300 @@ -612,8 +612,9 @@ from sage.structure.sage_object import SageObject from sage.matrix.constructor import matrix from sage.matrix.constructor import vector -from sage.misc.package import is_package_installed from sage.misc.temporary_file import tmp_filename +import os +from sage.env import SAGE_LOCAL try: from gambit import Game @@ -1314,13 +1315,13 @@ raise ValueError("utilities have not been populated") if not algorithm: - if is_package_installed('lrslib'): + if os.path.isfile(os.path.join(SAGE_LOCAL, 'bin', 'lrs')): algorithm = "lrs" else: algorithm = "enumeration" if algorithm == "lrs": - if not is_package_installed('lrslib'): + if not os.path.isfile(os.path.join(SAGE_LOCAL, 'bin', 'lrs')): raise NotImplementedError("lrslib is not installed") return self._solve_lrs(maximization) or a try: … except … block if the optional bit have a python interface for example (although there are other possibilities). module_list.py is a separate problem. François > 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.