New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add sage/env.py and fix many inappropriate references to SAGE_ROOT #13432
Comments
Dependencies: #13123 |
comment:2
+1 to the idea. |
comment:3
I am very supportive as well as some people would know. The main challenge is to avoid duplication with sage-env. How is the sage "executable" supposed to know about SAGE_ROOT/SAGE_LOCAL from the new env.py? |
comment:4
Replying to @kiwifb:
I don't think there is duplication if |
comment:5
Eventually I would like |
comment:6
OK I read it a bit more carefully and I see it is sourced from the environment. I guess sage in its current state can work like that without problem. And yes from my sage-on-gentoo point of view where sage is part of the system I would need it to be independent. There are issues in s-o-g when you import thing like sympy in python because it will pull sage if installed. If the variables are not in the environment things break in sageinspect. We used to define SAGE variable in the global environment but that had its issue and the lmnd people (should copy burcin on this) didn't like it. At the moment I have pushed things in misc/misc.py to make things work in most cases. |
comment:7
Replying to @ohanar:
I'm not sure whether I like that, but since it's in the distant future, I don't have to worry about it. |
This comment has been minimized.
This comment has been minimized.
comment:10
Ok, this has been fixed up and should be ready to go now. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:13
That looks so much like the mega patch that I apply to sage-on-gentoo. OK my equivalent of env.py is not nearly as sophisticated and I don't have some of these new variables. But otherwise that's scary and this will simplify my life a great deal. I am going through comparing with my own stuff. |
comment:14
OK so far the main differences with my own stuff is that I have gone on a hunt on a wider ranger of variables. SAGE_ROOT is the lead bad guy but I also went for most instances of os.environ['SAGE_LOCAL'] and others that made sense to me. This ticket is just for SAGE_ROOT and that's already a big chunk. |
comment:15
I think that a follow up ticket for the |
comment:16
In one of my first attempt I ended up with an unbuildable sage :( but getting all the variables in an independent file is the big cure for that. I understand the problem with the logic. I still have one doctest failure in lazy_import_cache in sage-on-gentoo and I am not sure why. I didn't create any new variables like SAGE_SRC and SAGE_LIB, that was a lot of work as it is. I believe the other instances of SAGE_ROOT in sage/misc/cython.py can go.
I edited it so it is closer to your style. |
comment:17
sage/sandpiles/sandpile.py you have
becoming
Is it correcting a bug as well? |
comment:18
Replying to @kiwifb:
No, if you look a little further down, I change a |
comment:19
Replying to @ohanar:
I missed that line. Is the replacement of SAGE_INC in setup.py (well spotted the one where it is still SAGE_LOCAL/include) by CPATH really necessary? That's the only place CPATH is used and you don't use it in module_list.py anyway. Apart from this I am positive that it should go in while it is easy to apply. We may do some more work on this later. |
comment:20
Don't use
|
comment:21
I think CPATH (and its idea) should be dropped from sage.env altogether and setup.py only be touched to normalize its use of SAGE_INC. |
comment:22
Replying to @kiwifb:
Yes exactly. |
comment:35
That was the last spot. I added a trivial patch to take care of it. |
Changed keywords from none to build warnings |
comment:36
When building Sage, there are lots of warnings of the form
This is a problem, those headers are not system headers, which might break dependency checking. |
comment:37
#13031 would resolve this issue. |
comment:38
While that ticket may really fix the problem, now I wish I hadn't said yes to your removal of SAGE_INC on the basis of CPATH. It obviously doesn't work here. Admittely that probably means there is a bug somewhere as you would expect it to work. |
Attachment: trac13432.patch.gz apply to sage library |
This comment has been minimized.
This comment has been minimized.
comment:39
Ok, threw |
comment:40
Thanks. I don't think that's essential to your git migration. More a question of minimal"beauty". We can always remove it with #13031 if it really negates the need for it. |
Merged: sage-5.9.beta0 |
comment:42
If you want people to use these variables "correctly", you'd better document them somewhere. I hope you're working on a follow-up ticket for this... |
comment:43
I made a ticket for documenting development environment variables at #14262 -- I probably won't get around to it for another week/week and a half, as I'm mainly prepping for Sage Days 47 (and then might not get a chance to work on it at the Sage Days). |
comment:44
Related: #15005. |
comment:45
Sorry to revive an old ticket, but the people involved here might be able to answer the best: what is the rationale behind the variable substitution used in
instead of
I am asking because there is a bug in the variable substitution (which I attempted to address in #23758): the variable substitution is done by iterating over |
There are many places within the Sage library that make explicit references to
SAGE_ROOT
, whenSAGE_LOCAL
,SAGE_DATA
, etc. are more appropriate. These references assume a particular directory structure which unnecessarily break various components when using a different directory structure (i.e. transitioning to git or sage-on-gentoo). This ticket aims to correct many of these references.This ticket also adds
sage.env
as a place to keep global used Sage variables (these currently live insage.misc.misc
). Currently this file does little more than separate out some of these variables, but the intent is to provide a dedicated place in python for determining the environment for the Sage library (this will eventually need to be independent ofsage-env
if we are ever to truly transition to argparse).Followup: #14226.
Installation Instructions:
Depends on #13123
Depends on #13348
CC: @jdemeyer @kiwifb @burcin
Component: misc
Keywords: build warnings
Author: R. Andrew Ohana
Reviewer: François Bissey
Merged: sage-5.9.beta0
Issue created by migration from https://trac.sagemath.org/ticket/13432
The text was updated successfully, but these errors were encountered: