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

1st shot at suppressing the Polymake banner in Oscar #247

Closed
wants to merge 2 commits into from

Conversation

fieker
Copy link
Contributor

@fieker fieker commented Apr 7, 2020

No description provided.

src/Polymake.jl Outdated Show resolved Hide resolved
src/Polymake.jl Outdated
@@ -112,5 +115,8 @@ include("polynomial.jl")

include("polymake_direct_calls.jl")

include("generate_applications.jl")
Base.CoreLogging.with_logger(Base.CoreLogging.NullLogger()) do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like a similar check here;
I like to see those when I'm using Polymake, but maybe I'm alone? @saschatimme, @benlorenz?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really care whether this is shown.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let's get rid of this logging

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fieker instead of this, feel free to remove

@info "Generating module $mod"

@saschatimme
Copy link
Collaborator

Isn't half this pull request already merged with #241?

@fieker
Copy link
Contributor Author

fieker commented Apr 7, 2020 via email

@fieker
Copy link
Contributor Author

fieker commented Apr 7, 2020 via email

@kalmarek
Copy link
Contributor

kalmarek commented Apr 7, 2020

@fieker use p = parentmodule(@__MODULE__) and check if the last module of p is Oscar

@fieker
Copy link
Contributor Author

fieker commented Apr 7, 2020 via email

@kalmarek
Copy link
Contributor

kalmarek commented Apr 7, 2020

indeed, each package is its own root nowadays

@kalmarek
Copy link
Contributor

kalmarek commented Apr 14, 2020

have a look at oscar-system/Oscar.jl#90
then we can write (before __init__())

const __weareoscar = haskey(ENV, "WE'RE_OSCAR_NO_BANNERS_PLEASE!")

this checks essentially if a package has been loaded after from within Oscar, and not if Oscar is installed somewhere on the system.

the banner check becomes

show_banner = isinteractive() && !__weareoscar

which can be repeated actually across all cornerstone packages

@fieker

@fieker
Copy link
Contributor Author

fieker commented Apr 14, 2020 via email

@kalmarek
Copy link
Contributor

it's set by Oscar, please have a look at oscar-system/Oscar.jl#90

@fieker
Copy link
Contributor Author

fieker commented Apr 14, 2020 via email

@fieker
Copy link
Contributor Author

fieker commented Apr 15, 2020 via email

@kalmarek
Copy link
Contributor

kalmarek commented Apr 15, 2020

@fieker I took my liberty to commit to your branch (actually surprised that I could), hope it's ok with you.

The solution here uses __is_root_module() which tries to detect if Polymake was directly imported by user; if so the banner is printed; otherwise (e.g. imported within Oscar, but not only there) it is suppressed. It is hacky (using non-public interfaces), but that's the best what I could come up with;
I would like to hear your opinions, @micjoswig, @fieker, @rfourquet

Tests:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.0 (2020-03-21)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Polymake
[ Info: Precompiling Polymake [d720cf60-89b5-51f5-aff5-213f193123e7]
polymake version 4.0
Copyright (c) 1997-2020
Ewgenij Gawrilow, Michael Joswig, and the polymake team
Technische Universität Berlin, Germany
https://polymake.org

This is free software licensed under GPL; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.4.0 (2020-03-21)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Oscar
[ Info: Precompiling Oscar [f1435218-dba5-11e9-1e4d-f1a5fab5fc13]
WARNING: import of Hecke.example into Oscar conflicts with an existing identifier; ignored.
 -----    -----    -----      -      -----   
|     |  |     |  |     |    | |    |     |  
|     |  |        |         |   |   |     |  
|     |   -----   |        |     |  |-----   
|     |        |  |        |-----|  |   |    
|     |  |     |  |     |  |     |  |    |   
 -----    -----    -----   -     -  -     -  

...combining (and extending) GAP, Hecke, Nemo, Polymake and Singular
Version not installed ... 
 ... which comes with absolutely no warranty whatsoever
Type: '?Oscar' for more information
(c) 2019-2020 by The Oscar Development Team

btw. Oscar version is not installed :)

@fieker
Copy link
Contributor Author

fieker commented Apr 16, 2020 via email

@fieker
Copy link
Contributor Author

fieker commented Apr 16, 2020 via email

@kalmarek
Copy link
Contributor

@fieker

if Polymake was directly imported by user; if so the banner is printed; otherwise (e.g. imported within Oscar, but not only there) it is suppressed.

that is not a bug, that is a feature

feel free to alter it the way you wish

@lgoettgens
Copy link
Member

I think this can be closed as it is superseded by #480.

@benlorenz benlorenz closed this Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants