-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
Make feature TeXFile check latex first #34282
Comments
Commit: |
New commits:
|
Author: Sebastian Oehms |
comment:3
I think it would also make sense to add |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:5
Replying to @mkoeppe:
Done! Furthermore, I refactor the executable features not only to avoid duplicated code, but also since in my point of view it is not reasonable that just the |
comment:6
diff --git a/src/sage/features/latex.py b/src/sage/features/latex.py
index cf65aea6af..7db89f6190 100644
--- a/src/sage/features/latex.py
+++ b/src/sage/features/latex.py
@@ -37,7 +37,7 @@ class LaTeX(Executable):
sage: isinstance(latex(), latex)
True
"""
- Executable.__init__(self, name, executable=name, spkg=latex_spkg, url=latex_url)
+ super().__init__(name, executable=name, spkg=latex_spkg, url=latex_url)
def is_functional(self):
r"""
@@ -217,13 +217,10 @@ class TeXFile(StaticFile, JoinFeature):
sage: from sage.features.latex import LaTeXPackage, pdflatex
sage: f = LaTeXPackage("tkz-graph")
sage: g = pdflatex()
- sage: bool(f.is_present()) == bool(g.is_present()) # indirect doctest
+ sage: not f.is_present() or bool(g.is_present()) # indirect doctest
True
"""
- test = JoinFeature._is_present(self)
- if not test:
- return test
- return super(TeXFile, self)._is_present()
+ return JoinFeature._is_present(self) and StaticFile._is_present(self)
|
comment:7
By the way, why presence of |
comment:8
Replying to @kwankyu:
I'm fine with your first suggestion. Concerning the second, the advantage is not clear to me. With your third suggestion I have a problem since in general I prefer to serialise condition checks if they only work in a certain order. I know that it is no problem any more with modern languages and compilers, since they implicitly serialise in the order they are written. But the syntax using |
comment:9
Replying to @kwankyu:
AFAIK there is no feature that checks if |
comment:10
Replying to @soehms:
Here you want to check that "if f.is_present, then g.is_present". Right? My test just does that expressly.
There is no parallelism here. My simple code exactly does what your code does. Note that
In |
comment:11
Replying to @kwankyu:
Convinced! I had if and only if in mind since AFAIK in reallity
I was saying pretends a parallelism.
So what is the advantage?
Maybe I'm old fashioned, but I know a time where you could not be sure that |
comment:12
Replying to @soehms:
It took me some time to understand the purpose of your code. My code expresses the purpose.
Yeah, this is just Python: https://docs.python.org/3/reference/expressions.html#boolean-operations |
comment:13
Replying to @soehms:
Yes. I know that they are practically the same, but the name |
comment:14
Replying to @kwankyu:
But it might be misleading for people who think |
comment:15
Replying to @kwankyu:
Agreed! I'm on vaccation the next two week. If you don't want to wait that long, feel free to do all of the changes you suggested by yourself. |
comment:16
Replying to @soehms:
But for python programmers, the above use of |
comment:17
Replying to @soehms:
Okay. Happy vacation! |
Changed branch from u/soehms/join_feature_texfile_with_pdflatex_34282 to u/klee/join_feature_texfile_with_pdflatex_34282 |
comment:20
While fixing things, I could not resist from doing more than I intended. Sorry... It seemed that TeXFile doesn't need to be a subclass of JoinFeature. Instead, TeXFile now simply checks latex presence first. New commits:
|
Changed author from Sebastian Oehms to Sebastian Oehms, Kwankyu Lee |
This comment has been minimized.
This comment has been minimized.
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:23
Replying to @kwankyu:
Note that #34185 has a dependency on this ticket and I think this would break things there. More precisely, the method |
comment:24
Replying to @soehms:
Probably.
The purpose of this ticket as in description (but not as in old title) is to fix a bug in TeXFile feature, which did not check latex system in place before it check the presence of a TeX file (such as a latex package). This has nothing to do with #34185. Hence I think that any changes to TeXFile feature related with #34185 should be made in #34185 itself. Moreover, as far as I understand #34185, the goal of #34185 is not clear to me and I doubt if the goal is reasonable. So the present ticket is better to be independent from #34185. |
comment:25
By the way, I am positive with this ticket. |
Reviewer: Kwankyu Lee |
comment:27
Replying to @kwankyu:
I will not be able to look at your additional changes before I will be back home again. At the moment I am still not convinced to remove the inheritance of JoinFeature (independently of #34185), since as fas as I understand this is the conceptual way to indicate dependencies between features. |
comment:28
Replying to @soehms:
No hurry. Enjoy vacation!
I think JoinFeature is not relevant for the bug. A joined feature is conceptually a new feature "A and B" combining A and B. TeXFile is a feature A that requires feature B. Conceptually it is "A => B". |
Changed branch from u/klee/join_feature_texfile_with_pdflatex_34282 to u/soehms/join_feature_texfile_with_pdflatex_34282 |
comment:30
Replying to Kwankyu Lee:
Indeed, according to the examples given in the docstring of the class you are right. But it is at least misleading that most examples of joined features consist of just one: sage: from sage.features.all import all_features
sage: from sage.features.join_feature import JoinFeature
sage: J = [F for F in all_features() if isinstance(F, JoinFeature)]
sage: len([F for F in J if len(F._features) == 1])
16
sage: len([F for F in J if len(F._features) > 1])
7 In these cases the instance of Finally, I agree with your changes, but I observed two little things that I have corrected. If you agree and the patchbot comes green again, you may set to positive review. |
Changed reviewer from Kwankyu Lee to Kwankyu Lee, Sebastian Oehms |
comment:32
Replying to Sebastian Oehms:
It seems In our case, we don't need the trick since we can check the presence of the latex feature.
Thanks. I am positive too! |
comment:33
Replying to Kwankyu Lee:
Exactly! I think
Thanks, as well! |
comment:34
Replying to Kwankyu Lee:
The name of a feature gives the |
comment:35
Replying to Sebastian Oehms:
That would be nice. Matthias explains clearly how unary |
comment:36
Replying to Kwankyu Lee:
This is now #34508! |
Changed branch from u/soehms/join_feature_texfile_with_pdflatex_34282 to |
Currently, as observed in comment 7 of #34185, the method
is_present
of instances of classTeXFile
runs into an exception if latex is not installed. For example:The aim of the ticket is to fix this.
CC: @seblabbe
Component: doctest framework
Keywords: latex texfile feature
Author: Sebastian Oehms, Kwankyu Lee
Branch/Commit:
a77ff0c
Reviewer: Kwankyu Lee, Sebastian Oehms
Issue created by migration from https://trac.sagemath.org/ticket/34282
The text was updated successfully, but these errors were encountered: