Sage: Ticket #28225: Allow sage to run in the absence of sage-env
https://trac.sagemath.org/ticket/28225
<p>
The sage-env script has never been particularly useful in distributions, and has actually been more of a nuisance: it needs to be heavily patched or even replaced with a custom one.
</p>
<p>
After <a class="closed ticket" href="https://trac.sagemath.org/ticket/25786" title="#25786: defect: Fix introspection with ? when doc source is not available (closed: fixed)">#25786</a> (which removes SAGE_DOC_SRC usage at runtime) the only use for it that I can think of is setting DOT_SAGE. This patch allows to completely do away with this script, by setting a fallback for DOT_SAGE in the sage executable.
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/28225
Trac 1.2Antonio RojasSun, 21 Jul 2019 10:21:04 GMTbranch set
https://trac.sagemath.org/ticket/28225#comment:1
https://trac.sagemath.org/ticket/28225#comment:1
<ul>
<li><strong>branch</strong>
set to <em>u/arojas/allow_sage_to_run_in_the_absence_of_sage_env</em>
</li>
</ul>
TicketgitSun, 21 Jul 2019 10:23:17 GMTcommit set
https://trac.sagemath.org/ticket/28225#comment:2
https://trac.sagemath.org/ticket/28225#comment:2
<ul>
<li><strong>commit</strong>
set to <em>dda6986e1a3b4c3d06150475d75a207c1e133394</em>
</li>
</ul>
<p>
Branch pushed to git repo; I updated commit sha1. New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=dda6986e1a3b4c3d06150475d75a207c1e133394"><span class="icon"></span>dda6986</a></td><td><code>Allow sage to run if sage-env is not present</code>
</td></tr></table>
TicketAntonio RojasSun, 21 Jul 2019 10:30:14 GMTcomponent, description changed; cc, dependencies, author set
https://trac.sagemath.org/ticket/28225#comment:3
https://trac.sagemath.org/ticket/28225#comment:3
<ul>
<li><strong>cc</strong>
<em>Julian Rüth</em> <em>Isuru Fernando</em> <em>François Bissey</em> <em>Timo Kaufmann</em> added
</li>
<li><strong>dependencies</strong>
set to <em>#25786</em>
</li>
<li><strong>component</strong>
changed from <em>PLEASE CHANGE</em> to <em>distribution</em>
</li>
<li><strong>description</strong>
modified (<a href="/ticket/28225?action=diff&version=3">diff</a>)
</li>
<li><strong>author</strong>
set to <em>Antonio Rojas</em>
</li>
</ul>
TicketAntonio RojasSun, 21 Jul 2019 10:33:00 GMTtype changed
https://trac.sagemath.org/ticket/28225#comment:4
https://trac.sagemath.org/ticket/28225#comment:4
<ul>
<li><strong>type</strong>
changed from <em>PLEASE CHANGE</em> to <em>enhancement</em>
</li>
</ul>
TicketFrançois BisseySun, 21 Jul 2019 11:07:29 GMT
https://trac.sagemath.org/ticket/28225#comment:5
https://trac.sagemath.org/ticket/28225#comment:5
<p>
I have been <code>sage-env</code> free for a few releases now in sage-on-gentoo. I ship my own sage script now, but the change I see in the commit are good. I think you should also fix <code>sage-cython</code> <a class="ext-link" href="https://github.com/cschwan/sage-on-gentoo/blob/master/sci-mathematics/sage/files/sage-8.1-sage-cython.patch"><span class="icon"></span>https://github.com/cschwan/sage-on-gentoo/blob/master/sci-mathematics/sage/files/sage-8.1-sage-cython.patch</a> which won't work with stuff from the environment. I also have this patch for various scripts <a class="ext-link" href="https://github.com/cschwan/sage-on-gentoo/blob/master/sci-mathematics/sage/files/sage-bin-8.7.patch"><span class="icon"></span>https://github.com/cschwan/sage-on-gentoo/blob/master/sci-mathematics/sage/files/sage-bin-8.7.patch</a>
</p>
<p>
I also have
</p>
<pre class="wiki"># Replace SAGE_EXTCODE with the installation location
sed -i "s:\$SAGE_EXTCODE:${EPREFIX}/usr/share/sage/ext:g" \
bin/sage-ipynb2rst \
bin/sage-valgrind
</pre><p>
which may be harder to replace more generally.
</p>
<p>
I haven't made any fix to runtests, but <code>DOT_SAGE</code> should definitely be set - for some exotic usage with valgrind and other tools.
</p>
TicketAntonio RojasSun, 21 Jul 2019 11:16:48 GMT
https://trac.sagemath.org/ticket/28225#comment:6
https://trac.sagemath.org/ticket/28225#comment:6
<p>
Thanks. Most of these work fine here just because /bin symlinked to /usr/bin, but that certainly shouldn't be assumed
</p>
TicketFrançois BisseySun, 21 Jul 2019 11:20:07 GMT
https://trac.sagemath.org/ticket/28225#comment:7
https://trac.sagemath.org/ticket/28225#comment:7
<p>
Yes, I hadn't thought of that scenario at all, where the variable being undefined is actually helpful. But it will break on other system. But that doesn't help with <code>sage-cython</code>.
</p>
TicketgitSun, 21 Jul 2019 11:43:31 GMTcommit changed
https://trac.sagemath.org/ticket/28225#comment:8
https://trac.sagemath.org/ticket/28225#comment:8
<ul>
<li><strong>commit</strong>
changed from <em>dda6986e1a3b4c3d06150475d75a207c1e133394</em> to <em>6d049b14a3a1b77033fa09687a3942fe66f1384e</em>
</li>
</ul>
<p>
Branch pushed to git repo; I updated commit sha1. New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=e59156b09f7b7c1c44e6726fe3d24ffad224a187"><span class="icon"></span>e59156b</a></td><td><code>Fix sage-cython when sage-env is not available</code>
</td></tr><tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=a52972e293045854ac9996eb261f23470675cf21"><span class="icon"></span>a52972e</a></td><td><code>export DOT_SAGE so it can be used in spawned scripts</code>
</td></tr><tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=6d049b14a3a1b77033fa09687a3942fe66f1384e"><span class="icon"></span>6d049b1</a></td><td><code>Fix several scripts to work without sage-env</code>
</td></tr></table>
TicketgitSun, 21 Jul 2019 12:03:18 GMTcommit changed
https://trac.sagemath.org/ticket/28225#comment:9
https://trac.sagemath.org/ticket/28225#comment:9
<ul>
<li><strong>commit</strong>
changed from <em>6d049b14a3a1b77033fa09687a3942fe66f1384e</em> to <em>2dacae22b2e2da5bbfd89a3ecaec08c2f17f31f9</em>
</li>
</ul>
<p>
Branch pushed to git repo; I updated commit sha1. New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=2dacae22b2e2da5bbfd89a3ecaec08c2f17f31f9"><span class="icon"></span>2dacae2</a></td><td><code>Fix sage-ipynb2rst and sage-valgrind scripts when sage-env is not available</code>
</td></tr></table>
TicketAntonio RojasSun, 21 Jul 2019 12:05:15 GMT
https://trac.sagemath.org/ticket/28225#comment:10
https://trac.sagemath.org/ticket/28225#comment:10
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/28225#comment:5" title="Comment 5">fbissey</a>:
</p>
<blockquote class="citation">
<p>
I also have
</p>
<pre class="wiki"># Replace SAGE_EXTCODE with the installation location
sed -i "s:\$SAGE_EXTCODE:${EPREFIX}/usr/share/sage/ext:g" \
bin/sage-ipynb2rst \
bin/sage-valgrind
</pre><p>
which may be harder to replace more generally.
</p>
</blockquote>
<p>
Fixed in the latest commit (in a somewhat hackish way, would be nice if someone could come up with a nicer way to do it)
</p>
TicketFrançois BisseySun, 21 Jul 2019 20:57:47 GMT
https://trac.sagemath.org/ticket/28225#comment:11
https://trac.sagemath.org/ticket/28225#comment:11
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/28225#comment:10" title="Comment 10">arojas</a>:
</p>
<blockquote class="citation">
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/28225#comment:5" title="Comment 5">fbissey</a>:
</p>
<blockquote class="citation">
<p>
I also have
</p>
<pre class="wiki"># Replace SAGE_EXTCODE with the installation location
sed -i "s:\$SAGE_EXTCODE:${EPREFIX}/usr/share/sage/ext:g" \
bin/sage-ipynb2rst \
bin/sage-valgrind
</pre><p>
which may be harder to replace more generally.
</p>
</blockquote>
<p>
Fixed in the latest commit (in a somewhat hackish way, would be nice if someone could come up with a nicer way to do it)
</p>
</blockquote>
<p>
Certainly does look hackish. I would have never thought of using <code>print</code> that way. Does this really work?
</p>
TicketAntonio RojasSun, 21 Jul 2019 21:03:44 GMT
https://trac.sagemath.org/ticket/28225#comment:12
https://trac.sagemath.org/ticket/28225#comment:12
<blockquote class="citation">
<p>
Certainly does look hackish. I would have never thought of using <code>print</code> that way. Does this really work?
</p>
</blockquote>
<p>
Sure it does - we use this kind of thing frequently in Arch build scripts to get the python lib dir independently of the version.
</p>
TicketFrançois BisseySun, 21 Jul 2019 21:17:57 GMT
https://trac.sagemath.org/ticket/28225#comment:13
https://trac.sagemath.org/ticket/28225#comment:13
<p>
OK, I am reviewing all my patches and stuff for interesting bits. In <code>sage/doctest/control.py</code> There are several commands build with <code>$SAGE_LOCAL</code> in a way that requires it to be picked up from the environment (lines 1028, 1078 in code and lines 1026, 1062, 1069 for stuff that could be doctests). We probably want to import <code>SAGE_LOCAL</code> from <code>env.py</code> instead and insert that value.
</p>
TicketFrançois BisseySun, 21 Jul 2019 21:24:41 GMT
https://trac.sagemath.org/ticket/28225#comment:14
https://trac.sagemath.org/ticket/28225#comment:14
<p>
How do you deal with <code>SAGE_LOCAL</code> in the <code>sage</code> script? Because of arch having <code>/usr/bin</code> and <code>/bin</code> symlinked you may not catch problems in line 7 and 8. There are a number of calls to <code>SAGE_LOCAL</code> in that file you are probably missing altogether.
</p>
TicketFrançois BisseySun, 21 Jul 2019 22:06:53 GMT
https://trac.sagemath.org/ticket/28225#comment:15
https://trac.sagemath.org/ticket/28225#comment:15
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/28225#comment:13" title="Comment 13">fbissey</a>:
</p>
<blockquote class="citation">
<p>
OK, I am reviewing all my patches and stuff for interesting bits. In <code>sage/doctest/control.py</code> There are several commands build with <code>$SAGE_LOCAL</code> in a way that requires it to be picked up from the environment (lines 1028, 1078 in code and lines 1026, 1062, 1069 for stuff that could be doctests). We probably want to import <code>SAGE_LOCAL</code> from <code>env.py</code> instead and insert that value.
</p>
</blockquote>
<p>
After line 1078 we also have <code>$SAGE_EXTCODE</code> in lines 1099 to 1101.
</p>
TicketFrançois BisseySun, 21 Jul 2019 22:23:47 GMTcommit, branch changed
https://trac.sagemath.org/ticket/28225#comment:16
https://trac.sagemath.org/ticket/28225#comment:16
<ul>
<li><strong>commit</strong>
changed from <em>2dacae22b2e2da5bbfd89a3ecaec08c2f17f31f9</em> to <em>bbaf22f491ab6d334885ba4762256278d18a1bff</em>
</li>
<li><strong>branch</strong>
changed from <em>u/arojas/allow_sage_to_run_in_the_absence_of_sage_env</em> to <em>u/fbissey/allow_sage_to_run_in_the_absence_of_sage_env</em>
</li>
</ul>
<p>
Adding my ideas for <code>sage/doctests/control.py</code>. Feel free to regain control of the branch.
</p>
<hr />
<p>
New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit?id=bbaf22f491ab6d334885ba4762256278d18a1bff"><span class="icon"></span>bbaf22f</a></td><td><code>Fix control.py so it doesn't depend on values from sage-env.</code>
</td></tr></table>
TicketFrançois BisseySun, 21 Jul 2019 22:26:09 GMT
https://trac.sagemath.org/ticket/28225#comment:17
https://trac.sagemath.org/ticket/28225#comment:17
<p>
It may be impossible to completely fix the <code>sage</code> script at this stage. Best efforts at improvement would be acceptable to me.
</p>
TicketAntonio RojasSun, 21 Jul 2019 22:57:11 GMTbranch changed
https://trac.sagemath.org/ticket/28225#comment:18
https://trac.sagemath.org/ticket/28225#comment:18
<ul>
<li><strong>branch</strong>
changed from <em>u/fbissey/allow_sage_to_run_in_the_absence_of_sage_env</em> to <em>u/arojas/allow_sage_to_run_in_the_absence_of_sage_env</em>
</li>
</ul>
TicketAntonio RojasSun, 21 Jul 2019 22:59:14 GMTcommit changed
https://trac.sagemath.org/ticket/28225#comment:19
https://trac.sagemath.org/ticket/28225#comment:19
<ul>
<li><strong>commit</strong>
changed from <em>bbaf22f491ab6d334885ba4762256278d18a1bff</em> to <em>25c686bc4c5696eb63a5ba1fd44f2529749cae8d</em>
</li>
</ul>
<p>
I think all SAGE_LOCAL usage in the sage executable part that is relevant for !sage-the-distro is gone now
</p>
<hr />
<p>
New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit?id=2c31b262effd66f591286ec6629dda65ea2d6991"><span class="icon"></span>2c31b26</a></td><td><code>Replace SAGE_LOCAL usage in sage executable</code>
</td></tr><tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit?id=25c686bc4c5696eb63a5ba1fd44f2529749cae8d"><span class="icon"></span>25c686b</a></td><td><code>Skip uncompiled tarball check if sage-env is not present</code>
</td></tr></table>
TicketFrançois BisseySun, 21 Jul 2019 23:01:28 GMT
https://trac.sagemath.org/ticket/28225#comment:20
https://trac.sagemath.org/ticket/28225#comment:20
<p>
I don't think there is anything to add. Time for review?
</p>
TicketFrançois BisseyMon, 22 Jul 2019 02:07:34 GMTstatus changed
https://trac.sagemath.org/ticket/28225#comment:21
https://trac.sagemath.org/ticket/28225#comment:21
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
</ul>
<p>
I am putting in "needs review" to start the patchbots (I hope).
</p>
TicketAntonio RojasMon, 22 Jul 2019 06:56:19 GMTstatus changed
https://trac.sagemath.org/ticket/28225#comment:22
https://trac.sagemath.org/ticket/28225#comment:22
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>needs_work</em>
</li>
</ul>
<p>
Some tests are failing locally without sage-env
</p>
<pre class="wiki">sage -t --long /usr/lib/python2.7/site-packages/sage/misc/sagedoc.py # 1 doctest failed
sage -t --long /usr/lib/python2.7/site-packages/sage/misc/sphinxify.py # 4 doctests failed
sage -t --long /usr/lib/python2.7/site-packages/sage/libs/singular/function.pyx # 1 doctest failed
sage -t --long /usr/lib/python2.7/site-packages/sage/interfaces/singular.py # 5 doctests failed
</pre>
TicketgitMon, 22 Jul 2019 07:23:45 GMTcommit changed
https://trac.sagemath.org/ticket/28225#comment:23
https://trac.sagemath.org/ticket/28225#comment:23
<ul>
<li><strong>commit</strong>
changed from <em>25c686bc4c5696eb63a5ba1fd44f2529749cae8d</em> to <em>045e01c75afdc50562bf3335c9c9977defec0d0d</em>
</li>
</ul>
<p>
Branch pushed to git repo; I updated commit sha1. New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=c86bd9d765fc39e3b8b7fea3a434c7bcf71102bb"><span class="icon"></span>c86bd9d</a></td><td><code>Search for custom html themes also in SAGE_DOC, so they are found at runtime if SAGE_DOC_SRC is not set</code>
</td></tr><tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=045e01c75afdc50562bf3335c9c9977defec0d0d"><span class="icon"></span>045e01c</a></td><td><code>Define SINGULARPATH in env.py so it is available at runtime when sage-env is not imported</code>
</td></tr></table>
TicketAntonio RojasMon, 22 Jul 2019 07:24:41 GMT
https://trac.sagemath.org/ticket/28225#comment:24
https://trac.sagemath.org/ticket/28225#comment:24
<p>
All tests pass now. This branch conflicts with <a class="closed ticket" href="https://trac.sagemath.org/ticket/25786" title="#25786: defect: Fix introspection with ? when doc source is not available (closed: fixed)">#25786</a> so it will need rebasing once that one goes in.
</p>
TicketFrançois BisseyMon, 22 Jul 2019 07:40:25 GMT
https://trac.sagemath.org/ticket/28225#comment:25
https://trac.sagemath.org/ticket/28225#comment:25
<p>
I missed the singularpath one because I deal with it in the same patch as I do adjustments to <code>env.py</code>. I neglected that. I don't have a problem with <code>SAGE_DOC_SRC</code> because I have it default to <code>SAGE_DOC</code> not <code>SAGE_SRC/doc</code> in sage-on-gentoo. I am surprised that's the only place you had to fix. I am expecting anything calling <code>SAGE_DOC_SRC</code> at runtime to fail if left at that value.
</p>
<p>
I know there is no doctests in <code>sage/misc/copying.py</code> (<a class="ext-link" href="https://github.com/sagemath/sage/blob/master/src/sage/misc/copying.py"><span class="icon"></span>https://github.com/sagemath/sage/blob/master/src/sage/misc/copying.py</a>) but I am wondering if you do anything about it.
</p>
TicketAntonio RojasMon, 22 Jul 2019 08:23:40 GMT
https://trac.sagemath.org/ticket/28225#comment:26
https://trac.sagemath.org/ticket/28225#comment:26
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/28225#comment:25" title="Comment 25">fbissey</a>:
</p>
<blockquote class="citation">
<p>
I am surprised that's the only place you had to fix. I am expecting anything calling <code>SAGE_DOC_SRC</code> at runtime to fail if left at that value.
</p>
</blockquote>
<p>
The only remaining usages of SAGE_DOC_SRC in sagelib are in sage/doctest/control.py (which adds it to the list of tested dirs when calling sage -t -a) and sage/docs/conf.py (where AFAICS all usages besides the one fixed here are for doc build), so I don't expect more failures.
</p>
<blockquote class="citation">
<p>
I know there is no doctests in <code>sage/misc/copying.py</code> (<a class="ext-link" href="https://github.com/sagemath/sage/blob/master/src/sage/misc/copying.py"><span class="icon"></span>https://github.com/sagemath/sage/blob/master/src/sage/misc/copying.py</a>) but I am wondering if you do anything about it.
</p>
</blockquote>
<p>
No. COPYING.txt should probably be installed somewhere in SAGE_SHARE. But given that this is currently broken for distros anyway, I'd say it's material for a different ticket.
</p>
TicketFrançois BisseyMon, 22 Jul 2019 08:31:42 GMT
https://trac.sagemath.org/ticket/28225#comment:27
https://trac.sagemath.org/ticket/28225#comment:27
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/28225#comment:26" title="Comment 26">arojas</a>:
</p>
<blockquote class="citation">
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/28225#comment:25" title="Comment 25">fbissey</a>:
</p>
<blockquote class="citation">
<p>
I am surprised that's the only place you had to fix. I am expecting anything calling <code>SAGE_DOC_SRC</code> at runtime to fail if left at that value.
</p>
</blockquote>
<p>
The only remaining usages of SAGE_DOC_SRC in sagelib are in sage/doctest/control.py (which adds it to the list of tested dirs when calling sage -t -a) and sage/docs/conf.py (where AFAICS all usages besides the one fixed here are for doc build), so I don't expect more failures.
</p>
</blockquote>
<p>
Cool, that's a clean up that's almost done then.
</p>
<blockquote class="citation">
<blockquote class="citation">
<p>
I know there is no doctests in <code>sage/misc/copying.py</code> (<a class="ext-link" href="https://github.com/sagemath/sage/blob/master/src/sage/misc/copying.py"><span class="icon"></span>https://github.com/sagemath/sage/blob/master/src/sage/misc/copying.py</a>) but I am wondering if you do anything about it.
</p>
</blockquote>
<p>
No. COPYING.txt should probably be installed somewhere in SAGE_SHARE. But given that this is currently broken for distros anyway, I'd say it's material for a different ticket.
</p>
</blockquote>
<p>
Agreed. What to do with that file may be dependent on distro policies as well. It belongs to the location I set <code>SAGE_DOC</code> to, by policy in sage-on-gentoo.
</p>
<p>
This ticket is dealing with a good number of loose ends, it is quite nice.
</p>
TicketgitMon, 29 Jul 2019 17:34:29 GMTcommit changed
https://trac.sagemath.org/ticket/28225#comment:28
https://trac.sagemath.org/ticket/28225#comment:28
<ul>
<li><strong>commit</strong>
changed from <em>045e01c75afdc50562bf3335c9c9977defec0d0d</em> to <em>c9605200e2b5a1cadefb868fd28ef13ef2bef8c3</em>
</li>
</ul>
<p>
Branch pushed to git repo; I updated commit sha1. New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=c9605200e2b5a1cadefb868fd28ef13ef2bef8c3"><span class="icon"></span>c960520</a></td><td><code>Merge branch 'develop' of git://trac.sagemath.org/sage into t/28225/allow_sage_to_run_in_the_absence_of_sage_env</code>
</td></tr></table>
TicketAntonio RojasMon, 29 Jul 2019 17:36:39 GMTstatus changed
https://trac.sagemath.org/ticket/28225#comment:29
https://trac.sagemath.org/ticket/28225#comment:29
<ul>
<li><strong>status</strong>
changed from <em>needs_work</em> to <em>needs_review</em>
</li>
</ul>
<p>
Rebased on top of beta 4
</p>
TicketFrançois BisseyMon, 29 Jul 2019 20:44:15 GMTstatus changed; reviewer set
https://trac.sagemath.org/ticket/28225#comment:30
https://trac.sagemath.org/ticket/28225#comment:30
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
<li><strong>reviewer</strong>
set to <em>François Bissey</em>
</li>
</ul>
<p>
Well, it all looks good to me. Anyone knows why the patchbot doesn't seem to want to pick it? Is it too early after 8.9.beta4?
</p>
TicketFrançois BisseyFri, 02 Aug 2019 01:36:06 GMT
https://trac.sagemath.org/ticket/28225#comment:31
https://trac.sagemath.org/ticket/28225#comment:31
<p>
This is being merge-tested right now. Not runtime but build time, I wish I had spotted some instances of <code>os.environ</code> in <code>sage_setup/docbuild/__init__.py</code>.
</p>
<p>
I am hoping the ticket will be merged in the current state and then we can address those little left overs in a follow up ticket.
</p>
TicketFrançois BisseyFri, 02 Aug 2019 09:43:30 GMT
https://trac.sagemath.org/ticket/28225#comment:32
https://trac.sagemath.org/ticket/28225#comment:32
<p>
Another kink I missed before because of my setting of <code>SAGE_DOC_SRC</code>. sage doctest the documentation source not the installed one. I guess it also test the source code by looking at SAGE_SRC which default to SAGE_LIB when SAGE_ROOT is undefined. May be we should have gone for a similar model for SAGE_DOC_SRC - instead of the fix currently in <code>sage/docs/conf.py</code>?
</p>
TicketgitFri, 02 Aug 2019 20:39:51 GMTstatus, commit changed
https://trac.sagemath.org/ticket/28225#comment:33
https://trac.sagemath.org/ticket/28225#comment:33
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>needs_review</em>
</li>
<li><strong>commit</strong>
changed from <em>c9605200e2b5a1cadefb868fd28ef13ef2bef8c3</em> to <em>83a6cec200e7179a632daee8658ac95b561d92ac</em>
</li>
</ul>
<p>
Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:
</p>
<table class="wiki">
<tr><td><a class="ext-link" href="https://git.sagemath.org/sage.git/commit/?id=83a6cec200e7179a632daee8658ac95b561d92ac"><span class="icon"></span>83a6cec</a></td><td><code>Set SAGE_DOC as fallback for SAGE_DOC_SRC in env.py, and make sure that the fallback is used if SAGE_ROOT is unset</code>
</td></tr></table>
TicketFrançois BisseyFri, 02 Aug 2019 20:42:04 GMT
https://trac.sagemath.org/ticket/28225#comment:34
https://trac.sagemath.org/ticket/28225#comment:34
<p>
I should have said to wait for a follow up ticket. Nevermind, let's see how it plays out.
</p>
TicketJohn PalmieriSat, 03 Aug 2019 22:44:10 GMT
https://trac.sagemath.org/ticket/28225#comment:35
https://trac.sagemath.org/ticket/28225#comment:35
<p>
Some version of this ticket was merged into 8.9.beta5, and I'm guessing the last commit didn't make it. In any case, the changes that were merged cause an error with Python 3:
</p>
<pre class="wiki">sage -t --warn-long 78.7 src/sage/tests/cmdline.py
**********************************************************************
File "src/sage/tests/cmdline.py", line 503, in sage.tests.cmdline.test_executable
Failed example:
print(err)
Expected:
Cython (http://cython.org) is a compiler for code written in the
Cython language. Cython is based on Pyrex by Greg Ewing.
...
Got:
Traceback (most recent call last):
File "/Users/palmieri/Desktop/Sage_stuff/sage_builds/PYTHON3/sage-8.9.beta5/src/bin/sage-cython", line 12, in <module>
from sage.env import SAGE_SRC
ImportError: No module named sage.env
<BLANKLINE>
</pre><p>
The reason is that the <code>sage-cython</code> script begins
</p>
<pre class="wiki">#!/usr/bin/env python
</pre><p>
That means that it uses Python 2 by default. With a Python 3 build, Python 2 doesn't know about the <code>sage</code> module.
</p>
<p>
I'm not sure what you should do instead. Maybe
</p>
<pre class="wiki">try:
from sage.env import SAGE_SRC
except ImportError:
SAGE_SRC = (something involving SAGE_ROOT or SAGE_LIB?)
</pre><p>
What variables are guaranteed to be set when <code>sage-cython</code> is run?
</p>
TicketFrançois BisseySat, 03 Aug 2019 23:24:04 GMT
https://trac.sagemath.org/ticket/28225#comment:36
https://trac.sagemath.org/ticket/28225#comment:36
<p>
I think <code>sage-cython</code> should use the python sage uses otherwise, what's the point? While I don't like it, I am guessing it should use <code>sage-python23</code> instead of plain <code>python</code>. I am open to contrary opinions.
</p>
<p>
We need a follow up ticket for that last commit that didn't make and a couple of things I spotted in <code>sage_setup</code> we can throw that in as well.
</p>
TicketVolker BraunSat, 03 Aug 2019 23:51:18 GMTstatus changed; resolution set
https://trac.sagemath.org/ticket/28225#comment:37
https://trac.sagemath.org/ticket/28225#comment:37
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
c9605200e2b5a1cadefb868fd28ef13ef2bef8c3 was merged and is in 8.9.beta5, go and make a new ticket...
</p>
TicketJohn PalmieriSun, 04 Aug 2019 00:22:50 GMT
https://trac.sagemath.org/ticket/28225#comment:38
https://trac.sagemath.org/ticket/28225#comment:38
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/28225#comment:36" title="Comment 36">fbissey</a>:
</p>
<blockquote class="citation">
<p>
I think <code>sage-cython</code> should use the python sage uses otherwise, what's the point? While I don't like it, I am guessing it should use <code>sage-python23</code> instead of plain <code>python</code>. I am open to contrary opinions.
</p>
</blockquote>
<p>
The only thing that script does is to check arguments and run <code>cython</code>, so it should run fine with the system Python. For distro use, do you even care about how SAGE_SRC is used here? Maybe you could have
</p>
<pre class="wiki">try:
SAGE_SRC = os.environ["SAGE_SRC"]
except ImportError:
SAGE_SRC = "/does/not/exist"
</pre><p>
plus some explanatory comments. The whole script is deprecated, so maybe it doesn't matter much what happens to it, but you might cc jdemeyer on the followup ticket.
</p>
<blockquote class="citation">
<p>
We need a follow up ticket for that last commit that didn't make and a couple of things I spotted in <code>sage_setup</code> we can throw that in as well.
</p>
</blockquote>
<p>
Either one or two: one for your followup issues, maybe a separate one to fix the doctest?
</p>
TicketAntonio RojasSun, 04 Aug 2019 09:02:44 GMT
https://trac.sagemath.org/ticket/28225#comment:39
https://trac.sagemath.org/ticket/28225#comment:39
<p>
Filed <a class="closed ticket" href="https://trac.sagemath.org/ticket/28320" title="#28320: enhancement: Further fixes for sage-env-less installs (closed: fixed)">#28320</a>
</p>
TicketMatthias KöppeFri, 17 Jan 2020 19:49:00 GMT
https://trac.sagemath.org/ticket/28225#comment:40
https://trac.sagemath.org/ticket/28225#comment:40
<p>
Follow up: <a class="closed ticket" href="https://trac.sagemath.org/ticket/29022" title="#29022: enhancement: Make sagelib installation directory more flexible by creating a module ... (closed: wontfix)">#29022</a>
</p>
TicketMatthias KöppeFri, 17 Jan 2020 20:28:46 GMT
https://trac.sagemath.org/ticket/28225#comment:41
https://trac.sagemath.org/ticket/28225#comment:41
<p>
and <a class="closed ticket" href="https://trac.sagemath.org/ticket/25486" title="#25486: enhancement: Discover SAGE_SCRIPTS_DIR to make $SAGE_LOCAL/bin/sage work from any ... (closed: fixed)">#25486</a>
</p>
Ticket