diff options
author | John Wiegley <johnw@newartisans.com> | 2009-10-25 04:35:19 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-10-25 05:01:39 -0400 |
commit | 588f2ef2f51d7bdf209820bfb244034863601939 (patch) | |
tree | 7a473de7c117bf71bb802398823826ca4dfbfdca /src/pyinterp.h | |
parent | dc66840dd745863c06ad6513f9f66d589bcc29d8 (diff) | |
download | fork-ledger-588f2ef2f51d7bdf209820bfb244034863601939.tar.gz fork-ledger-588f2ef2f51d7bdf209820bfb244034863601939.tar.bz2 fork-ledger-588f2ef2f51d7bdf209820bfb244034863601939.zip |
Fixed many compiler warnings from g++ 4.4
Diffstat (limited to 'src/pyinterp.h')
-rw-r--r-- | src/pyinterp.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/pyinterp.h b/src/pyinterp.h index dd9ca64c..4943eb2f 100644 --- a/src/pyinterp.h +++ b/src/pyinterp.h @@ -105,6 +105,7 @@ public: virtual expr_t::ptr_op_t lookup(const string& name); +#if BOOST_VERSION >= 103700 OPTION_(python_interpreter_t, import_, DO_(scope) { interactive_t args(scope, "s"); @@ -114,23 +115,31 @@ public: python::object sys_dict = module_sys.attr("__dict__"); python::list paths(sys_dict["path"]); -#if BOOST_VERSION >= 103700 paths.insert(0, file.parent_path().string()); -#else - paths.insert(0, file.branch_path().string()); -#endif sys_dict["path"] = paths; -#if BOOST_VERSION >= 103700 string name = file.filename(); if (contains(name, ".py")) parent->import(file.stem()); else parent->import(name); -#else + }); +#else // BOOST_VERSION >= 103700 + OPTION_(python_interpreter_t, import_, DO_(scope) { + interactive_t args(scope, "s"); + + path file(args.get<string>(0)); + + python::object module_sys = parent->import("sys"); + python::object sys_dict = module_sys.attr("__dict__"); + + python::list paths(sys_dict["path"]); + paths.insert(0, file.branch_path().string()); + sys_dict["path"] = paths; + parent->import(file.leaf()); -#endif }); +#endif // BOOST_VERSION >= 103700 }; extern shared_ptr<python_interpreter_t> python_session; |