File: tox.ini

package info (click to toggle)
sagemath 9.5-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 144,264 kB
  • sloc: python: 1,113,444; cpp: 37,499; ansic: 4,606; sh: 4,105; makefile: 1,097; javascript: 326; lisp: 5
file content (705 lines) | stat: -rw-r--r-- 37,712 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
# SAGE_ROOT/tox.ini: Environments for testing the Sage distribution
#

# To run a specific environment:
#
#   $ tox -e docker-fedora-31-standard
#
# This will do a complete build of the Sage distribution in a Docker container, which will take a while.
#
# Specific 'make' targets can be given as additional arguments after "--".
# For example, to only run the configuration phase:
#
#   $ tox -e docker-debian-bullseye-standard -- config.status
#
# To build a single package (and its dependencies):
#
#   $ tox -e docker-manylinux-2_24-i686-standard -- ppl
#
# It can be useful to run several of the environments in parallel. For example:
#
#   $ tox -p auto -- config.status
#
# with local squid:
#
#   $ EXTRA_DOCKER_BUILD_ARGS="--build-arg http_proxy=http://host.docker.internal:3128 --build-arg https_proxy=http://host.docker.internal:3128" tox -p auto -- config.status
[tox]

envlist =

    #####
    ##### Sage-the-distribution tests
    #####

    check_configure,

    #####
    ##### Sage-the-distribution portability tests
    #####

    # See https://doc.sagemath.org/html/en/developer/portability_testing.html

    ### "docker" environments copy sources from the source tree subject to the exclusions in
    ### the file ".dockerignore".  This should work out of non-clean source trees, and all
    ### "docker" toxenvs can be run in parallel.

    ### Package factors:
    ###
    ### - minimal   # Install a minimal set of system packages that supports bootstrapping and compiling Sage.
    ### - standard  # Install all known system packages equivalent to standard packages that have spkg-configure.m4
    ### - maximal   # Install all known system packages equivalent to standard/optional packages that have spkg-configure.m4

    docker-ubuntu-trusty-minimal,
    docker-debian-bullseye-standard,
    docker-fedora-34-standard,
    docker-archlinux-latest-maximal,
    docker-manylinux-2_24-i686-standard,
    docker-conda-forge-standard,

    ### "local" targets should be run from a source tree that is freshly checked out
    ### (for example, by 'git worktree add ...') or has been cleaned by 'make bdist-clean' --
    ### because they build within the source tree (because we have no VPATH support).
    ### Only one "local" target can be run at a time.
    ### However, "local" targets install in a separate prefix (SAGE_LOCAL=.tox/TOXENV/local)
    ### rather than "local/" and also place log files into .tox/TOXENV/log, where TOXENV
    ### is the name of the environment.  (The prefix can be configured by passing the
    ### environment variable PREFIX.)
    #
    # The "local-homebrew" toxenvs create an "isolated" homebrew installation (not in /usr/local).
    # (However, many configure scripts still look for stuff in /usr/local.)
    #
    # By default, it runs "make build" (after bootstrapping and configuring)
    # with SAGE_CHECK=yes and SAGE_CHECK_PACKAGES set to a good default,
    # and V=0 so that screen output is limited.
    #
    #   $ tox -e local-homebrew-macos-standard
    #
    # The value of MAKE is picked up from the environment, so you can do:
    #
    #   $ MAKE="make -j8" tox -e local-homebrew-macos-standard
    #
    # Build targets can be passed as positional arguments (separated from tox options by "--"):
    #
    #   $ tox -e local-homebrew-macos-standard -- ppl
    #   $ tox -e local-homebrew-macos-standard -- build ptest
    #
    # Also make variables can be passed as positional arguments; for example, to run the
    # test suite:
    #
    #   $ tox -e local-homebrew-macos-standard -- SAGE_CHECK=no build ptest SAGE_NUM_THREADS=4
    #
    # Or to rebuild a package with verbose output:
    #
    #   $ tox -e local-homebrew-macos-standard -- ppl-clean ppl V=1
    #
    # The variant "local-homebrew-macos-usrlocal" uses the global installation in /usr/local
    # instead.  It may install packages or update packages.  It will not remove packages.
    # Use at your own risk.
    #

    ###
    ### The "local-direct" toxenv passes the whole environment on to the sage build.
    ### Whatever is in PATH etc. will be used.
    ###
    #
    #   $ tox -e local-direct -- openblas


    #####
    ##### Delegation to src/tox.ini
    #####

    # included with (cd src && tox -p auto):
    #
    # doctest,
    # coverage,
    # startuptime,
    # pycodestyle-minimal,
    # relint,
    # codespell,
    #
    # Also available:
    #
    # pycodestyle


skipsdist = true

[testenv]
passenv =
                  EXTRA_CONFIGURE_ARGS
                  TARGETS_PRE
                  TARGETS_OPTIONAL
    docker:       EXTRA_DOCKER_BUILD_ARGS
                  # Use DOCKER_BUILDKIT=1 for new version - for which unfortunately we cannot save failed builds as an image
    docker:       DOCKER_BUILDKIT
                  # Set for example to "with-system-packages configured with-targets-pre with-targets"
                  # to tag intermediate images.
    docker:       DOCKER_TARGETS
                  # If set, we use this prefix and push to it
    docker:       DOCKER_PUSH_REPOSITORY
                  # If set, we symlink this file into {envdir}/.docker/; this can be used for providing credentials for pushing
    docker:       DOCKER_CONFIG_FILE
    local:        MAKE
    local:        PREFIX
    local:        SAGE_NUM_THREADS
                  # Set to 1 to skip preliminary install phases before make is invoked
    local:        SKIP_SYSTEM_PKG_INSTALL
    local:        SKIP_BOOTSTRAP
    local:        SKIP_CONFIGURE
    local:        OPENBLAS_CONFIGURE
    local-direct: *

