mirror of https://github.com/KLayout/klayout.git
Fixed Linux build.
This commit is contained in:
parent
ab98cd7678
commit
8d6547291b
|
|
@ -2331,45 +2331,6 @@ PythonInterpreter::PythonInterpreter ()
|
||||||
|
|
||||||
Py_InitializeEx (0 /*don't set signals*/);
|
Py_InitializeEx (0 /*don't set signals*/);
|
||||||
|
|
||||||
if (add_path_from_file) {
|
|
||||||
|
|
||||||
// If present, read the paths from a file in INST_PATH/.python-paths.txt.
|
|
||||||
// The content of this file is evaluated as an expression and the result
|
|
||||||
// is placed inside the Python path.
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
QDir inst_dir (QCoreApplication::applicationDirPath ());
|
|
||||||
QFileInfo fi (inst_dir.absoluteFilePath (tl::to_qstring(".python-paths.txt")));
|
|
||||||
if (fi.exists ()) {
|
|
||||||
|
|
||||||
tl::log << tl::to_string (QObject::tr ("Reading Python path from ")) << tl::to_string (fi.filePath ());
|
|
||||||
|
|
||||||
QFile paths_txt (fi.filePath ());
|
|
||||||
paths_txt.open (QIODevice::ReadOnly);
|
|
||||||
|
|
||||||
tl::Eval eval;
|
|
||||||
eval.set_global_var ("inst_path", tl::Variant (tl::to_string (inst_dir.absolutePath ())));
|
|
||||||
tl::Expression ex;
|
|
||||||
eval.parse (ex, paths_txt.readAll ().constData ());
|
|
||||||
tl::Variant v = ex.execute ();
|
|
||||||
|
|
||||||
if (v.is_list ()) {
|
|
||||||
for (tl::Variant::iterator i = v.begin (); i != v.end (); ++i) {
|
|
||||||
add_path (i->to_string ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (tl::Exception &ex) {
|
|
||||||
tl::error << tl::to_string (QObject::tr ("Evaluation of Python path expression failed")) << ": " << ex.msg ();
|
|
||||||
} catch (...) {
|
|
||||||
tl::error << tl::to_string (QObject::tr ("Evaluation of Python path expression failed"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set dummy argv[]
|
// Set dummy argv[]
|
||||||
// TODO: more?
|
// TODO: more?
|
||||||
char *argv[1] = { make_string (app_path) };
|
char *argv[1] = { make_string (app_path) };
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
|
#else
|
||||||
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
@ -83,14 +85,14 @@ get_inst_path_internal ()
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
QFileInfo proc_exe (tl::sprintf ("/proc/%d/exe"), getpid ());
|
QFileInfo proc_exe (tl::to_qstring (tl::sprintf ("/proc/%d/exe", getpid ())));
|
||||||
if (proc_exe.exists () && proc_exe.isSymLink ()) {
|
if (proc_exe.exists () && proc_exe.isSymLink ()) {
|
||||||
return QFileInfo (proc_exe.canonicalFilePath ()).absolutePath ();
|
return tl::to_string (QFileInfo (proc_exe.canonicalFilePath ()).absolutePath ());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// As a fallback use QCoreApplication::applicationDirPath, which however it not
|
// As a fallback use QCoreApplication::applicationDirPath, which however is not
|
||||||
// available before QCoreApplication is initialized
|
// available before QCoreApplication is initialized
|
||||||
return tl::to_string (QCoreApplication::applicationDirPath ());
|
return tl::to_string (QCoreApplication::applicationDirPath ());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue