File: make-setup-config.py

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 (41 lines) | stat: -rw-r--r-- 1,600 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
from configparser import ConfigParser
import pkgconfig
import os

config = ConfigParser()

config.add_section('directories')
config.set('directories', 'basedirlist', os.environ['SAGE_LOCAL'])

config.add_section('libs')
config.set('libs', 'system_freetype', 'True')
config.set('libs', 'system_qhull', 'True')
# lto is problematic if we mix libraries from the OS with our own libraries,
# which are not necessarily compiled with the same gcc version
# https://trac.sagemath.org/ticket/27754
config.set('libs', 'enable_lto', 'False')

#####################################################################
# Sage code -- all this code just sets the graphical_backend variable.
# If True, that means we try to build GUI's; otherwise, we definitely
# will not even try, even if we could.  See trac #5301.
#####################################################################

print("NOTE: Set SAGE_MATPLOTLIB_GUI to anything but 'no' to try to build the Matplotlib GUI.")

graphical_backend='False'
if os.environ.get('SAGE_MATPLOTLIB_GUI', 'no').lower() != 'no':
    graphical_backend = 'auto'

if graphical_backend == 'auto':
    print("Building graphical backends.  WARNING: This may causing some annoying and confusing behavior")
    print("when using Sage + pylab, at least on OS X.")
else:
    print("Not building any matplotlib graphical backends.")

config.add_section('gui_support')
for backend in ('gtk', 'gtkagg', 'tkagg', 'wxagg', 'macosx', 'windowing'):
    config.set('gui_support', backend,  graphical_backend)

with open('src/mplsetup.cfg', 'w') as configfile:
    config.write(configfile)