Skip to content

Commit

Permalink
sagemathgh-37056: Installation guide: Show system package commands us…
Browse files Browse the repository at this point in the history
…ing sphinx-inline-tabs

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->
Preview: https://deploy-preview-37056--
sagemath.netlify.app/html/en/installation/source#linux-system-package-
installation

Same for the SPKG pages in the reference manual. https://deploy-
preview-37056--
sagemath.netlify.app/html/en/reference/spkg/gfortran#equivalent-system-
packages

Same for the git instructions in the developer guide, using 2 tabs for
HTTPS and SSH: https://deploy-preview-37056--
sagemath.netlify.app/html/en/developer/github#forking-the-sage-
repository

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->
- Depends on sagemath#36957 (merged here)

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#37056
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee
  • Loading branch information
Release Manager committed Jan 29, 2024
2 parents 8d9ceb5 + 2392b19 commit d13c3c6
Show file tree
Hide file tree
Showing 15 changed files with 191 additions and 156 deletions.
7 changes: 5 additions & 2 deletions build/bin/sage-print-system-package-command
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ SUDO=
PROMPT=
SPKG=no
if [ -n "$OUTPUT_RST" ]; then
COMMENT=""
COMMENT="$RST_INDENT"
else
COMMENT="# "
fi
Expand Down Expand Up @@ -86,7 +86,7 @@ function print_shell_command()
{
if [ -n "$OUTPUT_RST" ]; then
echo
echo ".. CODE-BLOCK:: bash"
echo "$RST_INDENT.. CODE-BLOCK:: bash"
echo
fi
# shell-quote arguments if necessary
Expand All @@ -103,6 +103,9 @@ function print_shell_command()

function print_comment()
{
if [ -n "$OUTPUT_RST" ]; then
echo
fi
echo "${COMMENT}$1"
}

Expand Down
56 changes: 38 additions & 18 deletions build/bin/sage-spkg-info
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ if [ -n "$OUTPUT_RST" ]; then
echo ".. _spkg_$PKG_BASE:"
echo
ref () { echo ":ref:\`$1\`"; }
spkg () { ref spkg_$1; }
issue () { echo ":issue:\`$1\`"; }
code () { echo "\`\`$*\`\`"; }
tab () { echo ".. tab:: $1"; }
else
ref () { echo "$1"; }
spkg () { echo "$1"; }
issue () { echo "https://github.com/sagemath/sage/issues/$1"; }
code () { echo "$1"; }
tab () { echo "$1:"; }
fi
PKG_SCRIPTS="$SAGE_ROOT/build/pkgs/$PKG_BASE"
for ext in rst txt; do
Expand Down Expand Up @@ -56,7 +60,7 @@ for dep_file in dependencies dependencies_order_only; do
# Looks like a package
*) if [ -r "$SAGE_ROOT/build/pkgs/$dep/SPKG.rst" ]; then
# This RST label is set in src/doc/bootstrap
echo "- $(ref spkg_$dep)"
echo "- $(spkg $dep)"
else
echo "- $dep"
fi;;
Expand Down Expand Up @@ -96,31 +100,47 @@ for system_package_file in "$PKG_DISTROS"/*.txt; do
esac
fi
done
if [ $have_repology = yes ]; then
systems="$systems repology"
fi
system=
# Show using inline tabs
export RST_INDENT=" "
for system in $systems; do
system_package_file="$PKG_DISTROS"/$system.txt
system_packages="$(echo $(sed 's/#.*//;' $system_package_file))"
case $system in
debian)
# Generic
echo "Debian/Ubuntu:"
;;
fedora)
# Generic
echo "Fedora/Redhat/CentOS:"
;;
repology)
;;
*)
echo "$system:"
;;
alpine) tab "Alpine";;
arch) tab "Arch Linux";;
conda) tab "conda-forge";;
cygwin) tab "Cygwin";;
debian) tab "Debian/Ubuntu";;
fedora) tab "Fedora/Redhat/CentOS";;
freebsd) tab "FreeBSD";;
gentoo) tab "Gentoo Linux";;
homebrew) tab "Homebrew";;
macports) tab "MacPorts";;
nix) tab "Nixpkgs";;
openbsd) tab "OpenBSD";;
opensuse) tab "openSUSE";;
slackware) tab "Slackware";;
void) tab "Void Linux";;
repology) ;;
*) tab "$system";;
esac
sage-print-system-package-command $system --wrap --prompt=' $ ' --continuation=' ' --sudo install $system_packages
if [ -n "$system_packages" ]; then
sage-print-system-package-command $system --wrap --prompt="$RST_INDENT"' $ ' --continuation="$RST_INDENT"' ' --sudo install $system_packages
else
echo
echo "${RST_INDENT}No package needed."
fi
echo
done
unset RST_INDENT
if [ $have_repology = yes ]; then
# Show below the inline tabs
system=repology
system_package_file="$PKG_DISTROS"/$system.txt
system_packages="$(echo $(sed 's/#.*//;' $system_package_file))"
sage-print-system-package-command $system --wrap --prompt=' $ ' --continuation=' ' --sudo install $system_packages
fi
if [ -z "$system" ]; then
echo "(none known)"
else
Expand Down
1 change: 0 additions & 1 deletion build/pkgs/calver/distros/package-version.txt