setenv =
    # By default, we bootstrap using autotools and do not allow downloads of the configure tarball.
    BOOTSTRAP=./bootstrap
    # For https downloads from upstream_url listed in checksums.ini, do not
    # check certificates, to avoid problems on Docker images with outdated
    # certificates and with system python3 on macOS (#29418)
    SAGE_DOWNLOAD_FILE_OPTIONS=--no-check-certificate
    # Set this to 'force' instead of 'yes' to make it an error if an spkg with spkg-configure and system package
    # is not recognized.
    WITH_SYSTEM_SPKG=yes
    # Set this to 'yes' instead of 'no' to ignore missing system packages - by installing them one by one
    # and ignoring errors.  We use that to take care of old versions of distributions.
    # For -maximal environments, the default is 'yes' but later we override it for rolling distributions
    # (but not for unstable distributions that often have intermittent issues).
                                               IGNORE_MISSING_SYSTEM_PACKAGES=no
    maximal:                                   IGNORE_MISSING_SYSTEM_PACKAGES=yes
    # What system packages should be installed. Default: All standard packages with spkg-configure.
                           SAGE_PACKAGE_LIST_ARGS=--has-file=spkg-configure.m4 :standard:
    minimal:               SAGE_PACKAGE_LIST_ARGS=_prereq
    maximal:               SAGE_PACKAGE_LIST_ARGS=:standard: :optional:
    conda-environment:     SAGE_PACKAGE_LIST_ARGS=_prereq
    # Whether to add the system packages needed for bootstrapping
                           EXTRA_SAGE_PACKAGES_0=_bootstrap
    nobootstrap:           EXTRA_SAGE_PACKAGES_0=
    # local envs need HOME set, also Docker 19.03 needs HOME
    {local,docker}: HOME={envdir}
    # for local envs we can guess the package system if it is not provided as a factor
    local:          SYSTEM=$(build/bin/sage-guess-package-system)
    #
    # default tag is "latest"
    #
    docker:           BASE_TAG=latest
    #
    # https://hub.docker.com/_/ubuntu?tab=description
    # as of 2021-11, latest=focal=20.04, rolling=impish=21.10, devel=jammy=22.04
    #
    ubuntu:         SYSTEM=debian
    ubuntu:         BASE_IMAGE=ubuntu
    ubuntu-trusty:    BASE_TAG=trusty
    ubuntu-trusty:                             IGNORE_MISSING_SYSTEM_PACKAGES=yes
    ubuntu-xenial:    BASE_TAG=xenial
    ubuntu-xenial:                             IGNORE_MISSING_SYSTEM_PACKAGES=yes
    ubuntu-bionic:    BASE_TAG=bionic
    ubuntu-bionic:                             IGNORE_MISSING_SYSTEM_PACKAGES=yes
    ubuntu-focal:     BASE_TAG=focal
    ubuntu-hirsute:   BASE_TAG=hirsute
    ubuntu-hirsute:                            IGNORE_MISSING_SYSTEM_PACKAGES=no
    ubuntu-impish:    BASE_TAG=impish
    ubuntu-impish:                             IGNORE_MISSING_SYSTEM_PACKAGES=yes
    ubuntu-jammy:     BASE_TAG=jammy
    ubuntu-jammy:                              IGNORE_MISSING_SYSTEM_PACKAGES=yes
    #
    # https://hub.docker.com/_/debian
    # debian-bullseye does not have libgiac-dev
    #
    debian:         SYSTEM=debian
    debian:         BASE_IMAGE=debian
    debian-jessie:    BASE_TAG=jessie
    debian-jessie:                             IGNORE_MISSING_SYSTEM_PACKAGES=yes
    debian-stretch:   BASE_TAG=stretch
    debian-stretch:                            IGNORE_MISSING_SYSTEM_PACKAGES=yes
    debian-buster:    BASE_TAG=buster
    debian-bullseye:  BASE_TAG=bullseye
    debian-bullseye:                           IGNORE_MISSING_SYSTEM_PACKAGES=yes
    debian-bookworm:  BASE_TAG=bookworm
    debian-bookworm:                           IGNORE_MISSING_SYSTEM_PACKAGES=yes
    debian-sid:       BASE_TAG=sid
    #
    # https://hub.docker.com/u/linuxmintd
    #
    linuxmint:      SYSTEM=debian
    linuxmint:                                 IGNORE_MISSING_SYSTEM_PACKAGES=yes
    linuxmint-17:   BASE_IMAGE=linuxmintd/mint17
    linuxmint-18:   BASE_IMAGE=linuxmintd/mint18
    linuxmint-19:   BASE_IMAGE=linuxmintd/mint19
    linuxmint-19.1: BASE_IMAGE=linuxmintd/mint19.1
    linuxmint-19.2: BASE_IMAGE=linuxmintd/mint19.2
    linuxmint-19.3: BASE_IMAGE=linuxmintd/mint19.3
    linuxmint-20:   BASE_IMAGE=linuxmintd/mint20
    linuxmint-20.1: BASE_IMAGE=linuxmintd/mint20.1
    linuxmint-20.2: BASE_IMAGE=linuxmintd/mint20.2
    linuxmint-20.3: BASE_IMAGE=linuxmintd/mint20.3
    #
    # https://hub.docker.com/_/fedora
    # as of 2021-11, latest=35, rawhide=36
    fedora:         SYSTEM=fedora
    fedora:         BASE_IMAGE=fedora
    fedora-26:        BASE_TAG=26
    fedora-26:                                 IGNORE_MISSING_SYSTEM_PACKAGES=yes
    fedora-27:        BASE_TAG=27
    fedora-27:                                 IGNORE_MISSING_SYSTEM_PACKAGES=yes
    fedora-28:        BASE_TAG=28
    fedora-28:                                 IGNORE_MISSING_SYSTEM_PACKAGES=yes
    fedora-29:        BASE_TAG=29
    fedora-29:                                 IGNORE_MISSING_SYSTEM_PACKAGES=yes
    fedora-30:        BASE_TAG=30
    fedora-30:                                 IGNORE_MISSING_SYSTEM_PACKAGES=yes
    fedora-31:        BASE_TAG=31
    fedora-32:        BASE_TAG=32
    fedora-33:        BASE_TAG=33
    fedora-33:                                 IGNORE_MISSING_SYSTEM_PACKAGES=no
    fedora-34:        BASE_TAG=34
    fedora-34:                                 IGNORE_MISSING_SYSTEM_PACKAGES=no
    fedora-35:        BASE_TAG=35
    fedora-35:                                 IGNORE_MISSING_SYSTEM_PACKAGES=yes
    fedora-36:        BASE_TAG=36
    fedora-36:                                 IGNORE_MISSING_SYSTEM_PACKAGES=yes
    #
    # https://hub.docker.com/r/scientificlinux/sl
    #
    scientificlinux:        SYSTEM=fedora
    scientificlinux:        BASE_IMAGE=scientificlinux/sl
    scientificlinux:                           IGNORE_MISSING_SYSTEM_PACKAGES=yes
    scientificlinux-6:        BASE_TAG=6
    scientificlinux-7:        BASE_TAG=7
    #
    # https://hub.docker.com/_/centos
    # centos-6 only has autoconf 2.63 -- too old for bootstrap; download configure tarball instead.
    #
    centos:         SYSTEM=fedora
    centos:         BASE_IMAGE=centos
    centos:                                    IGNORE_MISSING_SYSTEM_PACKAGES=yes
    centos-6:         BASE_TAG=centos6
    centos-6:           BOOTSTRAP=./bootstrap -D
    centos-7:         BASE_TAG=centos7
    centos-8:         BASE_TAG=centos8
    #
    # https://hub.docker.com/r/sheerluck/sage-on-gentoo-stage4/tags
    #
    gentoo:      SYSTEM=gentoo
    gentoo:      BASE_IMAGE=sheerluck/sage-on-gentoo-stage4
    gentoo-python3.7: BASE_TAG=latest-py37
    gentoo-python3.9: BASE_TAG=latest-py39
    gentoo-python3.10: BASE_TAG=latest-py10
    gentoo:                                    IGNORE_MISSING_SYSTEM_PACKAGES=no
    #
    # https://hub.docker.com/_/archlinux/
    #
    archlinux:      SYSTEM=arch
    archlinux:      BASE_IMAGE=archlinux
    archlinux:                                 IGNORE_MISSING_SYSTEM_PACKAGES=no
    #
    # https://hub.docker.com/r/vbatts/slackware
    #
    slackware:      SYSTEM=slackware
    slackware:      BASE_IMAGE=vbatts/slackware
    slackware-14.2:  BASE_TAG=14.2
    slackware:                                 IGNORE_MISSING_SYSTEM_PACKAGES=no
    #
    # https://hub.docker.com/r/voidlinux/
    #
    voidlinux:      SYSTEM=void
    voidlinux:      BASE_IMAGE=voidlinux/masterdir-x86_64-musl
    voidlinux:        BASE_TAG=20200104
    voidlinux:                                 IGNORE_MISSING_SYSTEM_PACKAGES=no
    #
    # https://hub.docker.com/r/continuumio
    #
    conda:            SYSTEM=conda
    conda:                                                      USE_CONDARC=/dev/null
    conda-forge:        BASE_IMAGE=continuumio/miniconda3
    conda-forge:                                                USE_CONDARC=condarc.yml
    conda-forge:                               IGNORE_MISSING_SYSTEM_PACKAGES=no
    conda-anaconda3:    BASE_IMAGE=continuumio/anaconda3
    conda-anaconda3:                           IGNORE_MISSING_SYSTEM_PACKAGES=yes
    #
    # https://hub.docker.com/r/nixos/nix/
    #
    nixos:            SYSTEM=nix
    nixos:            BASE_IMAGE=nixos/nix
    #
    # https://hub.docker.com/r/opensuse/leap
    # - OpenSUSE Leap 42 was superseded by the Leap 15 series.
    # - OpenSUSE Leap 15.2 released July 2, 2020.
    # - As of 2021-05-06, latest = 15 = 15.2
    # - OpenSUSE Leap 15.3 planned to be released July 7, 2021
    # https://hub.docker.com/r/opensuse/tumbleweed
    # - Rolling distribution
    #
    opensuse:         SYSTEM=opensuse
    opensuse:            BASE_IMAGE=opensuse/leap
    opensuse:                                  IGNORE_MISSING_SYSTEM_PACKAGES=yes
    opensuse-42:           BASE_TAG=42
    opensuse-15.0:         BASE_TAG=15.0
    opensuse-15.1:         BASE_TAG=15.1
    opensuse-15.2:         BASE_TAG=15.2
    opensuse-15.3:         BASE_TAG=15.3
    opensuse-15:           BASE_TAG=15
    opensuse-tumbleweed: BASE_IMAGE=opensuse/tumbleweed
    opensuse-tumbleweed:                       IGNORE_MISSING_SYSTEM_PACKAGES=no
    #
    # Other architectures:
    #
    # Many docker images for another architecture are named the same, in the arch prefix.
    # All work for Docker on Mac; but only i386 works for Linux Docker.
    #
    # According to https://github.com/docker-library/official-images#architectures-other-than-amd64
    # architectures officially supported by Docker, Inc. for running Docker:
    # - amd64,arm32v6,arm32v7,arm64v8,
    # - windows-amd64                      #  https://hub.docker.com/u/winamd64/
    # Other architectures built by official images:
    # (but not officially supported by Docker, Inc.)
    # - arm32v5,ppc64le,s390x,i386
    #
    arm32v5:          ARCH_IMAGE_PREFIX=arm32v5/
    arm32v6:          ARCH_IMAGE_PREFIX=arm32v6/
    arm32v7:          ARCH_IMAGE_PREFIX=arm32v7/
    arm64v8:          ARCH_IMAGE_PREFIX=arm64v8/
    i386:             ARCH_IMAGE_PREFIX=i386/
    ppc64le:          ARCH_IMAGE_PREFIX=ppc64le/
    s390x:            ARCH_IMAGE_PREFIX=s390x/
    #
    # For Linux Docker, we need to work with known multiarch images.
    # https://www.ecliptik.com/Cross-Building-and-Running-Multi-Arch-Docker-Images/
    # (or we would need to change our tests from "docker build" to "docker run")
    #
    # https://hub.docker.com/r/multiarch/ubuntu-core:
    # multiarch/ubuntu-core:arm64-bionic, multiarch/ubuntu-core:armhf-bionic
    ubuntu-arm64:     BASE_IMAGE=ubuntu-core
    ubuntu-arm64:     ARCH_IMAGE_PREFIX=multiarch/
    ubuntu-arm64:       ARCH_TAG_PREFIX=arm64-
    ubuntu-armhf:     BASE_IMAGE=ubuntu-core
    ubuntu-armhf:     ARCH_IMAGE_PREFIX=multiarch/
    ubuntu-armhf:       ARCH_TAG_PREFIX=armhf-
    #
    # https://hub.docker.com/u/raspbian
    #
    raspbian:         SYSTEM=debian
    raspbian:         ARCH_IMAGE_PREFIX=
    raspbian:                                  IGNORE_MISSING_SYSTEM_PACKAGES=yes
    raspbian-jessie:  BASE_IMAGE=raspbian/jessie
    raspbian-stretch: BASE_IMAGE=raspbian/stretch
    # As of 2020-06, there is no raspbian/buster image, so we dist-upgrade from stretch.
    # https://www.raspberrypi.org/blog/buster-the-new-version-of-raspbian/
    raspbian-buster:  BASE_IMAGE=raspbian/stretch
    raspbian-buster:      DIST_UPGRADE=s/stretch/buster/g
    #
    # https://hub.docker.com/u/linuxmintd
    #
    linuxmint:        ARCH_IMAGE_PREFIX=
    linuxmint:        ARCH_IMAGE_SUFFIX=-amd64
    linuxmint-i386:   ARCH_IMAGE_SUFFIX=-i386
    #
    # manylinux.
    # https://github.com/pypa/manylinux
    #
    # There are manylinux-1, manylinux-2010, manylinux-2014, and manylinux_2_24.
    # manylinux-1 is too old - it only has python2.4, which is not supported by
    # sage_bootstrap; it will reach its EOL on Jan 1, 2022.
    # Our default is manylinux-2014.
    #
    # Default arch is x86_64.  Use -i686 (or our alias -i386) for 32-bit build.
    # manylinux-2014 and newer support more archs.
    #
    manylinux:        SYSTEM=fedora
    manylinux:        IGNORE_MISSING_SYSTEM_PACKAGES=yes
    manylinux:          BASE_IMAGE=quay.io/pypa/manylinux2014
    manylinux-1:        BASE_IMAGE=quay.io/pypa/manylinux1
    manylinux-1:              BOOTSTRAP=./bootstrap -D
    manylinux-2010:     BASE_IMAGE=quay.io/pypa/manylinux2010
    manylinux-2014:     BASE_IMAGE=quay.io/pypa/manylinux2014
    manylinux-2_24:   SYSTEM=debian
    manylinux-2_24:     BASE_IMAGE=quay.io/pypa/manylinux_2_24
    manylinux-2_24:           BOOTSTRAP=ACLOCAL_PATH=/usr/share/aclocal ./bootstrap
    manylinux:            ARCH_IMAGE_PREFIX=
    manylinux:              ARCH_IMAGE_SUFFIX=_x86_64
    manylinux-i686:         ARCH_IMAGE_SUFFIX=_i686
    manylinux-i386:         ARCH_IMAGE_SUFFIX=_i686
    manylinux-aarch64:      ARCH_IMAGE_SUFFIX=_aarch64
    manylinux-ppc64le:      ARCH_IMAGE_SUFFIX=_ppc64le
    manylinux-s390x:        ARCH_IMAGE_SUFFIX=_s390x
    #
    # https://hub.docker.com/r/nvidia/cuda
    #
    ubuntu-nvidia-cuda:         BASE_IMAGE=nvidia/cuda
    centos-nvidia-cuda:         BASE_IMAGE=nvidia/cuda
    nvidia-cuda:                  ARCH_TAG_PREFIX=11.0-devel-
    nvidia-cuda-11.0:             ARCH_TAG_PREFIX=11.0-devel-
    ubuntu-focal-nvidia-cuda:       BASE_TAG=ubuntu20.04
    ubuntu-bionic-nvidia-cuda:      BASE_TAG=ubuntu18.04
    ubuntu-xenial-nvidia-cuda:      BASE_TAG=ubuntu16.04
    #
    # Resulting full image:tag name
    #
    docker:           FULL_BASE_IMAGE_AND_TAG={env:ARCH_IMAGE_PREFIX:}{env:BASE_IMAGE}{env:ARCH_IMAGE_SUFFIX:}:{env:ARCH_TAG_PREFIX:}{env:BASE_TAG}{env:ARCH_TAG_SUFFIX:}
    #
    docker-nobootstrap: BOOTSTRAP=./bootstrap -D
    ###
    ### "local" envs
    ###
    homebrew:         SYSTEM=homebrew
    local:            SHARED_CACHE_DIR={toxworkdir}/Caches
    local:            SETENV=:
    local:            SETENV_CONFIGURE=:
    local-nobootstrap: BOOTSTRAP=:
    local-!direct:    PATH=/usr/bin:/bin:/usr/sbin:/sbin
    local-sudo:       __SUDO=--sudo
    local-root:       CONFIG_CONFIGURE_ARGS_ROOT=--enable-build-as-root
    # brew caches downloaded files in ${HOME}/Library/Caches. We share it between different toxenvs.
    local-homebrew:                        HOMEBREW={envdir}/homebrew
    local-{homebrew-usrlocal,nohomebrew}:  HOMEBREW=/usr/local
    # local-macos-nohomebrew: "best effort" isolation to avoid using a homebrew installation in /usr/local
    # We use liblzma from the macOS system - which is available but its headers are not (neither is the xz executable).
    # So we use /usr/local/opt/xz/{bin,include} (but not lib!).
    # This ensures that /usr/bin/python3 is accepted by configure - this is needed until #30948 is done.
    local-macos-nohomebrew: PATH={env:HOMEBREW}/opt/xz/bin:{env:HOMEBREW}/opt/gpatch/bin:/usr/bin:/bin:/usr/sbin:/sbin
    local-macos-nohomebrew: CPATH={env:HOMEBREW}/opt/xz/include
    local-homebrew:   PATH={env:HOMEBREW}/bin:/usr/bin:/bin:/usr/sbin:/sbin
    local-{homebrew-nokegonly,nohomebrew}: BOOTSTRAP=ACLOCAL_PATH="$HOMEBREW/opt/gettext/share/aclocal:$ACLOCAL_PATH" PATH="$HOMEBREW/opt/gettext/bin/:$HOMEBREW/bin:$PATH" ./bootstrap
    local-homebrew-!nokegonly:   SETENV=. .homebrew-build-env
    local-homebrew:                            IGNORE_MISSING_SYSTEM_PACKAGES=no
    # conda
    local-conda:      CONDA_PREFIX={envdir}/conda
    local-conda:      PATH={env:CONDA_PREFIX}/bin:/usr/bin:/bin:/usr/sbin:/sbin
    local-conda:      CONDA_PKGS_DIRS={env:SHARED_CACHE_DIR}/conda_pkgs
    local-conda:      CONDA_OS=$(uname | sed 's/^Darwin/MacOSX/;')
    local-conda-forge:     CONDA_INSTALLER_URL_BASE=https://github.com/conda-forge/miniforge/releases/latest/download/
    local-conda-forge:         CONDA_INSTALLER_FILE=Miniforge3-{env:CONDA_OS}-x86_64.sh
    local-conda-miniconda: CONDA_INSTALLER_URL_BASE=https://repo.anaconda.com/miniconda/
    local-conda-miniconda:     CONDA_INSTALLER_FILE=Miniconda3-latest-{env:CONDA_OS}-x86_64.sh
    local-conda:                  SETENV=. {env:CONDA_PREFIX}/bin/activate base
    local-conda-environment:          CONDA_SAGE_ENVIRONMENT=sage-build
    local-conda-environment:            CONDA_SAGE_ENVIRONMENT_FILE=environment.yml
    local-conda-environment-optional:   CONDA_SAGE_ENVIRONMENT_FILE=environment-optional.yml
    local-conda-environment-src:        CONDA_SAGE_ENVIRONMENT_DIR=src/
    local-conda-environment:      SETENV_CONFIGURE=( {env:CONDA_PREFIX}/bin/conda env create -n {env:CONDA_SAGE_ENVIRONMENT} --file {env:CONDA_SAGE_ENVIRONMENT_DIR:}{env:CONDA_SAGE_ENVIRONMENT_FILE} || {env:CONDA_PREFIX}/bin/conda env update -n {env:CONDA_SAGE_ENVIRONMENT} --file {env:CONDA_SAGE_ENVIRONMENT_DIR:}{env:CONDA_SAGE_ENVIRONMENT_FILE} ) && . {env:CONDA_PREFIX}/bin/activate {env:CONDA_SAGE_ENVIRONMENT}
    #
    # Configuration factors
    #
    #  - python
    #
    # Setting "--with-system-python3=yes" explicitly in case we change the configure default
    # to "--with-system-python3=force" as originally proposed in #32060
                              CONFIG_CONFIGURE_ARGS_1=--with-system-python3=yes
    python3_spkg:             CONFIG_CONFIGURE_ARGS_1=--without-system-python3
    macos-python3_xcode:      CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/usr/bin/python3
    macos-{python3_xcode,nohomebrew}-python3.7: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/bin/python3
    macos-{python3_xcode,nohomebrew}-python3.8: CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/bin/python3
    # Must manually download and install from https://www.python.org/ftp/python/3.7.7/python-3.7.7-macosx10.9.pkg
    macos-python3_pythonorg:  CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
    # Homebrew keg installs
    homebrew-python3.7:       CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python={env:HOMEBREW}/opt/python@3.7/bin/python3
    homebrew-python3.8:       CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python={env:HOMEBREW}/opt/python@3.8/bin/python3
    homebrew-python3.9:       CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python={env:HOMEBREW}/opt/python@3.9/bin/python3
    # https://github.com/pypa/manylinux
    manylinux-standard:       CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp38-cp38/bin/python3
    manylinux-python3.7:      CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp37-cp37m/bin/python3
    manylinux-python3.8:      CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp38-cp38/bin/python3
    manylinux-python3.9:      CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=/opt/python/cp39-cp39/bin/python3
    conda:                    CONFIG_CONFIGURE_ARGS_1=--with-system-python3=force --with-python=python3
    #
    #  - toolchain
    #
    gcc_spkg:                 CONFIG_CONFIGURE_ARGS_2=--without-system-gcc
    gcc_9:                    CONFIG_CONFIGURE_ARGS_2=--with-system-gcc=force CC=gcc-9 CXX=g++-9 FC=gfortran-9
    gcc_10:                   CONFIG_CONFIGURE_ARGS_2=--with-system-gcc=force CC=gcc-10 CXX=g++-10 FC=gfortran-10
    gcc_11:                   CONFIG_CONFIGURE_ARGS_2=--with-system-gcc=force CC=gcc-11 CXX=g++-11 FC=gfortran-11
    llvm:                     CONFIG_CONFIGURE_ARGS_2=--with-system-gcc=force CC=clang CXX=clang++
    llvm:                       EXTRA_SAGE_PACKAGES_2=llvm
    # LLVM is keg-only
    homebrew-llvm:            CONFIG_CONFIGURE_ARGS_2=--with-system-gcc=force CC={env:HOMEBREW}/opt/llvm/bin/clang CXX={env:HOMEBREW}/opt/llvm/bin/clang++
    macos-nohomebrew:         CONFIG_CONFIGURE_ARGS_2=--with-system-gcc=force CC="$CONFIGURED_CC" CXX="$CONFIGURED_CXX" --with-mp=gmp --without-system-mpfr --without-system-readline --without-system-boost --without-system-boost_cropped
    macos-nohomebrew:           CONFIGURED_CXX=g++ -isysroot {env:MACOS_SDK}
    macos-nohomebrew:           CONFIGURED_CC=gcc -isysroot {env:MACOS_SDK}
    # Prevent /usr/local to leak in:
    # - We use libgd only used in a very limited way, in {matrix,vector}_mod_2_dense.  Disable search for other packages.
    macos-nohomebrew:             LIBGD_CONFIGURE=--without-freetype --without-raqm --without-fontconfig --without-jpeg --without-liq --without-xpm --without-tiff --without-webp --without-heif --without-avif
    macos-nohomebrew:             FREETYPE_CONFIGURE=--without-harfbuzz
    macos-nohomebrew:             PILLOW_BUILD_EXT=--disable-platform-guessing --disable-jpeg2000 --disable-imagequant --disable-tiff --disable-lcms --disable-webp --disable-webpmux --disable-xcb
    macos-nohomebrew:             ZLIB_ROOT={env:MACOS_SDK}/usr
    macos:                        MACOS_SDK=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
    # python3 from XCode 12 has MACOSX_DEPLOYMENT_TARGET=10.14.6.  Selecting a lower target would cause /usr/bin/python3 to be rejected by configure.
    macos-10.14:                  MACOS_SDK=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
    macos-10.14:                    MACOSX_DEPLOYMENT_TARGET=10.14.6
    macos-10.15:                  MACOS_SDK=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
    macos-10.15:                    MACOSX_DEPLOYMENT_TARGET=10.15
    macos-11.1:                   MACOS_SDK=/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk
    macos-11.1:                     MACOSX_DEPLOYMENT_TARGET=11.1
    #
    # Resulting full configuration args, including EXTRA_CONFIGURE_ARGS from the user environment
    #
                      CONFIGURE_ARGS=--enable-experimental-packages --enable-download-from-upstream-url {env:CONFIG_CONFIGURE_ARGS_ROOT:} {env:CONFIG_CONFIGURE_ARGS_1:} {env:CONFIG_CONFIGURE_ARGS_2:} {env:EXTRA_CONFIGURE_ARGS:}
    #
    # Resulting EXTRA_SAGE_PACKAGES
    #
                      EXTRA_SAGE_PACKAGES={env:EXTRA_SAGE_PACKAGES_0:} {env:EXTRA_SAGE_PACKAGES_1:} {env:EXTRA_SAGE_PACKAGES_2:}

# environment will be skipped if regular expression does not match against the sys.platform string
platform =
    local-macos:   darwin

whitelist_externals =
                   bash
    docker:        docker
    homebrew:      brew

#commands_pre =
commands =

    #
    # All "local" environments
    #
    local:         bash -c 'if [ ! -d {env:HOME}/Library/Caches ]; then mkdir -p {env:SHARED_CACHE_DIR} && mkdir -p {env:HOME}/Library && ln -sf {toxworkdir}/Caches {env:HOME}/Library/; fi'
    #
    # local-homebrew
    #
    # https://docs.brew.sh/Installation
    homebrew:      bash -c 'if [ ! -x {env:HOMEBREW}/bin/brew ]; then mkdir -p {env:HOMEBREW} && cd {env:HOMEBREW} && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 ; fi'
    homebrew:      bash -c 'case "{env:SKIP_SYSTEM_PKG_INSTALL:}" in 1|y*|Y*);; *) PACKAGES=$(build/bin/sage-get-system-packages homebrew $(PATH=build/bin:$PATH build/bin/sage-package list {env:SAGE_PACKAGE_LIST_ARGS}) {env:EXTRA_SAGE_PACKAGES}); {env:HOMEBREW}/bin/brew install $PACKAGES; {env:HOMEBREW}/bin/brew upgrade $PACKAGES;; esac'
    #
    # local-conda
    #
    # https://docs.anaconda.com/anaconda/install/silent-mode/
    # https://docs.anaconda.com/anaconda/user-guide/tasks/shared-pkg-cache/
    # https://www.anaconda.com/conda-configuration-engine-power-users/
    local-conda:   bash -c 'mkdir -p {env:SHARED_CACHE_DIR}/conda_pkgs {env:CONDA_PREFIX}'
    local-conda:   bash -c 'echo >  {env:CONDA_PREFIX}/.condarc "pkgs_dirs:"'
    local-conda:   bash -c 'echo >> {env:CONDA_PREFIX}/.condarc "  - {env:SHARED_CACHE_DIR}/conda_pkgs"'
    local-conda:   bash -c 'cat {env:USE_CONDARC} >> {env:CONDA_PREFIX}/.condarc'
    local-conda:   bash -c 'if [ ! -x {env:CONDA_PREFIX}/bin/conda ]; then mkdir {env:CONDA_PREFIX}/conda-meta && curl -L {env:CONDA_INSTALLER_URL_BASE}{env:CONDA_INSTALLER_FILE} -C - -o {env:SHARED_CACHE_DIR}/{env:CONDA_INSTALLER_FILE} && bash {env:SHARED_CACHE_DIR}/{env:CONDA_INSTALLER_FILE} -b -f -p {env:CONDA_PREFIX}; fi'
    local-conda:   bash -c 'case "{env:SKIP_SYSTEM_PKG_INSTALL:}" in 1|y*|Y*);; *) {env:SETENV} && {env:CONDA_PREFIX}/bin/conda update -n base --yes conda;; esac'
    local-conda:   bash -c 'PACKAGES=$(build/bin/sage-get-system-packages conda $(PATH=build/bin:$PATH build/bin/sage-package list {env:SAGE_PACKAGE_LIST_ARGS}) {env:EXTRA_SAGE_PACKAGES}); {env:SETENV} && {env:CONDA_PREFIX}/bin/conda install --yes --quiet $PACKAGES'
    #
    # local-cygwin-choco: Use choco to install cygwin packages
    #
    local-cygwin-choco:   bash -c 'PACKAGES=$(build/bin/sage-get-system-packages {env:SYSTEM} $(PATH=build/bin:$PATH build/bin/sage-package list {env:SAGE_PACKAGE_LIST_ARGS}) _bootstrap); /cygdrive/c/ProgramData/Chocolatey/bin/choco install $PACKAGES --source cygwin'
    #
    # local-root:  Assume we are root, run the system package commands
    # local-sudo:  Use sudo to run the system package commands as root
    #
    local-{root,sudo}:    bash -c 'case "{env:SKIP_SYSTEM_PKG_INSTALL:}" in 1|y*|Y*);; *) eval $(build/bin/sage-print-system-package-command {env:SYSTEM} {env:__SUDO:} update) ;; esac'
    local-{root,sudo}:    bash -c 'case "{env:SKIP_SYSTEM_PKG_INSTALL:}" in 1|y*|Y*);; *) PACKAGES=$(build/bin/sage-get-system-packages {env:SYSTEM} $(PATH=build/bin:$PATH build/bin/sage-package list {env:SAGE_PACKAGE_LIST_ARGS}) {env:EXTRA_SAGE_PACKAGES}); eval $(build/bin/sage-print-system-package-command {env:SYSTEM} {env:__SUDO:} --yes --no-install-recommends install $PACKAGES) || [ "$IGNORE_MISSING_SYSTEM_PACKAGES" = yes ] && echo "(ignoring errors)" ;; esac'
    #
    # All "local" environments
    #
    # Install symbolic links "config.log" and "logs" in SAGE_ROOT so that log files are written into the tox log directory.
    local:         bash -c 'touch {envlogdir}/config.log; ln -sf {envlogdir}/config.log .; if [ ! -d logs -o -L logs ]; then rm -f logs; ln -sf {envlogdir} logs; fi'
    # Install a symbolic link "prefix" in SAGE_ROOT for convenient inspection; it is not used in the build.
    local:         bash -c 'if [ ! -d prefix -o -L prefix ]; then rm -f prefix; ln -sf {env:PREFIX:{envdir}/local} prefix; fi'

