Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit 5e9366d

Browse files
author
Matthias Koeppe
committed
Merge tag '9.3.beta2' into t/30947/src_doc_bootstrap__simplify_by_using_new_options_of__sage__package_list_
SageMath version 9.3.beta2, Release Date: 2020-11-24
2 parents 5ad29d5 + 020bd59 commit 5e9366d

File tree

293 files changed

+4758
-14032
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

293 files changed

+4758
-14032
lines changed

.github/workflows/lint.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint-pycodestyle:
7+
name: Code style check with pycodestyle
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Set up Python
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: 3.8
16+
- name: Install pycodestyle
17+
run: pip install tox pycodestyle
18+
- name: Lint using pycodestyle
19+
run: tox -e pycodestyle
20+
lint-relint:
21+
name: Code style check with relint
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v2
26+
- name: Set up Python
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: 3.8
30+
- name: Install pycodestyle
31+
run: pip install tox relint
32+
- name: Lint using relint
33+
run: tox -e relint src/
34+
lint-pyright:
35+
name: Static type check with pyright
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v2
40+
- name: Set up node to install pyright
41+
uses: actions/setup-node@v1
42+
with:
43+
node-version: '12'
44+
- name: Install pyright
45+
run: npm install -g pyright
46+
- name: Lint using pyright
47+
run: pyright

.github/workflows/tox-experimental.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
TOKEN="${{ secrets.GITHUB_TOKEN }}"
7070
fi
7171
if echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin; then
72-
echo "::set-env name=DOCKER_PUSH_REPOSITORY::docker.pkg.github.com/${{ github.repository }}/"
72+
echo "DOCKER_PUSH_REPOSITORY=docker.pkg.github.com/${{ github.repository }}/" >> $GITHUB_ENV
7373
fi
7474
- run: |
7575
set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;"

.github/workflows/tox-gcc_spkg.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
TOKEN="${{ secrets.GITHUB_TOKEN }}"
6868
fi
6969
if echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin; then
70-
echo "::set-env name=DOCKER_PUSH_REPOSITORY::docker.pkg.github.com/${{ github.repository }}/"
70+
echo "DOCKER_PUSH_REPOSITORY=docker.pkg.github.com/${{ github.repository }}/" >> $GITHUB_ENV
7171
fi
7272
- run: |
7373
set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;"

.github/workflows/tox-optional.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
TOKEN="${{ secrets.GITHUB_TOKEN }}"
7272
fi
7373
if echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin; then
74-
echo "::set-env name=DOCKER_PUSH_REPOSITORY::docker.pkg.github.com/${{ github.repository }}/"
74+
echo "DOCKER_PUSH_REPOSITORY=docker.pkg.github.com/${{ github.repository }}/" >> $GITHUB_ENV
7575
fi
7676
- run: |
7777
set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;"

.github/workflows/tox.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
TOKEN="${{ secrets.GITHUB_TOKEN }}"
6868
fi
6969
if echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin; then
70-
echo "::set-env name=DOCKER_PUSH_REPOSITORY::docker.pkg.github.com/${{ github.repository }}/"
70+
echo "DOCKER_PUSH_REPOSITORY=docker.pkg.github.com/${{ github.repository }}/" >> $GITHUB_ENV
7171
fi
7272
- run: |
7373
set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;"

