Skip to content
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

Add -version, -root, and -branch for printing version, SAGE_ROOT, and branch information. #433

Closed
ncalexan mannequin opened this issue Aug 16, 2007 · 2 comments
Closed

Comments

@ncalexan
Copy link
Mannequin

ncalexan mannequin commented Aug 16, 2007

Add -version, -root, and -branch for printing version, SAGE_ROOT, and branch information.

Useful from the command line.

Version information is taken from sage-banner; I would prefer it to be taken from the mercurial tags, but these are not kept updated.

The root information is taken from the environment via sage-env.

The branch information is taken from readlink SAGE_ROOT/devel/sage.

mero:~/sage/local/bin ncalexan$ sage -v
SAGE Version 2.8, Release Date: 2007-08-12

mero:~/sage/local/bin ncalexan$ sage -version
SAGE Version 2.8, Release Date: 2007-08-12

mero:~/sage/local/bin ncalexan$ sage -branch
nca

mero:~/sage/local/bin ncalexan$ sage -root
/Users/ncalexan/sage

Component: user interface

Keywords: version root branch

Issue created by migration from https://trac.sagemath.org/ticket/433

@ncalexan
Copy link
Mannequin Author

ncalexan mannequin commented Aug 16, 2007

comment:1

This thing won't let me attach a bundle, so here's the text of the trivial patch.

# HG changeset patch
# User Nick Alexander <[email protected]>
# Date 1187292085 25200
# Node ID da40e197fbefada36d098a0c449e65c3622387e1
# Parent  840d064e20ea5bdbce4f71bb5ea5af07025d6f1b
Add -version, -root, and -branch for printing version, SAGE_ROOT, and branch information.

diff -r 840d064e20ea -r da40e197fbef sage-sage
--- a/sage-sage Sun Aug 12 18:17:20 2007 -0700
+++ b/sage-sage Thu Aug 16 12:21:25 2007 -0700
@@ -6,6 +6,7 @@ usage() {
     echo "-----------------------------------------------------------"
     echo " Optional arguments:"
     echo "  -h            -- print this help message"
+    echo "  -v, -version  -- print the SAGE version"
     echo "  -notebook [options] -- start the SAGE notebook (options are"
     echo "                   the same as to the notebook command in SAGE)"
     echo "  -inotebook [options] -- start the *insecure* SAGE notebook "
@@ -32,6 +33,7 @@ usage_advanced() {
     echo "  -ba [branch]  -- switch to, rebuild all Cython code, and run SAGE branch in devel/sage-branch"
     echo "  -ba-force [branch] -- same as -ba, but don't query before rebuilding"
     echo "  -bdist VER    -- build a binary distribution of SAGE"
+    echo "  -branch       -- print the current SAGE branch"
     echo "  -cleaner      -- run the SAGE cleaner"
     echo "  -clisp [...]  -- run Common Lisp"
     echo "  -clone [new branch] -- clone and run a new branch of the SAGE library from current branch"
@@ -62,6 +64,7 @@ usage_advanced() {
     echo "  -preparse <file.sage> -- produce corresponding file.sage.py "
     echo "  -python       -- run the python interpreter"
     echo "  -q            -- quiet; start with no banner"
+    echo "  -root         -- print the SAGE root directory"
     echo "  -sdist VER    -- build a source distribution of SAGE"
     echo "  -singular <..>-- run SAGE's singular with given arguments"
     echo "  -twistd <..>  -- run Twisted server"
@@ -203,6 +206,25 @@ fi
 fi
 
 #####################################################################
+# Report information about the SAGE environment
+#####################################################################
+
+if [ $1 = '-v' -o $1 = '-version' ]; then
+    cat "$SAGE_LOCAL/bin/sage-banner" | grep -i "version" | sed "s/\| //" | sed "s/ *\|//"
+    exit $?
+fi
+
+if [ $1 = '-root' ]; then
+    echo "$SAGE_ROOT"
+    exit 0
+fi
+
+if [ $1 = '-branch' ]; then
+    readlink "$SAGE_ROOT/devel/sage" | sed "s/sage-//"
+    exit $?
+fi
+
+#####################################################################
 # Run SAGE's versions of the standard Algebra/Geometry etc. software
 #####################################################################

@ncalexan ncalexan mannequin added t: enhancement and removed t: bug labels Aug 17, 2007
@ncalexan
Copy link
Mannequin Author

ncalexan mannequin commented Aug 18, 2007

@ncalexan ncalexan mannequin assigned ncalexan and unassigned williamstein Aug 18, 2007
@williamstein williamstein added this to the sage-2.8.2 milestone Aug 19, 2007
tobiasdiez pushed a commit to tobiasdiez/sage that referenced this issue Feb 22, 2024
* Add initial support for poetry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant