Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Oct 29, 2021
2 parents 748c06b + e068bd9 commit 00c742d
Show file tree
Hide file tree
Showing 85 changed files with 861 additions and 67 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,14 @@ build/bin/sage-build-env-config
/pkgs/*/*.egg-info
/pkgs/*/.tox

/pkgs/sagemath-objects/setup.cfg
/pkgs/sagemath-categories/setup.cfg
/pkgs/sagemath-objects/pyproject.toml
/pkgs/sagemath-categories/pyproject.toml
/pkgs/sagemath-objects/requirements.txt
/pkgs/sagemath-categories/requirements.txt
/pkgs/sagemath-categories/MANIFEST.in

# same for old locations - before Trac #31577
/build/pkgs/*/src/build
/build/pkgs/*/src/dist
Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ download:
dist: build/make/Makefile
./sage --sdist

pypi-sdists: sage_setup
./sage --sh build/pkgs/sage_conf/spkg-src
./sage --sh build/pkgs/sage_setup/spkg-src
./sage --sh build/pkgs/sage_sws2rst/spkg-src
./sage --sh build/pkgs/sage_docbuild/spkg-src
./sage --sh build/pkgs/sage_setup/spkg-src
./sage --sh build/pkgs/sagelib/spkg-src
./sage --sh build/pkgs/sagemath_objects/spkg-src
./sage --sh build/pkgs/sagemath_categories/spkg-src
@echo "Built sdists are in upstream/"

# ssl: build Sage, and also install pyOpenSSL. This is necessary for
# running the secure notebook. This make target requires internet
# access. Note that this requires that your system have OpenSSL
Expand Down
2 changes: 1 addition & 1 deletion build/bin/write-dockerfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ FROM with-system-packages as bootstrapped
#:bootstrapping:
RUN mkdir -p /sage
WORKDIR /sage
ADD Makefile VERSION.txt README.md bootstrap configure.ac sage ./
ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap configure.ac sage .homebrew-build-env tox.ini Pipfile.m4 ./
ADD src/doc/bootstrap src/doc/bootstrap
ADD src/bin src/bin
ADD m4 ./m4
Expand Down
1 change: 0 additions & 1 deletion build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ base-toolchain: _clean-broken-gcc base

# All targets except for the base packages
all-sage: \
sagelib \
$(INSTALLED_PACKAGE_INSTS) \
$(UNINSTALLED_PACKAGES_CLEANS)

Expand Down
2 changes: 1 addition & 1 deletion build/pkgs/pplpy/dependencies
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$(PYTHON) $(MP_LIBRARY) gmpy2 cysignals mpfr mpc ppl | $(PYTHON_TOOLCHAIN) sphinx
$(PYTHON) $(MP_LIBRARY) gmpy2 cysignals mpfr mpc ppl | $(PYTHON_TOOLCHAIN) $(if $(findstring no,$(SAGE_SPKG_INSTALL_DOCS)),,sphinx)

----------
All lines of this file are ignored except the first.
Expand Down
4 changes: 1 addition & 3 deletions build/pkgs/sage_conf/spkg-src
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@ fi
# Exit on failure
set -e

cd build/pkgs/sage_conf

