Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace have_program usage by Features #32957

Open
seblabbe opened this issue Dec 1, 2021 · 13 comments
Open

Replace have_program usage by Features #32957

seblabbe opened this issue Dec 1, 2021 · 13 comments

Comments

@seblabbe
Copy link
Contributor

seblabbe commented Dec 1, 2021

After #32650, remaining usage of have_program are:

$ git grep have_program
src/sage/interfaces/chomp.py:        from sage.misc.sage_ostools import have_program
src/sage/interfaces/chomp.py:        _have_chomp[program] = have_program(program)
src/sage/interfaces/phc.py:            from sage.misc.sage_ostools import have_program
src/sage/interfaces/phc.py:            if not have_program('phc'):
src/sage/misc/dist.py:    from sage.misc.sage_ostools import have_program
src/sage/misc/dist.py:        cmd_inside_sage = have_program(cmd, path=SAGE_BIN)
src/sage/misc/dist.py:        cmd_outside_sage = have_program(cmd, path=PATH)
src/sage/misc/sage_ostools.pyx:def have_program(program, path=None):
src/sage/misc/sage_ostools.pyx:        sage: from sage.misc.sage_ostools import have_program
src/sage/misc/sage_ostools.pyx:        sage: have_program('ls')
src/sage/misc/sage_ostools.pyx:        sage: have_program('there_is_not_a_program_with_this_name')
src/sage/misc/sage_ostools.pyx:        sage: have_program('sage', os.path.join(SAGE_VENV, 'bin'))
src/sage/misc/sage_ostools.pyx:        sage: have_program('sage', '/there_is_not_a_path_with_this_name')
src/sage/misc/sage_ostools.pyx:        sage: have_program('there_is_not_a_program_with_this_name', os.path.join(SAGE_VENV, 'bin'))
src/sage/misc/viewer.py:    from sage.misc.sage_ostools import have_program
src/sage/misc/viewer.py:    elif have_program('xdg-open'):
src/sage/misc/viewer.py:                if have_program(cmd):
src/sage/misc/viewer.py:                if have_program(cmd):
src/sage/misc/viewer.py:                if have_program(cmd):

See also:

CC: @seblabbe @tornaria

Component: distribution

Issue created by migration from https://trac.sagemath.org/ticket/32957

@seblabbe seblabbe added this to the sage-9.5 milestone Dec 1, 2021
@mkoeppe
Copy link
Contributor

mkoeppe commented Dec 9, 2021

comment:1

#30207 proposes to deprecate sage.misc.dist

@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 18, 2021
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 Apr 7, 2022
@jhpalmieri
Copy link
Member

comment:7

I can try to convert the chomp stuff to something in features, but I can't test it very well because CHomP doesn't build on OS X, with an error

In file included from /Users/jpalmier/Desktop/Sage/git/CHomP/source/chomp-matrix.cpp:4:
/Users/jpalmier/Desktop/Sage/git/CHomP/include/chomp/Ring.h:224:3: error: C++ requires a type specifier for all declarations
  BOOST_SERIALIZATION_SPLIT_MEMBER()

BOOST_SERIALIZATION_SPLIT_MEMBER seems to come from /usr/local/include/boost/, and I don't know why it's not being found. I wonder if it's time to deprecate the CHomP stuff in Sage anyway; the software at https://github.com/marciogameiro/CHomP hasn't been modified in 5 years.

@jhpalmieri
Copy link
Member

comment:8

I also feel like there must be a good way to replace sage/misc/viewer.py these days.

@jhpalmieri
Copy link
Member

comment:9

Should we deprecate sage/misc/dist.py? It obviously hasn't been examined in a while, since it still talks about installing a script for mercurial. It is an artifact of older days when a feature of Sage was that it provided copies of gap, gp/pari, etc., as opposed to now, when we are trying to modularize and we want Sage to rely on system versions of those packages.

@mkoeppe
Copy link
Contributor

mkoeppe commented Apr 27, 2022

comment:10

I'm in favor of deprecating sage.misc.dist (see #30207).

@mkoeppe
Copy link
Contributor

mkoeppe commented Apr 27, 2022

comment:11

Replying to @jhpalmieri:

I wonder if it's time to deprecate the CHomP stuff in Sage anyway

I agree. Looks like it was only provided by an old-style spkg

@jhpalmieri
Copy link
Member

comment:12

Deprecating CHomP is now #33777.

@mkoeppe
Copy link
Contributor

mkoeppe commented May 18, 2022

comment:13

Replying to @jhpalmieri:

I also feel like there must be a good way to replace sage/misc/viewer.py these days.

there's https://docs.python.org/3/library/webbrowser.html

@jhpalmieri
Copy link
Member

comment:14

Replying to @mkoeppe:

Replying to @jhpalmieri:

I also feel like there must be a good way to replace sage/misc/viewer.py these days.

there's https://docs.python.org/3/library/webbrowser.html

Oh, I see:

webbrowser.open(r'file:///path/to/file')

works for me on OS X, for pdf and image files. For png and jpg files, there is also PIL:

from PIL import Image
with Image.open('filename') as im:
    im.show()

@jhpalmieri
Copy link
Member

comment:15

See #33931 for the deprecation of sage.misc.viewer.

@jhpalmieri

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-9.7, sage-9.8 Aug 31, 2022
@mkoeppe mkoeppe modified the milestones: sage-9.8, sage-9.9 Jan 29, 2023
@mkoeppe mkoeppe removed this from the sage-10.0 milestone Apr 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants