- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 684
New feature for eclib/mwrank #41042
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
base: develop
Are you sure you want to change the base?
New feature for eclib/mwrank #41042
Changes from all commits
4a8fcb1
              4c6e9b4
              5825daa
              ebe700b
              6676a62
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| r""" | ||
| Feature for testing the presence of the ``mwrank`` program (part | ||
| of eclib) | ||
| """ | ||
|  | ||
| from . import Executable, FeatureTestResult | ||
|  | ||
|  | ||
| class Mwrank(Executable): | ||
| r""" | ||
| A :class:`~sage.features.Feature` describing the presence of | ||
| the ``mwrank`` program. | ||
| EXAMPLES:: | ||
| sage: from sage.features.mwrank import Mwrank | ||
| sage: Mwrank().is_present() # needs mwrank | ||
| FeatureTestResult('mwrank', True) | ||
| """ | ||
| def __init__(self): | ||
| r""" | ||
| TESTS:: | ||
| sage: from sage.features.mwrank import Mwrank | ||
| sage: isinstance(Mwrank(), Mwrank) | ||
| True | ||
| """ | ||
| Executable.__init__(self, 'mwrank', executable='mwrank', | ||
| spkg='eclib', type='standard') | ||
|  | ||
|  | ||
| def all_features(): | ||
| return [Mwrank()] | ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -537,6 +537,33 @@ def __init__(self): | |
| spkg='sagemath_ntl', type='standard') | ||
|  | ||
|  | ||
| class sage__libs__eclib(JoinFeature): | ||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think conditionalizing on imports in sagelib is a good idea: when the import fails, all tests that would otherwise have notified us about the import problem are disabled. (This actually came up recently in the context of bliss, where it was not clear if the tests just 'succeed' because they were disabled.) So I would prefer if you could directly conditionalize on eclib, using the detection with meson. So either write a  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is the way to go, but I also think we should all think this through (in a GH discussion?) first. It would make more sense, especially for the features in  
 For executables, I definitely want the ability to pass  For internal cython modules, there's really no other way to obtain the module than to rebuild sage, so being able to detect them on-the-fly doesn't really help. Although I guess it's possible that some distro maintainer is building all of sage and then putting   External cython modules are the easiest case IMO. Right now sagemath_giac is the main example, but there's no reason (other than lack of time) we couldn't do the same thing with e.g. sagemath_bliss. What's nice about these is that it solves the runtime detection problem in a very simple way. If you want support for giac in sage, you install sagemath_giac. If you don't, you don't. We can detect it at runtime without side effects because, in this very special case, there's no other reason for you to have sagemath_giac installed. This is in contrast with (say) ffmpeg that I have installed for other reasons. tl;dr in this case runtime detection is fine. Being able to force-disable or force-enable the feature would be a bonus, but these aren't our main problem. | ||
| r""" | ||
| A :class:`sage.features.Feature` describing the presence of | ||
| :mod:`sage.libs.eclib`. | ||
|  | ||
| In addition to the modularization purposes that this tag serves, | ||
| it also provides attribution to the upstream project. | ||
|  | ||
| TESTS:: | ||
|  | ||
| sage: from sage.features.sagemath import sage__libs__eclib | ||
| sage: sage__libs__eclib().is_present() # needs sage.libs.eclib | ||
| FeatureTestResult('sage.libs.eclib', True) | ||
| """ | ||
| def __init__(self): | ||
| r""" | ||
| TESTS:: | ||
|  | ||
| sage: from sage.features.sagemath import sage__libs__eclib | ||
| sage: isinstance(sage__libs__eclib(), sage__libs__eclib) | ||
| True | ||
| """ | ||
| JoinFeature.__init__(self, 'sage.libs.eclib', | ||
| [PythonModule('sage.libs.eclib.mwrank')], | ||
| spkg='eclib', type='standard') | ||
|  | ||
|  | ||
| class sage__libs__giac(JoinFeature): | ||
| r""" | ||
| A :class:`sage.features.Feature` describing the presence of :mod:`sage.libs.giac`. | ||
|  | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to move this runtime check to a compile time meson check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above. Yes, but we should either (a) have a plan for how to leave it detectable at runtime, since this is easy to install after sage is installed, or (b) decide as a group that we don't want to detect it at runtime, so that I don't get yelled at for breaking something without community input.