cd src
cd pkgs/sage-conf_pypi
python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES"
2 changes: 1 addition & 1 deletion build/pkgs/sagelib/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ for infile in src/*.m4; do
if [ -f "$infile" ]; then
outfile="src/$(basename $infile .m4)"
if [ "${BOOTSTRAP_QUIET}" = "no" ]; then
echo "$0: installing build/pkgs/sagelib/$outfile"
echo "$0: installing $(pwd)/$outfile"
fi
m4 "$infile" > "$outfile"
fi
Expand Down
1 change: 1 addition & 0 deletions build/pkgs/sagemath_categories/SPKG.rst
1 change: 1 addition & 0 deletions build/pkgs/sagemath_categories/bootstrap
1 change: 1 addition & 0 deletions build/pkgs/sagemath_categories/dependencies
1 change: 1 addition & 0 deletions build/pkgs/sagemath_categories/package-version.txt
1 change: 1 addition & 0 deletions build/pkgs/sagemath_categories/spkg-install
21 changes: 21 additions & 0 deletions build/pkgs/sagemath_categories/spkg-src
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
#
# Script to prepare an sdist tarball for sagemath-categories
# This script is not used during build.
#
# HOW TO MAKE THE TARBALL:
# ./sage --sh build/pkgs/sagemath_categories/spkg-src

if [ -z "$SAGE_ROOT" ] ; then
echo >&2 "Error - SAGE_ROOT undefined ... exiting"
echo >&2 "Maybe run 'sage -sh'?"
exit 1
fi

# Exit on failure
set -e

cd build/pkgs/sagemath_categories

cd src
python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES"
1 change: 1 addition & 0 deletions build/pkgs/sagemath_categories/src
1 change: 1 addition & 0 deletions build/pkgs/sagemath_categories/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
experimental
1 change: 1 addition & 0 deletions build/pkgs/sagemath_objects/SPKG.rst
1 change: 1 addition & 0 deletions build/pkgs/sagemath_objects/bootstrap
4 changes: 4 additions & 0 deletions build/pkgs/sagemath_objects/dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FORCE $(PYTHON) cysignals gmpy2 ipython | $(PYTHON_TOOLCHAIN) cython pkgconfig $(and $(filter-out no,$(SAGE_CHECK)), tox)

# FORCE: Always run the spkg-install script
# ipython - for the doctester
1 change: 1 addition & 0 deletions build/pkgs/sagemath_objects/package-version.txt
8 changes: 8 additions & 0 deletions build/pkgs/sagemath_objects/spkg-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
cd src

if [ "$SAGE_CHECK" != no ]; then
tox
fi
# We skip the install for now.
exit 0
21 changes: 21 additions & 0 deletions build/pkgs/sagemath_objects/spkg-src
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
#
# Script to prepare an sdist tarball for sagemath-objects
# This script is not used during build.
#
# HOW TO MAKE THE TARBALL:
# 1) ./sage --sh build/pkgs/sagemath_objects/spkg-src

if [ -z "$SAGE_ROOT" ] ; then
echo >&2 "Error - SAGE_ROOT undefined ... exiting"
echo >&2 "Maybe run 'sage -sh'?"
exit 1
fi

# Exit on failure
set -e

cd build/pkgs/sagemath_objects

cd src
python3 -u setup.py --no-user-cfg sdist --dist-dir "$SAGE_DISTFILES"
1 change: 1 addition & 0 deletions build/pkgs/sagemath_objects/src
1 change: 1 addition & 0 deletions build/pkgs/sagemath_objects/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
experimental
16 changes: 15 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,13 @@ AC_ARG_ENABLE([cvxopt],
AC_ARG_ENABLE([notebook],
AS_HELP_STRING([--disable-notebook],
[disable build of the Jupyter notebook and related packages]), [
for pkg in notebook nbconvert sagenb_export nbformat terminado send2trash prometheus_client mistune pandocfilters bleach defusedxml jsonschema jupyter_jsmol; do
for pkg in notebook nbconvert sagenb_export nbformat terminado send2trash prometheus_client mistune pandocfilters bleach defusedxml jsonschema jupyter_jsmol argon2_cffi; do
AS_VAR_SET([SAGE_ENABLE_$pkg], [$enableval])
done
])

AS_IF([test "$SAGE_ENABLE_notebook" = no -a "$SAGE_ENABLE_sagelib" = no], [
for pkg in jupyter_client ipykernel ipython zeromq pyzmq; do
AS_VAR_SET([SAGE_ENABLE_$pkg], [$enableval])
done
])
Expand All @@ -469,6 +475,14 @@ AC_ARG_ENABLE([r],
done
])

AC_ARG_ENABLE([sagelib],
AS_HELP_STRING([--disable-sagelib],
[disable build of the Sage library and packages depending on it]), [
for pkg in sagelib sage_docbuild; do
AS_VAR_SET([SAGE_ENABLE_$pkg], [$enableval])
done
])

dnl Packages that require a special override to use the SPKG
dnl when the system package is not usable.
AS_VAR_SET([sage_use_system_gcc], [force])
Expand Down
2 changes: 2 additions & 0 deletions pkgs/sage-conf/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/sage_conf.py
/setup.cfg
/build
/*.egg-info
85 changes: 77 additions & 8 deletions pkgs/sage-conf/README.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
sage_conf: Configuration module for the SageMath library
========================================================
sage_conf: Configuration module for the SageMath library (distributable version)
================================================================================

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

This package provides:
This distribution package provides:

- a single Python module, ``sage_conf``, providing configuration information
to the SageMath library at the time of its installation and at its runtime
Expand All @@ -15,10 +15,79 @@ This package provides:
- a sourcable shell script ``sage-env-config``, providing additional configuration
information in the form of environment variables

This version of the package is generated by the Sage distribution's ``configure``
script. Downstream packagers and advanced developers and users may want to provide
their own implementation of the package to support the intended deployment of
the SageMath library.
The ``sage_conf`` distribution package is polymorphic: It has several implementations.


sage_conf sdist on PyPI
-----------------------

This implementation of the ``sage_conf`` distribution package comes from
https://trac.sagemath.org/ticket/29039, which adds the directory
``pkgs/sage-conf_pypi/``.

To install, use ``pip install -v sage_conf``. Using ``-v`` ensures that diagnostic
messages are displayed.

On installation (or building a wheel), it invokes ``sage_bootstrap`` to establish
a build tree (``SAGE_ROOT``) and installation tree (``SAGE_LOCAL``) for
the SageMath distribution. By default, it uses a subdirectory of ``$HOME/.sage``
that is specific to the version of the distribution and the version of Python in
use. If several virtual environments over the same version of Python install
``sage_conf``, they will share these trees.

After installation of ``sage_conf``, a wheelhouse containing wheels of
various libraries is available; type ``ls $(sage-config
SAGE_SPKG_WHEELS)`` to list them and ``pip install $(sage-config
SAGE_SPKG_WHEELS)/*.whl`` to install them. After this, you can install the Sage
library, for example, using ``pip install sagemath-standard``.


sage_conf wheels
----------------

Prebuilt binary wheels of the ``sage_conf`` distribution package are available
at https://github.com/sagemath/sage-wheels/releases/

This implementation of ``sage_conf`` comes from https://trac.sagemath.org/ticket/31396,
which adds the directory ``pkgs/sage-conf_relocatable/``.

On building a wheel, it invokes ``sage_bootstrap`` to establish a
build and installation tree (``SAGE_ROOT``, ``SAGE_LOCAL``) in a
subdirectory of the directory ``/var/tmp/``, whose name is specific to
the version of the distribution and the version of Python in use.

The wheel distributes a copy of the prebuilt ``SAGE_ROOT`` and
``SAGE_LOCAL``. Importing ``sage_conf`` (or using the installed
``sage-config`` script), makes sure that a symlink from the
``/var/tmp`` location to the actual persistent installation location
is created. As the relocated libraries and programs contain the
hardcoded path ``SAGE_LOCAL`` in various ways (including as rpaths),
this symlink is necessary for the prebuilt libraries and programs to
work.

``/var/tmp`` is a sticky directory on all Linux distributions
following the Filesystem Hierarchy Standard, as well as on macOS and
on Cygwin. On multi-user systems, only one user can use a given
version of the distribution; other installation schemes are recommended
for systems with multiple Sage users.


sage_conf in the SageMath distribution
--------------------------------------

The original version of the distribution package ``sage_conf`` is used
internally in the SageMath distribution. It is provided in the directory
``pkgs/sage-conf/``. This version of the package is generated
by the Sage distribution's ``configure`` script.


sage_conf in downstream distributions
-------------------------------------

Downstream packagers and advanced developers and users may want to provide
their own implementation of the distribution package to support the intended
deployment of the SageMath library.


License
-------
Expand All @@ -31,4 +100,4 @@ Upstream Contact
https://www.sagemath.org

This package is included in the source code of the Sage distribution,
in ``/sage_conf``.
in ``pkgs/sage-conf*``.
3 changes: 3 additions & 0 deletions pkgs/sage-conf/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
5 changes: 5 additions & 0 deletions pkgs/sage-conf/sage_conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ OPENMP_CXXFLAGS = "@OPENMP_CXXFLAGS@"
# The full absolute path to the main Singular library.
LIBSINGULAR_PATH = "@LIBSINGULAR_PATH@".replace('$SAGE_LOCAL', SAGE_LOCAL)

# Installation location of wheels. This is determined at configuration time
# and does not depend on the installation location of sage-conf.
SAGE_SPKG_WHEELS = "@SAGE_VENV@".replace('${SAGE_LOCAL}', SAGE_LOCAL) + "/var/lib/sage/wheels"


# Entry point 'sage-config'. It does not depend on any packages.

def _main():
Expand Down
5 changes: 5 additions & 0 deletions pkgs/sage-conf_pypi/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/sage_conf.py
/build
/dist
/*.egg-info
/.tox
21 changes: 21 additions & 0 deletions pkgs/sage-conf_pypi/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
prune .tox
include VERSION.txt
graft bin
graft sage_root
# These sources are not needed because individual distributions of these are made.
prune sage_root/build/pkgs/*/src*
prune sage_root/pkgs
# Except for this one because config.status writes there
graft sage_root/pkgs/sage-conf
prune sage_root/pkgs/sage-conf/build
# And this one because of declared dependencies on source files in Makefile.in
graft sage_root/pkgs/sage-docbuild
prune sage_root/pkgs/sage-docbuild/build
prune sage_root/pkgs/sage-docbuild/*.egg-info
#
global-exclude .tox
global-exclude *~*
global-exclude *.bak
global-exclude __pycache__
global-exclude *.py[co]
global-exclude *.so
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/README.rst
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/VERSION.txt
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/bin/sage-env-config.in
3 changes: 3 additions & 0 deletions pkgs/sage-conf_pypi/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/sage_conf.py.in
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/sage_root/.homebrew-build-env
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/sage_root/Makefile
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/sage_root/README.md
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/sage_root/VERSION.txt
3 changes: 3 additions & 0 deletions pkgs/sage-conf_pypi/sage_root/bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /usr/bin/env bash
# This version of the bootstrap script does nothing.
exit 0
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/sage_root/build
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/sage_root/config
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/sage_root/configure
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/sage_root/configure.ac
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/sage_root/m4
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/sage_root/pkgs/sage-conf
Loading

0 comments on commit 00c742d

Please sign in to comment.