Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sage
Path: blob/develop/build/sage_bootstrap/env.py
4052 views
1
# -*- coding: utf-8 -*-
2
"""
3
Environment Variables
4
5
This module defines the following subset of the Sage environment
6
variables:
7
8
* ``SAGE_ROOT``
9
* ``SAGE_SRC``
10
* ``SAGE_DISTFILES``
11
"""
12
13
14
# ****************************************************************************
15
# Copyright (C) 2015 Volker Braun <[email protected]>
16
#
17
# This program is free software: you can redistribute it and/or modify
18
# it under the terms of the GNU General Public License as published by
19
# the Free Software Foundation, either version 2 of the License, or
20
# (at your option) any later version.
21
# https://www.gnu.org/licenses/
22
# ****************************************************************************
23
24
import os
25
26
27
try:
28
SAGE_ROOT = os.environ['SAGE_ROOT']
29
except KeyError:
30
SAGE_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(
31
os.path.abspath(__file__))))
32
33
SAGE_SRC = os.environ.get('SAGE_SRC',
34
os.path.join(SAGE_ROOT, 'src'))
35
SAGE_DISTFILES = os.environ.get('SAGE_DISTFILES',
36
os.path.join(SAGE_ROOT, 'upstream'))
37
38
39
assert os.path.isfile(os.path.join(SAGE_ROOT, 'configure.ac')), SAGE_ROOT
40
41
try:
42
# SAGE_DISTFILES does not exist in a fresh git clone
43
os.mkdir(SAGE_DISTFILES)
44
except OSError:
45
pass
46
47
assert os.path.isdir(SAGE_DISTFILES)
48
49