This file was deleted.

2 changes: 1 addition & 1 deletion build/pkgs/sagemath_doc_html/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sagelib sphinx sphinx_copybutton pplpy_doc | $(SAGERUNTIME) maxima networkx scipy sympy matplotlib pillow mathjax mpmath ipykernel jupyter_client conway_polynomials tachyon jmol ipywidgets jupyter_sphinx sage_docbuild elliptic_curves furo fpylll
sagelib sphinx sphinx_copybutton sphinx_inline_tabs pplpy_doc | $(SAGERUNTIME) maxima networkx scipy sympy matplotlib pillow mathjax mpmath ipykernel jupyter_client conway_polynomials tachyon jmol ipywidgets jupyter_sphinx sage_docbuild elliptic_curves furo fpylll

# Building the documentation has many dependencies, because all
# documented modules are imported and because we use matplotlib to
Expand Down
16 changes: 16 additions & 0 deletions build/pkgs/sphinx_inline_tabs/SPKG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
sphinx_inline_tabs: Add inline tabbed content to your Sphinx documentation.
===========================================================================

Description
-----------

Add inline tabbed content to your Sphinx documentation.

License
-------

Upstream Contact
----------------

https://pypi.org/project/sphinx-inline-tabs/

5 changes: 5 additions & 0 deletions build/pkgs/sphinx_inline_tabs/checksums.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tarball=sphinx_inline_tabs-VERSION-py3-none-any.whl
sha1=1404e320d0533280355e7e1e71cffd9937015027
md5=7373d0ebd34be8f9ac2ed62bc63f4582
cksum=2708358042
upstream_url=https://pypi.io/packages/py3/s/sphinx_inline_tabs/sphinx_inline_tabs-VERSION-py3-none-any.whl
4 changes: 4 additions & 0 deletions build/pkgs/sphinx_inline_tabs/dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sphinx | $(PYTHON_TOOLCHAIN) $(PYTHON)

