Opened 2 years ago

Closed 2 years ago

#29852 closed enhancement (fixed)

sage: Determine SAGE_LOCAL, SAGE_ROOT via sage-config if it exists

Reported by: Matthias Köppe Owned by:
Priority: major Milestone: sage-9.3
Component: build Keywords: sd111
Cc: François Bissey, Michael Orlitzky, John Palmieri, Antonio Rojas, Sébastien Labbé Merged in:
Authors: Matthias Koeppe Reviewers: Dima Pasechnik, François Bissey
Report Upstream: N/A Work issues:
Branch: eb3793e (Commits, GitHub, GitLab) Commit: eb3793ed6871a255bbebe35cfa4826cc6e13f9bd
Dependencies: Stopgaps:

Status badges

Description (last modified by Matthias Köppe)

We reduce the runtime dependency of sage on sage-env-config.

We query sage-config (installed by sage_conf, which has a dependency on our python3 package) for the values of SAGE_LOCAL and SAGE_ROOT. sage-config must be in the same directory as $0.

This allows the installed sage script to be invoked directly from $SAGE_LOCAL/bin in an environment without SAGE_... variables, restoring what was previously implemented in #25486.

Also, we move sourcing of sage-env-config (but not sage-env!) earlier in the sage script. This is so that commands such as $SAGE_LOCAL/bin/sage --root work correctly.

Follow-up tickets:

  • #30888 resolve symlinks so it even works for symlinks to $SAGE_LOCAL/bin/sage
  • #30013 set SAGE_VENV too
  • remove the build-time dependency of the sage distribution on src/bin/sage-env-config

Change History (23)

comment:1 Changed 2 years ago by Matthias Köppe

Milestone: sage-9.2sage-wishlist

comment:2 Changed 2 years ago by François Bissey

Cc: François Bissey added

comment:3 Changed 2 years ago by Matthias Köppe

Dependencies: #29825#29850
Description: modified (diff)

comment:4 Changed 2 years ago by Matthias Köppe

Dependencies: #29850#22731

comment:5 Changed 2 years ago by Matthias Köppe

Branch: u/mkoeppe/get_rid_of_sage_env_config

comment:6 Changed 2 years ago by Matthias Köppe

Authors: Matthias Koeppe
Cc: Michael Orlitzky added
Commit: 9810f492a246441d7c570a1010558e38c1fc30ad
Description: modified (diff)
Status: newneeds_review
Summary: Get rid of sage-env-configsage: Determine SAGE_LOCAL, SAGE_ROOT via sage-config if it exists

Last 10 new commits:

8f88709src/bin/sage: Only source sage-env-config if it exists
ab2655esrc/bin/sage: Use python3 etc. from PATH instead of using SAGE_LOCAL
4577f37src/bin/sage-env: Make sage-env-config optional
c35c170sage.env: Add SAGE_VENV
c585d94src/sage: Replace some SAGE_LOCAL by SAGE_VENV
2fd195fsrc/bin/sage: Fix reference to trac ticket
f3b7a9csrc/sage/env.py: Add documentation
995af9fMerge branch 't/22731/22731' into t/29852/get_rid_of_sage_env_config
2bce7b8src/bin/sage: Find SAGE_ROOT, SAGE_LOCAL from sage-config
9810f49src/bin/sage: Determine SAGE_ROOT, SAGE_LOCAL earlier

comment:7 Changed 2 years ago by Matthias Köppe

Cc: John Palmieri added

comment:8 Changed 2 years ago by Matthias Köppe

Description: modified (diff)
Milestone: sage-wishlistsage-9.3

comment:9 Changed 2 years ago by Matthias Köppe

Description: modified (diff)

comment:10 Changed 2 years ago by Dima Pasechnik

Reviewers: Dima Pasechnik
Status: needs_reviewpositive_review

lgtm

comment:11 Changed 2 years ago by Matthias Köppe

Thanks!

comment:12 Changed 2 years ago by Volker Braun

Branch: u/mkoeppe/get_rid_of_sage_env_config9810f492a246441d7c570a1010558e38c1fc30ad
Resolution: fixed
Status: positive_reviewclosed

comment:13 Changed 2 years ago by Volker Braun

Branch: 9810f492a246441d7c570a1010558e38c1fc30adu/mkoeppe/get_rid_of_sage_env_config
Resolution: fixed
Status: closednew

comment:14 Changed 2 years ago by Volker Braun

Status: newneeds_review

comment:15 Changed 2 years ago by git

Commit: 9810f492a246441d7c570a1010558e38c1fc30adeb3793ed6871a255bbebe35cfa4826cc6e13f9bd

Branch pushed to git repo; I updated commit sha1. New commits:

1fe77a8src/bin/sage-env: Do not set SAGE_SCRIPTS_DIR
eb3793eMerge branch 't/22731/22731' into t/29852/get_rid_of_sage_env_config

comment:16 Changed 2 years ago by Matthias Köppe

Merged the updated #22731 - needs another round of review

comment:17 Changed 2 years ago by Matthias Köppe

Keywords: sd111 added

Hoping we can make progress on this ticket this week - https://wiki.sagemath.org/days111

comment:18 Changed 2 years ago by Matthias Köppe

Dependencies: #22731

comment:19 Changed 2 years ago by Matthias Köppe

Cc: Antonio Rojas Sébastien Labbé added

comment:20 Changed 2 years ago by Matthias Köppe

Finishing the review of this ticket would be helpful - #30888 and #30013 depend on it.

comment:21 Changed 2 years ago by François Bissey

Reviewers: Dima PasechnikDima Pasechnik, François Bissey
Status: needs_reviewpositive_review

I was rather convinced that was already in. Oh yes, it has been reverted once. It should be fine now.

comment:22 Changed 2 years ago by Matthias Köppe

Thank you!

comment:23 Changed 2 years ago by Volker Braun

Branch: u/mkoeppe/get_rid_of_sage_env_configeb3793ed6871a255bbebe35cfa4826cc6e13f9bd
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.