46using std::string, std::ifstream, std::ofstream, std::ios, std::endl;
90 if (
gSystem->AccessPathName(dest.c_str())) {
91 if (
gSystem->mkdir(dest.c_str())) {
93 "Error installing notebook configuration files -- cannot create directory %s\n",
101 std::unique_ptr<TList>
files;
108 string fname(
s.Data());
109 string sourcefile = source +
pathsep + fname;
110 string destfile = dest +
pathsep + fname;
111 if (!
file->IsDirectory()) {
112 if (
gSystem->CopyFile(sourcefile.c_str(), destfile.c_str(),
true)) {
114 "Error installing notebook configuration files -- cannot copy file %s to %s\n",
115 sourcefile.c_str(), destfile.c_str());
119 else if (fname.compare(
".") && fname.compare(
"..") && fname.compare(
"html")) {
136 ofstream out(jupyconfig, ios::trunc);
138 out <<
"import os" << endl;
140 std::replace( rootbin.begin(), rootbin.end(),
'\\',
'/');
141 std::replace( rootdata.begin(), rootdata.end(),
'\\',
'/');
142 out <<
"rootbin = '" << rootbin <<
"'" << endl;
143 string jsrootsys = rootdata +
"/js/";
144 out <<
"os.environ['PYTHONPATH'] = '%s' % rootbin + ';' + os.getenv('PYTHONPATH', '')" << endl;
145 out <<
"os.environ['PATH'] = '%s;%s/bin' % (rootbin,rootbin) + ';' + os.getenv('PATH', '')" << endl;
147 out <<
"rootbin = '" << rootbin <<
"'" << endl;
148 out <<
"rootlib = '" << rootlib <<
"'" << endl;
149 string jsrootsys = rootdata +
"/js/";
150 out <<
"os.environ['PYTHONPATH'] = '%s' % rootlib + ':' + os.getenv('PYTHONPATH', '')" << endl;
151 out <<
"os.environ['PATH'] = '%s:%s/bin' % (rootbin,rootbin) + ':' + os.getenv('PATH', '')" << endl;
152 out <<
"os.environ['LD_LIBRARY_PATH'] = '%s' % rootlib + ':' + os.getenv('LD_LIBRARY_PATH', '')" << endl;
154 out <<
"c.NotebookApp.extra_static_paths = ['" << jsrootsys <<
"']" << endl;
160 "Error installing notebook configuration files -- cannot create IPython config file at %s\n",
static bool InstallNbFiles(string source, string dest)
Installs ROOT notebook files in the user's home directory.
#define JUPYTER_CONF_PATH_V
static int CheckNbInstallation(string dir)
Checks whether ROOT notebook files are installed and they are the current version.
static bool CreateStamp(string dest)
Creates a file that stores the current commit id in it.
constexpr const char * pathsep
static bool CreateJupyterConfig(string dest, string rootbin, string rootlib, string rootdata)
Creates the Jupyter notebook configuration file that sets the necessary environment.