##commands =
    docker:        bash -c 'build/bin/write-dockerfile.sh {env:SYSTEM} "{env:SAGE_PACKAGE_LIST_ARGS:}" {env:WITH_SYSTEM_SPKG} {env:IGNORE_MISSING_SYSTEM_PACKAGES} "{env:EXTRA_SAGE_PACKAGES}" > {envdir}/Dockerfile'
    # From https://hub.docker.com/r/multiarch/ubuntu-core/
    # configure binfmt-support on the Docker host (works locally or remotely, i.e: using boot2docker)
    docker-{arm64,armhf}:  docker run --rm --privileged multiarch/qemu-user-static:register --reset
    docker:        bash -c 'if [ x"{env:DOCKER_CONFIG_FILE:}" != x ]; then mkdir -p {envdir}/.docker && ln -sf $(realpath "{env:DOCKER_CONFIG_FILE:}") {envdir}/.docker/; fi'
    docker:        bash -c 'for docker_target in {env:DOCKER_TARGETS:with-targets}; do \
    docker:            BUILD_TAG={env:DOCKER_PUSH_REPOSITORY:}sage-{envname}-$docker_target:$(git describe --dirty --always); \
    docker:            DOCKER_BUILDKIT={env:DOCKER_BUILDKIT:0} \
    docker:            docker build . -f {envdir}/Dockerfile \
    docker:              --target $docker_target \
    docker:              --tag $BUILD_TAG \
    docker:              --build-arg EXTRA_CONFIGURE_ARGS="{env:CONFIGURE_ARGS}" \
    docker:              --build-arg BASE_IMAGE={env:FULL_BASE_IMAGE_AND_TAG} \
    docker-conda:        --build-arg USE_CONDARC="{env:USE_CONDARC}" \
    docker:              --build-arg BOOTSTRAP="{env:BOOTSTRAP}" \
    docker:              --build-arg TARGETS_PRE="$(if test -n "$TARGETS_PRE"; then echo $TARGETS_PRE; else echo {posargs:all-sage-local}; fi)" \
    docker:              --build-arg TARGETS="{posargs:build}" \
    docker:              --build-arg TARGETS_OPTIONAL="{env:TARGETS_OPTIONAL:ptest}" \
    docker:              {env:EXTRA_DOCKER_BUILD_ARGS:}; status=$?; \
    docker:            if [ $status != 0 ]; then BUILD_TAG="$BUILD_TAG-failed"; docker commit $(docker ps -l -q) $BUILD_TAG; fi; \
    docker:            echo $BUILD_TAG >> {envdir}/Dockertags; \
    docker:            if [ x"{env:DOCKER_PUSH_REPOSITORY:}" != x ]; then echo Pushing $BUILD_TAG; docker push $BUILD_TAG || echo "(ignoring errors)"; fi; \
    docker:            if [ $status != 0 ]; then exit $status; fi; \
    docker:        done'
    # #28728: gap fails its test suite.
    # linbox/cysignals testsuites fail.  ppl takes very long.
    local:         bash -c 'export PATH={env:PATH} && {env:SETENV} && \
    local:             case "{env:SKIP_BOOTSTRAP:}" in 1|y*|Y*);; *) {env:BOOTSTRAP} ;; esac && \
    local:             {env:SETENV_CONFIGURE} && \
    local:             case "{env:SKIP_CONFIGURE:}" in 1|y*|Y*);; *) ./configure --prefix={env:PREFIX:{envdir}/local} {env:CONFIGURE_ARGS} ;; esac && \
    local:             case "{posargs:}" in \
    local:                 bash)    bash -i; exit ;; \
    local:                 config*) ;; \
    local:                 *)       make -k V=0 base-toolchain ;; \
    local:             esac && \
    local:             make -k V=0 SAGE_CHECK=warn SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst" {env:TARGETS_PRE:} {posargs:build} && \
    local:             ( [ -z "{env:TARGETS_OPTIONAL:}" ] || make -k V=0 SAGE_CHECK=warn SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst" {env:TARGETS_OPTIONAL:} || echo "(error ignored)" ) '

[testenv:check_configure]
## Test that configure behaves properly
whitelist_externals =
    bash
setenv =
    HOME = {envdir}
commands =
    ./bootstrap
    bash -c 'test -z "$(./configure --quiet 2>&1)" || (echo >&2 Error: "configure --quiet" is not quiet; exit 1)'

###### Delegation to src/tox.ini ######
[sage_src]
passenv =
    HOME
envdir   = {toxworkdir}/src
whitelist_externals = tox
commands = tox -c {toxinidir}/src/tox.ini -e {envname} -- {posargs}

[testenv:doctest]
description =
    run the Sage doctester (same as "sage -t")
passenv  = {[sage_src]passenv}
envdir   = {[sage_src]envdir}
commands = {[sage_src]commands}
whitelist_externals = {[sage_src]whitelist_externals}

[testenv:coverage]
description =
    give information about doctest coverage of files (same as "sage --coverage[all]")
passenv  = {[sage_src]passenv}
envdir   = {[sage_src]envdir}
commands = {[sage_src]commands}
whitelist_externals = {[sage_src]whitelist_externals}

[testenv:startuptime]
description =
    display how long each component of Sage takes to start up (same as "sage --startuptime")
passenv  = {[sage_src]passenv}
envdir   = {[sage_src]envdir}
commands = {[sage_src]commands}
whitelist_externals = {[sage_src]whitelist_externals}

[testenv:pycodestyle]
description =
    check against the Python style conventions of PEP8
passenv  = {[sage_src]passenv}
envdir   = {[sage_src]envdir}
commands = {[sage_src]commands}
whitelist_externals = {[sage_src]whitelist_externals}

[testenv:pycodestyle-minimal]
description =
    check against Sage's minimal style conventions
passenv  = {[sage_src]passenv}
envdir   = {[sage_src]envdir}
commands = {[sage_src]commands}
whitelist_externals = {[sage_src]whitelist_externals}

[testenv:relint]
description =
    check whether some forbidden patterns appear - similar to patchbot plugins
passenv  = {[sage_src]passenv}
envdir   = {[sage_src]envdir}
commands = {[sage_src]commands}
whitelist_externals = {[sage_src]whitelist_externals}

[testenv:codespell]
description =
    check for misspelled words in source code (use -w -i to fix)
passenv  = {[sage_src]passenv}
envdir   = {[sage_src]envdir}
whitelist_externals = {[sage_src]whitelist_externals}
# Run on the whole project, not just src/ by default, if invoked directly at top level
commands = tox -c {toxinidir}/src/tox.ini -e {envname} -- {posargs:{toxinidir}}