Set custom env vars required for RStudio to work

pull/1161/head
YuviPanda 2022-06-22 00:53:51 -07:00
rodzic 9d89d6bd69
commit dfa23f6306
1 zmienionych plików z 13 dodań i 0 usunięć

Wyświetl plik

@ -133,6 +133,19 @@ class RBuildPack(PythonBuildPack):
self._runtime = "r-{}".format(str(self._checkpoint_date))
return True
def get_env(self):
"""
Set custom env vars needed for RStudio to load
"""
return super().get_env() + [
# rstudio (rsession) can't seem to find R unless we explicitly tell it where
# it is - just $PATH isn't enough. I discovered these are the env vars it
# looks for by digging through RStudio source and finding https://github.com/rstudio/rstudio/blob/main/src/cpp/r/session/RDiscovery.cpp
("R_HOME", f"/opt/R/{self.r_version}/lib/R"),
("R_DOC_DIR", "${R_HOME}/doc"),
("LD_LIBRARY_PATH", "${R_HOME}/lib:${LD_LIBRARY_PATH}"),
]
def get_path(self):
"""
Return paths to be added to the PATH environment variable.