.zenodo.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"description": "Mirror of the Sage https://sagemath.org/ source tree",
33
"license": "other-open",
4-
"title": "sagemath/sage: 9.3.beta1",
5-
"version": "9.3.beta1",
4+
"title": "sagemath/sage: 9.3.beta2",
5+
"version": "9.3.beta2",
66
"upload_type": "software",
7-
"publication_date": "2020-11-07",
7+
"publication_date": "2020-11-24",
88
"creators": [
99
{
1010
"affiliation": "SageMath.org",
@@ -15,7 +15,7 @@
1515
"related_identifiers": [
1616
{
1717
"scheme": "url",
18-
"identifier": "https://github.com/sagemath/sage/tree/9.3.beta1",
18+
"identifier": "https://github.com/sagemath/sage/tree/9.3.beta2",
1919
"relation": "isSupplementTo"
2020
},
2121
{

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SageMath version 9.3.beta1, Release Date: 2020-11-07
1+
SageMath version 9.3.beta2, Release Date: 2020-11-24
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22

33
# Run the system python.
44
#
5-
# This is primarily for use by the build toolchain so that it can continue
6-
# using the system Python rather than Sage's Python, preventing conflicts
7-
# that might otherwise occur, particularly in parallel builds.
5+
# This is only for use by the build toolchain.
86
#
9-
# See https://trac.sagemath.org/ticket/18438
7+
# (It has nothing to do with the python3 that configure --with-system-python3
8+
# is looking for in build/pkgs/python3/spkg-configure.m4.)
109

1110
if [ -z "$SAGE_ORIG_PATH" ]; then
1211
# If not we're running from within sage-env just set the existing path

build/bin/sage-build-num-threads

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
#!/usr/bin/env sage-system-python
2+
#
3+
# Determine the number of threads to be used by Sage.
4+
#
5+
# Outputs three space-separated numbers:
6+
# 1) The number of threads to use for Sage, based on MAKE, MAKEFLAGS
7+
# and SAGE_NUM_THREADS
8+
# 2) The number of threads to use when parallel execution is explicitly
9+
# asked for (e.g. sage -tp)
10+
# 3) The number of CPU cores in the system, as determined by
11+
# multiprocessing.cpu_count()
12+
#
13+
# AUTHOR: Jeroen Demeyer (2011-12-08): Trac ticket #12016
14+
#
15+
16+
from __future__ import print_function
17+
18+
import os
19+
import multiprocessing
20+
import re
21+
import math
22+
23+
24+
def number_of_cores():
25+
"""
26+
Try to determine the number of CPU cores in this system.
27+
If successful return that number. Otherwise return 1.
28+
"""
29+
# If the environment variable SAGE_NUM_CORES exists, use that value.
30+
# This is useful for testing purposes.
31+
try:
32+
n = int(os.environ["SAGE_NUM_CORES"])
33+
if n > 0:
34+
return n
35+
except (ValueError, KeyError):
36+
pass
37+
38+
try:
39+
n = multiprocessing.cpu_count()
40+
if n > 0:
41+
return n
42+
except NotImplementedError:
43+
pass
44+
45+
try: # Solaris fix
46+
from subprocess import Popen, PIPE
47+
p = Popen(['sysctl', '-n', 'hw.ncpu'],
48+
stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
49+
n = int(p.stdout.read().strip())
50+
if n > 0:
51+
return n
52+
except (ValueError, OSError):
53+
pass
54+
55+
return 1
56+
57+
58+
def parse_jobs_from_MAKE(MAKE, unlimited=999999):
59+
"""
60+
Parse an environment variable like :envvar:`MAKE` for the number of
61+
jobs specified. This looks at arguments ``-j``, ``--jobs``, ``-l``,
62+
``--load-average``.
63+
64+
INPUT:
65+
66+
- ``MAKE`` -- The value of :envvar:`MAKE` or :envvar:`MAKEFLAGS`.
67+
68+
- ``unlimited`` -- The value to return when ``MAKE`` contains ``-j``
69+
without argument and no ``-l`` option. Normally this is interpreted
70+
as "unlimited".
71+
72+
OUTPUT:
73+
74+
The number of jobs specified by that variable. Raise ``KeyError``
75+
if no number of jobs is specified in ``MAKE``.
76+
"""
77+
# First, find value of -j
78+
# Since this is doing a greedy match on the left and non-greedy on the right,
79+
# we find the last -j or --jobs
80+
(j, num) = re.subn(r'^(.* )?(-j *|--jobs(=(?=[0-9])| +))([0-9]*)( .*?)?$', r'\4', MAKE, count=1)
81+
if num < 1:
82+
# No replacement done, i.e. no -j option found
83+
raise KeyError("No number of jobs specified")
84+
elif j == "":
85+
# j is empty: unlimited number of jobs! :-)
86+
j = unlimited
87+
else:
88+
j = int(j)
89+
if j <= 0:
90+
raise ValueError("Non-positive value specified for -j")
91+
92+
# Next, find the value of -l
93+
# If it is specified, use this as an upper bound on j
94+
(l, num) = re.subn(r'^(.* )?(-l *|--(load-average|max-load)(=(?=[0-9])| +))([0-9.]*)( .*?)?$', r'\5', MAKE, count=1)
95+
if num < 1:
96+
# No replacement done, i.e. no -l option found
97+
pass
98+
elif not l:
99+
# No load limit specified
100+
pass
101+
else:
102+
l = int(math.ceil(float(l)))
103+
# A load limit will never prevent starting at least one job
104+
if l <= 1:
105+
l = 1
106+
j = min(j, l)
107+
108+
return j
109+
110+
111+
def num_threads():
112+
"""
113+
Determine the number of threads from the environment variables
114+
(in decreasing priority) :envvar:`SAGE_NUM_THREADS`, :envvar:`MAKE`,
115+
:envvar:`MAKEFLAGS` and :envvar:`MFLAGS`.
116+
117+
If :envvar:`SAGE_NUM_THREADS` is 0 and neither :envvar:`MAKE` nor
118+
:envvar:`MAKEFLAGS` specifies a number of jobs, the use a default
119+
of ``min(8, number_of_cores)``.
120+
121+
OUTPUT:
122+
123+
a tuple (num_threads, num_threads_parallel, num_cores)
124+
"""
125+
num_cores = number_of_cores()
126+
127+
num_threads = None
128+
# Handle MFLAGS only for backwards compatibility
129+
try:
130+
num_threads = parse_jobs_from_MAKE(os.environ["MFLAGS"], unlimited=2)
131+
except (ValueError, KeyError):
132+
pass
133+
134+
try:
135+
# Prepend hyphen to MAKEFLAGS if it does not start with one
136+
MAKEFLAGS = os.environ["MAKEFLAGS"]
137+
if MAKEFLAGS[0] != '-':
138+
MAKEFLAGS = '-' + MAKEFLAGS
139+
# In MAKEFLAGS, "-j" does not mean unlimited. It probably
140+
# means an inherited number of jobs, let us use 2 for safety.
141+
num_threads = parse_jobs_from_MAKE(MAKEFLAGS, unlimited=2)
142+
except (ValueError, KeyError, IndexError):
143+
pass
144+
145+
try:
146+
num_threads = parse_jobs_from_MAKE(os.environ["MAKE"])
147+
except (ValueError, KeyError):
148+
pass
149+
150+
# Number of threads to use when parallel execution is explicitly
151+
# asked for
152+
num_threads_parallel = num_threads
153+
if num_threads_parallel is None:
154+
num_threads_parallel = max(min(8, num_cores), 2)
155+
156+
try:
157+
sage_num_threads = int(os.environ["SAGE_NUM_THREADS"])
158+
if sage_num_threads == 0:
159+
# If SAGE_NUM_THREADS is 0, use the default only
160+
# if none of the above variables specified anything.
161+
if num_threads is None:
162+
num_threads = min(8, num_cores)
163+
elif sage_num_threads > 0:
164+
# SAGE_NUM_THREADS overrides everything
165+
num_threads = sage_num_threads
166+
num_threads_parallel = sage_num_threads
167+
except (ValueError, KeyError):
168+
pass
169+
170+
# If we still don't know, use 1 thread
171+
if num_threads is None:
172+
num_threads = 1
173+
174+
# Finally, use SAGE_NUM_THREADS_PARALLEL if set. A user isn't
175+
# likely to set this, but it ensures that sage-env is idempotent
176+
# if called more than once.
177+
try:
178+
sage_num_threads = int(os.environ["SAGE_NUM_THREADS_PARALLEL"])
179+
if sage_num_threads > 0:
180+
num_threads_parallel = sage_num_threads
181+
except (ValueError, KeyError):
182+
pass
183+
184+
return (num_threads, num_threads_parallel, num_cores)
185+
186+
187+
print(*num_threads())

build/bin/sage-download-file

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env sage-system-python
1+
#!/usr/bin/env sage-bootstrap-python
22

33
# USAGE:
44
#

0 commit comments

Comments
 (0)