----------
All lines of this file are ignored except the first.
1 change: 1 addition & 0 deletions build/pkgs/sphinx_inline_tabs/install-requires.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sphinx-inline-tabs
1 change: 1 addition & 0 deletions build/pkgs/sphinx_inline_tabs/package-version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023.4.21
3 changes: 3 additions & 0 deletions build/pkgs/sphinx_inline_tabs/spkg-configure.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SAGE_SPKG_CONFIGURE([sphinx_inline_tabs], [
SAGE_PYTHON_PACKAGE_CHECK([sphinx_inline_tabs])
])
1 change: 1 addition & 0 deletions build/pkgs/sphinx_inline_tabs/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
standard
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ AC_ARG_ENABLE([doc],
AS_HELP_STRING([--disable-doc],
[disable build of the Sage documentation and packages depending on it]), [
dnl Disable packages needed for docbuilding
for pkg in sage_docbuild alabaster babel snowballstemmer imagesize sphinx sphinxcontrib_devhelp sphinxcontrib_jsmath sphinxcontrib_serializinghtml sphinxcontrib_applehelp sphinxcontrib_htmlhelp sphinxcontrib_qthelp sphinxcontrib_websupport jupyter_sphinx furo sphinx_copybutton mathjax sphinx_basic_ng; do
for pkg in sage_docbuild alabaster babel snowballstemmer imagesize sphinx sphinxcontrib_devhelp sphinxcontrib_jsmath sphinxcontrib_serializinghtml sphinxcontrib_applehelp sphinxcontrib_htmlhelp sphinxcontrib_qthelp sphinxcontrib_websupport jupyter_sphinx furo sphinx_copybutton sphinx_inline_tabs mathjax sphinx_basic_ng; do
AS_VAR_SET([SAGE_ENABLE_$pkg], [$enableval])
done
AS_VAR_IF([enableval], [no], [dnl Disable the docbuild by disabling the install tree for documentation
Expand Down
74 changes: 60 additions & 14 deletions src/doc/en/developer/github.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ https://github.com/alice/sage.

Next if you don't have a local Git repo of Sage, then start afresh `cloning
your fork
<https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository>`_::
<https://docs.github.com/en/get-started/quickstart/fork-a-repo#cloning-your-forked-repository>`_:

.. tab:: By HTTPS protocol

::

[alice@localhost ~]$ git clone https://github.com/alice/sage.git
Cloning into 'sage'...
Expand All @@ -139,7 +143,30 @@ your fork
origin https://github.com/alice/sage.git (fetch)
origin https://github.com/alice/sage.git (push)

If you already have a local Git repo and only want to link your fork as ``origin`` remote, then do::
.. tab:: By SSH protocol

::

[alice@localhost ~]$ git clone git@github.com:alice/sage.git
Cloning into 'sage'...
remote: Enumerating objects: 914565, done.
remote: Counting objects: 100% (2738/2738), done.
remote: Compressing objects: 100% (855/855), done.
remote: Total 914565 (delta 1950), reused 2493 (delta 1875), pack-reused 911827
Receiving objects: 100% (914565/914565), 331.09 MiB | 11.22 MiB/s, done.
Resolving deltas: 100% (725438/725438), done.
Updating files: 100% (9936/9936), done.
[alice@localhost ~]$ cd sage
[alice@localhost sage]$ git remote -v
origin git@github.com:alice/sage.git (fetch)
origin git@github.com:alice/sage.git (push)


If you already have a local Git repo and only want to link your fork as ``origin`` remote, then do:

.. tab:: By HTTPS protocol

::

[alice@localhost sage]$ git remote add origin https://github.com/alice/sage.git
[alice@localhost sage]$ git remote -v
Expand All @@ -155,7 +182,29 @@ If you already have a local Git repo and only want to link your fork as ``origin
From https://github.com/alice/sage
* [new branch] develop -> origin/develop

You also add the Sage repo ``sagemath/sage`` as your remote ``upstream``::
.. tab:: By SSH protocol

::

[alice@localhost sage]$ git remote add origin git@github.com:alice/sage.git
[alice@localhost sage]$ git remote -v
origin git@github.com:alice/sage.git (fetch)
origin git@github.com:alice/sage.git (push)
[alice@localhost sage]$ git fetch origin
remote: Enumerating objects: 1136, done.
remote: Counting objects: 100% (1084/1084), done.
remote: Compressing objects: 100% (308/308), done.
remote: Total 1136 (delta 825), reused 982 (delta 776), pack-reused 52
Receiving objects: 100% (1136/1136), 2.62 MiB | 5.30 MiB/s, done.
Resolving deltas: 100% (838/838), completed with 145 local objects.
From git@github.com:alice/sage
* [new branch] develop -> origin/develop

You also add the Sage repo ``sagemath/sage`` as your remote ``upstream``:

.. tab:: By HTTPS protocol

::

[alice@localhost sage]$ git remote add upstream https://github.com/sagemath/sage.git
[alice@localhost sage]$ git remote -v
Expand All @@ -164,19 +213,16 @@ You also add the Sage repo ``sagemath/sage`` as your remote ``upstream``::
upstream https://github.com/sagemath/sage.git (fetch)
upstream https://github.com/sagemath/sage.git (push)

.. tab:: By SSH protocol

.. NOTE::

If you linked your Git to GitHub by SSH protocol, then do the following
instead to set up remotes::
::

[alice@localhost sage]$ git remote add origin git@github.com:alice/sage.git
[alice@localhost sage]$ git remote add upstream git@github.com:sagemath/sage.git
[alice@localhost sage]$ git remote -v
origin git@github.com:alice/sage.git (fetch)
origin git@github.com:alice/sage.git (push)
upstream git@github.com:sagemath/sage.git (fetch)
upstream git@github.com:sagemath/sage.git (push)
[alice@localhost sage]$ git remote add upstream git@github.com:sagemath/sage.git
[alice@localhost sage]$ git remote -v
origin git@github.com:alice/sage.git (fetch)
origin git@github.com:alice/sage.git (push)
upstream git@github.com:sagemath/sage.git (fetch)
upstream git@github.com:sagemath/sage.git (push)

To prevent accidental pushes to ``upstream`` (instead of ``origin``), you may want to disable it by running::

Expand Down
Loading

0 comments on commit d13c3c6

Please sign in to comment.