Add patch for python 3.11 compatibility (bz 2099168)

- Add workaround for symlink/directory conflict (bz 2097773)
- Modify the jmol patch to timeout after 5 minutes.  This is a
  workaround for recently observed jmol hangs, but is not a proper fix.
This commit is contained in:
Jerry James 2022-07-06 11:11:16 -06:00
parent 78d0fd60e9
commit 457c650d21
3 changed files with 472 additions and 12 deletions

View file

@ -1,6 +1,6 @@
diff -up src/sage/interfaces/jmoldata.py.orig src/sage/interfaces/jmoldata.py
--- src/sage/interfaces/jmoldata.py.orig 2021-05-09 16:00:11.000000000 -0600
+++ src/sage/interfaces/jmoldata.py 2021-05-28 11:36:18.844565672 -0600
--- src/sage/interfaces/jmoldata.py.orig 2022-05-15 16:11:11.000000000 -0600
+++ src/sage/interfaces/jmoldata.py 2022-07-06 11:03:43.155375965 -0600
@@ -148,8 +148,6 @@ class JmolData(SageObject):
sage: print(os.path.exists(testfile)) # optional -- java
True
@ -10,16 +10,24 @@ diff -up src/sage/interfaces/jmoldata.py.orig src/sage/interfaces/jmoldata.py
target_native = targetfile
if sys.platform == 'cygwin':
@@ -173,10 +171,8 @@ class JmolData(SageObject):
@@ -171,12 +169,14 @@ class JmolData(SageObject):
with open(scratchout, 'w') as jout:
# Now call the java application and write the file.
env = dict(os.environ)
env['LC_ALL'] = 'C'
env['LANG'] = 'C'
- env['LC_ALL'] = 'C'
- env['LANG'] = 'C'
- subprocess.call(["java", "-Xmx512m", "-Djava.awt.headless=true",
- "-jar", jmolpath, "-iox", "-g", size_arg,
- "-J", launchscript, "-j", imagescript],
- stdout=jout, stderr=jout, env=env)
+ subprocess.call(["jmol", "-n", "-g", size_arg,
+ "-J", launchscript, "-j", imagescript], stdout=jout)
+ env['LC_ALL'] = 'C.UTF-8'
+ env['LANG'] = 'C.UTF-8'
+ try:
+ subprocess.call(["jmol", "-n", "-g", size_arg,
+ "-J", launchscript, "-j", imagescript],
+ timeout=300, stdout=jout, stderr=jout, env=env)
+ except:
+ pass
if not os.path.isfile(targetfile):
raise RuntimeError(f"Jmol failed to create file {targetfile}: {Path(scratchout).read_text()}")
os.unlink(scratchout)