Skip to content

Commit 6c65c1c

Browse files
author
Release Manager
committed
gh-39885: Provided a default value for SAGE_ROOT that can be overridden by an environment variable or configuration file <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> This PR fixes #39870 added following code to `env.py` ``` DEFAULT_SAGE_ROOT = "" SAGE_ROOT = var("SAGE_ROOT", DEFAULT_SAGE_ROOT) ``` to ensure that `SAGE_ROOT` is not hardcoded and can be dynamically set or overridden ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #39885 Reported by: Krishna Dubey Reviewer(s): Antonio Rojas, Tobias Diez
2 parents f9cc118 + 83e10d2 commit 6c65c1c

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

src/sage/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def var(key: str, *fallbacks: Optional[str], force: bool = False) -> Optional[st
192192
SAGE_SPKG_INST = var("SAGE_SPKG_INST", join(SAGE_LOCAL, "var", "lib", "sage", "installed")) # deprecated
193193

194194
# source tree of the Sage distribution
195-
SAGE_ROOT = var("SAGE_ROOT") # no fallback for SAGE_ROOT
195+
SAGE_ROOT = var("SAGE_ROOT") or None
196196
SAGE_SRC = var("SAGE_SRC", join(SAGE_ROOT, "src"), SAGE_LIB)
197197
SAGE_DOC_SRC = var("SAGE_DOC_SRC", join(SAGE_ROOT, "src", "doc"), SAGE_DOC)
198198
SAGE_PKGS = var("SAGE_PKGS", join(SAGE_ROOT, "build", "pkgs"))

src/sage/meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ sage_install_dir = py.get_install_dir() / 'sage'
44
# Generate the configuration file
55
conf_data = configuration_data()
66
conf_data.set('PACKAGE_VERSION', '1.2.3')
7-
conf_data.set('SAGE_ROOT', meson.current_source_dir() / '..' / '..')
87
# We use Python's prefix here to make it work with conda
98
prefix = fs.as_posix(py.get_variable('prefix', ''))
109
conf_data.set('prefix', prefix)

0 commit comments

Comments
 (0)