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 sage -i http://.../foo.spkg work immediately #13373
Comments
comment:1
So we need some (In case there's some capable system-wide Python in the user's To not have different files with the same name (in We could probably drop the Python implementations completely in favor of Bash versions (although in theory neither |
Tentative / preliminary "stand-alone" shell script to replace |
comment:2
Attachment: latest-online-spkg.sh.gz Ok, couldn't resist to write some shell script to replace Do what you want with it... ;-) Replacing |
comment:3
P.S.: Also hardly tested (especially not using it from |
comment:4
P.P.S.: Since the scripts are / will be very similar, I'd write a single script which operates depending on |
comment:5
Replying to @nexttime:
Or better: why not create a separate script |
comment:6
Concerning verbosity of these scripts: The current Python scripts also show something when downloading, so I wouldn't mind having |
Author: Leif Leonhardy, Jeroen Demeyer |
comment:7
I expanded on Leif's idea and made a self-contained patch. This no longer uses neither |
This comment has been minimized.
This comment has been minimized.
Attachment: 13373_remove_scripts.patch.gz Attachment: 13373_doc.patch.gz |
This comment has been minimized.
This comment has been minimized.
comment:10
It mostly seems to work, although I would like other people to review this as well. One problem: if curl, wget, and python are not available, running
|
comment:11
I was already doubting whether to use |
comment:12
This doesn't work with Solaris grep :-( |
comment:13
Now if the programs are not available, sage-download-file is executed four times ( |
comment:14
Portability problems fixed by using slightly contrived sed commands instead of grep. |
comment:15
New version, fails immediately if downloading one of the package lists failed. |
comment:16
I was wondering if you could use egrep instead of grep. sed is fine, though... Why do you use I think it might be clearer with some extra output, say like this: diff --git a/spkg/bin/sage-spkg b/spkg/bin/sage-spkg
--- a/spkg/bin/sage-spkg
+++ b/spkg/bin/sage-spkg
@@ -258,6 +258,8 @@ if [ ! -f "$PKG_SRC" ]; then
URL_BASE="${SAGE_SERVER}packages"
for repo in optional experimental standard archive; do
# Download the list of packages.
+ echo
+ echo "Checking list of $repo packages."
repolist="${repo}.list"
sage-download-file "$URL_BASE/$repo/list" >$repolist
if [ $? -ne 0 ]; then
@@ -282,10 +284,12 @@ if [ ! -f "$PKG_SRC" ]; then
echo >&2 "Error: Could not find a package matching $PKG_NAME in $URL_BASE"
exit 1
fi
- echo >&2 "Found $PKG_NAME"
+ echo
+ echo "Found $PKG_NAME."
fi
PKG_SRC="`pwd`/$PKG_NAME.spkg"
+ echo "Downloading $PKG_NAME.spkg."
sage-download-file "$PKG_URL" >"$PKG_SRC"
if [ $? -ne 0 ]; then
# Delete failed download |
Attachment: 13373_sage-i.patch.gz |
comment:17
Some further cosmetic changes. Also one important functional change: first download to a temporary file, such that we don't get a corrupted download. |
comment:18
I am also using |
comment:19
I just ran into a tangentially related problem: if you unpack the Sage tarball and run |
comment:20
With Sage's Python, hitting ctrl-c not only interrupts the download but also causes the file to be deleted: the sage-download-file "$PKG_URL" >"$PKG_TMP"
if [ $? -ne 0 ]; then
# Delete failed download
rm -f "$PKG_TMP"
echo >&2 "Error: failed to download package $PKG_NAME"
exit 1
fi But with curl, and I think wget, hitting ctrl-c dumps me out of the script entirely, so I still end up with the temporary file. What do you think about something like this: diff --git a/spkg/bin/sage-spkg b/spkg/bin/sage-spkg
--- a/spkg/bin/sage-spkg
+++ b/spkg/bin/sage-spkg
@@ -284,6 +284,7 @@ if [ ! -f "$PKG_SRC" ]; then
# corrupted .spkg file).
PKG_TMP="$PKG_NAME.tmp"
echo ">>> Downloading $PKG_NAME.spkg."
+ trap 'echo' INT
sage-download-file "$PKG_URL" >"$PKG_TMP"
if [ $? -ne 0 ]; then
# Delete failed download
@@ -291,6 +292,7 @@ if [ ! -f "$PKG_SRC" ]; then
echo >&2 "Error: failed to download package $PKG_NAME"
exit 1
fi
+ trap - INT
PKG_SRC="`pwd`/$PKG_NAME.spkg"
mv -f "$PKG_TMP" "$PKG_SRC" (This seems to work. Is it the right way to catch ctrl-c?) |
comment:21
Personally, I wouldn't worry about the non-deleting of that temporary file and just leave things as they are. That temporary file will be overwritten anyway if the user tries to download that package again. Concerning
That should work, so I wouldn't worry too much either. |
comment:22
Okay, looks good. Works on linux, OS X 10.7, Solaris, OpenSolaris. |
Reviewer: John Palmieri |
Merged: sage-5.3.rc0 |
The following works right after extracting the Sage source tarball:
But this doesn't work for remote packages:
or
Using either
wget
,curl
or system Python, we should also make this work.Apply:
SAGE_ROOT
.SAGE_LOCAL/bin
.Component: scripts
Author: Leif Leonhardy, Jeroen Demeyer
Reviewer: John Palmieri
Merged: sage-5.3.rc0
Issue created by migration from https://trac.sagemath.org/ticket/13373
The text was updated successfully, but these errors were encountered: