# -*- coding: utf-8 -*-1"""2Environment Variables34This module defines the following subset of the Sage environment5variables:67* ``SAGE_ROOT``8* ``SAGE_SRC``9* ``SAGE_DISTFILES``10"""111213# ****************************************************************************14# Copyright (C) 2015 Volker Braun <[email protected]>15#16# This program is free software: you can redistribute it and/or modify17# it under the terms of the GNU General Public License as published by18# the Free Software Foundation, either version 2 of the License, or19# (at your option) any later version.20# https://www.gnu.org/licenses/21# ****************************************************************************2223import os242526try:27SAGE_ROOT = os.environ['SAGE_ROOT']28except KeyError:29SAGE_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(30os.path.abspath(__file__))))3132SAGE_SRC = os.environ.get('SAGE_SRC',33os.path.join(SAGE_ROOT, 'src'))34SAGE_DISTFILES = os.environ.get('SAGE_DISTFILES',35os.path.join(SAGE_ROOT, 'upstream'))363738assert os.path.isfile(os.path.join(SAGE_ROOT, 'configure.ac')), SAGE_ROOT3940try:41# SAGE_DISTFILES does not exist in a fresh git clone42os.mkdir(SAGE_DISTFILES)43except OSError:44pass4546assert os.path.isdir(SAGE_DISTFILES)474849