#20802: Restore Python 2.6+ compatibility
---------------------------------+--------------------------
Reporter: vbraun | Owner:
Type: defect | Status: needs_work
Priority: blocker | Milestone: sage-7.3
Component: documentation | Resolution:
Keywords: | Merged in:
Authors: Volker Braun | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: #19984 | Stopgaps:
---------------------------------+--------------------------
Comment (by leif):
Ping.
Do we need more than, say
{{{
#!diff
diff --git a/build/bin/sage-uncompress-spkg b/build/bin/sage-uncompress-
spkg
index 9b72878..e7339ad 100755
--- a/build/bin/sage-uncompress-spkg
+++ b/build/bin/sage-uncompress-spkg
@@ -28,10 +28,22 @@ printing the SPKG.txt file from an old-style spkg.)
from __future__ import print_function
-import argparse
-import copy
import os
import sys
+try:
+ import argparse
+except ImportError:
+ # Python 2.6 doesn't have it
+ SAGE_ROOT = os.environ.get("SAGE_ROOT")
+ if not SAGE_ROOT:
+ sys.stderr.write(
+ "Error: SAGE_ROOT not set, needed to import Sage's argparse
module.\n")
+ sys.exit(1)
+ sys.path.append(os.path.join(SAGE_ROOT, "build", "sage_bootstrap",
"compat"))
+ # we could also first check the presence of Sage's argparse.py here
+ import argparse
+ # bail out if that also fails (or suggest something else?)
+import copy
import tarfile
import zipfile
}}}
?
--
Ticket URL: <https://trac.sagemath.org/ticket/20802#comment:14>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.