Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Sep 19, 2021
2 parents c349c87 + 5bb6e0d commit 919f6a7
Show file tree
Hide file tree
Showing 86 changed files with 863 additions and 80 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,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
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ 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/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
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
8 changes: 8 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,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
])

SAGE_SPKG_COLLECT()

dnl AC_CONFIG_HEADERS([config.h])
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
83 changes: 75 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,77 @@ 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
``src/pkgs/sage_conf-pypi/``.

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 ``src/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
``build/pkgs/sage_conf/src``. 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 +98,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"
2 changes: 2 additions & 0 deletions pkgs/sage-conf/sage_conf.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ THREEJS_DIR = SAGE_LOCAL + "/share/threejs-sage"
OPENMP_CFLAGS = "@OPENMP_CFLAGS@"
OPENMP_CXXFLAGS = "@OPENMP_CXXFLAGS@"

SAGE_SPKG_WHEELS = "@prefix@/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
18 changes: 18 additions & 0 deletions pkgs/sage-conf_pypi/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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*
# Except for this one because config.status writes there
graft sage_root/build/pkgs/sage_conf/src
prune sage_root/build/pkgs/sage_conf/src/build
# And this one because of declared dependencies on source files in Makefile.in
graft sage_root/build/pkgs/sage_docbuild/src
prune sage_root/build/pkgs/sage_docbuild/src/build
prune sage_root/build/pkgs/sage_docbuild/src/sage_docbuild.egg-info
#
global-exclude .tox
global-exclude *~*
global-exclude *.bak
global-exclude __pycache__
global-exclude *.pyc
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
1 change: 1 addition & 0 deletions pkgs/sage-conf_pypi/sage_root/src/bin
3 changes: 3 additions & 0 deletions pkgs/sage-conf_pypi/sage_root/src/doc/bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /usr/bin/env bash
# This version of the src/doc/bootstrap script does nothing.
exit 0
16 changes: 16 additions & 0 deletions pkgs/sage-conf_pypi/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[metadata]
name = sage-conf
version = file: VERSION.txt
description = Sage: Open Source Mathematics Software: Configuration module for the SageMath library
long_description = file: README.rst
license = GNU General Public License (GPL) v3 or later
author = The Sage Developers
author_email = sage-support@googlegroups.com
url = https://www.sagemath.org

[options]
py_modules =
sage_conf

scripts =
bin/sage-env-config
Loading

0 comments on commit 919f6a7

Please sign in to comment.