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
The jmol spkg contains testjava.sh #14364
Comments
comment:2
I would argue the move is only appropriate if any other package in Sage depends on java. To my knowledge, nothing in the base install other than Jmol does. |
comment:3
You can argue like that if you want, but jmol doesn't use testjava.sh -- devel/sage/sage/interfaces/jmoldata.py does. So I argue that only sage depends on it, and I stand by my report! :-P |
comment:4
Replying to @SnarkBoojum:
You have a good point. Since Sage depends on Jmol, this will always be available if Jmol needs it...I'll put this on my list as I try to incorporate the pure javascript version of Jmol for the notebook. |
comment:5
What's the status of this? |
comment:6
Replying to @SnarkBoojum:
I'm swamped...I am hoping to spend more time on this starting next month, but I have equipment (spectrometers, vacuum lines, computers, etc..to get fixed for next Fall's classes), and some web site programming for use at my University to finish before I can get to this. Sorry, for the delay. I definitely have not forgot about this. |
comment:8
Is there any interest in moving the functionality of --- a/sage/interfaces/jmoldata.py
+++ b/sage/interfaces/jmoldata.py
@@ -86,13 +86,23 @@
sage_makedirs(jmolscratch)
scratchout = os.path.join(jmolscratch,"jmolout.txt")
jout=open(scratchout,'w')
- testjavapath = os.path.join(SAGE_LOCAL, "share", "jmol", "testjava.sh")
- result = subprocess.call([testjavapath],stdout=jout)
- jout.close()
- if (result == 0):
- return (True)
- else:
- return (False)
+ try:
+ version = subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT)
+ import re, types
+ java_version = re.search("version.*[1]\.[567]", version)
+ if type(java_version) is types.NoneType:
+ jout.write('Your version of Java is either deprecated or not supported\nWe support versions 1.5 to 1.7\n')
+ jout.close()
+ result = bool(java_version)
+ else:
+ jout.write('You have a supported version of Java, Exiting\n')
+ jout.close()
+ result = bool(java_version)
+ except (subprocess.CalledProcessError, OSError):
+ jout.write('You do not have Java installed\nWe support versions 1.5 to 1.7\n')
+ jout.close()
+ result = False
+ return result
def export_image(self,
targetfile,
@@ -183,7 +193,7 @@
if not os.path.exists(jmolscratch):
sage_makedirs(jmolscratch)
scratchout = os.path.join(jmolscratch,"jmolout.txt")
- jout=open(scratchout,'w')
+ jout=open(scratchout,'a')
#now call the java application and write the file.
result = subprocess.call(["java","-Xmx512m","-Djava.awt.headless=true","-jar",jmolpath,"-iox","-g",sizeStr,"-J",launchscript,"-j",imagescript],stdout=jout)
jout.close()
|
comment:9
This idea was also discussed earlier. |
comment:10
Replying to @jhpalmieri:
And the ideas are really yours. |
comment:11
I think a lot of people had ideas about this, in fact. |
comment:12
I wrote the original code and think this is a good idea. I did try to make it work that way originally, but ran into some problems, I believe with escaping of quotations. I will try to test this soon and encourage others to as well. If we can give it a positive review it is one less file to keep up-to-date. |
comment:13
strongdon: I'm making an actual patch based on your suggestion. I don't see the need to write to |
Dependencies: #14358 |
Author: Steven Trogdon, Jeroen Demeyer |
Attachment: 14364_testjava.patch.gz |
Changed dependencies from #14358 to none |
Commit: |
comment:16
Attempting to push the New commits:
|
Branch: public/ticket/14364-testjava |
Changed branch from public/ticket/14364-testjava to u/jdemeyer/ticket/14364 |
New commits:
|
comment:22
[ping] Is there anything to test beyond (re)installing the spkg and testing If not, works for me... |
comment:23
Ok, I was finally able to test, and it works. I think reinstalling the spkg won't do the trick for a review, because you'll still have testjava.sh from the previous installation (sage-as-a-distribution doesn't have uninstallation if I don't err). And you'll also need to recompile the sagelib since one of the files has been modified. |
Reviewer: Snark |
comment:24
Hmm...maybe I need to include this in the updated jmol.spkg I'm building? I expect to have some time to devote to that over the next few days. I'll try plugging this into the new code. Replying to @SnarkBoojum:
|
comment:25
The fix for this ticket is two patches:
If they go in, doesn't it update things (in particular the spkg) correctly and automatically? |
comment:26
I believe so, but if I do not fix the updated .spkg it may reinstall testjava.sh, although it would not get used. I will make sure my update is compatible. I too think this ticket is fine. I just have to make my end work well with it. Replying to @SnarkBoojum:
|
Changed branch from u/jdemeyer/ticket/14364 to |
Changed reviewer from Snark to Julien Puydt |
Changed commit from |
This script would be better in the sage-scripts spkg, as it's sage-specific, probably as sage-testjava.sh or some such. The change will break one doctest in devel/sage/sage/interfaces/jmoldata.py, where it is looking for it using the full path.
CC: @gutow
Component: packages: standard
Author: Steven Trogdon, Jeroen Demeyer
Branch:
c7c227e
Reviewer: Julien Puydt
Issue created by migration from https://trac.sagemath.org/ticket/14364
The text was updated successfully, but these errors were encountered: