This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../sage_conf-pypi/.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
include VERSION.txt | ||
include pyproject.toml | ||
include sage_conf.py.in | ||
graft bin | ||
# | ||
global-exclude .tox | ||
global-exclude *~* | ||
global-exclude *.bak | ||
global-exclude __pycache__ | ||
global-exclude *.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
sage_conf: Configuration module for the SageMath library (relocatable binary version) | ||
===================================================================================== | ||
|
||
Description | ||
----------- | ||
|
||
This 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 | ||
|
||
- a console script ``sage-config``, for querying the variables of ``sage_conf`` | ||
from the shell | ||
|
||
- a sourcable shell script ``sage-env-config``, providing additional configuration | ||
information in the form of environment variables | ||
|
||
This version of the package is suitable for shipping it with binary | ||
distributions of Sage. | ||
|
||
It implements a relocation mechanism that allows an unprivileged user | ||
to install the distribution in any location. | ||
|
||
The Sage distribution should be configured to use 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, | ||
such as ``/var/tmp/sage-9.3.beta7-cpython-39-darwin``. | ||
|
||
Importing ``sage_conf`` (or using the installed | ||
``sage-config`` script) makes sure that a symlink from the hardcoded | ||
``/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. | ||
|
||
License | ||
------- | ||
|
||
GNU General Public License (GPL) v3 or later | ||
|
||
Upstream Contact | ||
---------------- | ||
|
||
https://www.sagemath.org | ||
|
||
This package is included in the source code of the Sage distribution, | ||
in ``src/pkgs/sage_conf-binary/``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../sage_conf-pypi/VERSION.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../sage_conf-pypi/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../sage_conf-pypi/pyproject.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# @configure_input@ | ||
|
||
VERSION = "@PACKAGE_VERSION@" | ||
|
||
MAXIMA = "@prefix@/bin/maxima" | ||
|
||
ARB_LIBRARY = "@SAGE_ARB_LIBRARY@" | ||
|
||
SAGE_NAUTY_BINS_PREFIX = "@SAGE_NAUTY_BINS_PREFIX@" | ||
|
||
# Colon-separated list of pkg-config modules to search for cblas functionality. | ||
# We hard-code it here as cblas because configure (build/pkgs/openblas/spkg-configure.m4) | ||
# always provides cblas.pc, if necessary by creating a facade pc file for a system BLAS. | ||
CBLAS_PC_MODULES = "cblas" | ||
|
||
# Used in sage.repl.ipython_kernel.install | ||
MATHJAX_DIR = "@prefix@/share/mathjax" | ||
THREEJS_DIR = "@prefix@/share/threejs" | ||
|
||
# The following must not be used during build to determine source or installation | ||
# location of sagelib. See comments in SAGE_ROOT/src/Makefile.in | ||
SAGE_LOCAL = "@prefix@" | ||
SAGE_ROOT = "@SAGE_ROOT@" | ||
|
||
SAGE_SPKG_WHEELS = "@prefix@/var/lib/sage/wheels" | ||
|
||
# Relocation. SAGE_ROOT is typically configured to a directory in /var/tmp (sticky). | ||
import os as _os | ||
from pathlib import Path as _Path | ||
SAGE_LOCAL_ABS = _Path(__file__).parent.parent.parent # up from "site_packages" | ||
SAGE_ROOT_ABS = SAGE_LOCAL_ABS.parent | ||
if not (SAGE_ROOT_ABS / "sage").exists(): | ||
raise RuntimeError(f'The inferred SAGE_ROOT_ABS={SAGE_ROOT_ABS} does not look like a Sage root directory') | ||
|
||
if SAGE_ROOT_ABS.resolve() != _Path(SAGE_ROOT).resolve(): | ||
try: | ||
_os.symlink(SAGE_ROOT_ABS, SAGE_ROOT, target_is_directory=True) | ||
except FileExistsError: | ||
pass | ||
|
||
if _os.stat(SAGE_ROOT).st_uid != _os.geteuid(): | ||
raise RuntimeError(f'Cannot create symlink {SAGE_ROOT} - it is owned by another user') | ||
|
||
# Entry point 'sage-config'. It does not depend on any packages. | ||
|
||
def _main(): | ||
from argparse import ArgumentParser | ||
from sys import exit, stdout | ||
parser = ArgumentParser() | ||
parser.add_argument('--version', help="show version", action="version", | ||
version='%(prog)s ' + VERSION) | ||
parser.add_argument("VARIABLE", nargs='?', help="output the value of VARIABLE") | ||
args = parser.parse_args() | ||
d = globals() | ||
if args.VARIABLE: | ||
stdout.write('{}\n'.format(d[args.VARIABLE])) | ||
else: | ||
for k, v in d.items(): | ||
if not k.startswith('_'): | ||
stdout.write('{}={}\n'.format(k, v)) | ||
|
||
if __name__ == "__main__": | ||
_main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[metadata] | ||
name = sage_conf | ||
version = file: VERSION.txt | ||
description = Sage: Open Source Mathematics Software: Configuration module for the SageMath library (relocatable binary) | ||
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 | ||
|
||
[options.entry_points] | ||
console_scripts = | ||
sage-config = sage_conf:_main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../sage_conf/setup.py |