#10967: R breaks if SAGE_LOCAL undefined
------------------------+---------------------------------------------------
Reporter: ahd | Owner: tbd
Type: defect | Status: new
Priority: minor | Milestone: sage-4.7
Component: packages | Keywords: R
Author: | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
------------------------+---------------------------------------------------
Comment(by kcrisman):
Okay, it turns out that this is done in spkg-install in an interesting way
- by calling a Python script called `fix_hardcode`:
{{{
#!/usr/bin/env python
import os
def fix_hardcode(file):
r =
open(file).read().replace('#SAGEHACK#','R_HOME_DIR="${SAGE_LOCAL}/lib/R/"')
open(file,'w').write(r)
S = os.environ['SAGE_LOCAL']
fix_hardcode(S + '/bin/R')
fix_hardcode(S + '/lib/R/bin/R')
}}}
Which replaces the thing which is actually patched:
{{{
# HACK for Sage to avoid hardcoding. NOthing
# else has been changed in this file.
#R_HOME_DIR="${SAGE_LOCAL}/lib/R/"
#SAGEHACK#
}}}
Apparently one can't change this part of the file R.sh.in until after
configuration and make install? I think because that file must end up in
the binary ahd alludes to.
So we just need to change the hack to
{{{
r = open(file).read().replace('#SAGEHACK#','foo')
}}}
where foo is a string version of
{{{
if test -n "${SAGE_LOCAL}"; then
R_HOME_DIR="${SAGE_LOCAL}/lib/R/"
fi
}}}
But I don't know exactly how one puts multiple lines properly in a shell
script of this kind. I guess it's a Python script, so maybe {{{\n}}}
would suffice for that? But of course R.sh.in is not a Python script.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10967#comment:10>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.