mirror of
https://github.com/boostorg/python.git
synced 2026-01-19 16:32:16 +00:00
Compare commits
7 Commits
boost-1.54
...
boost-1.58
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1e9eb303a | ||
|
|
9eee9ef461 | ||
|
|
fe24ab9dd5 | ||
|
|
a911c17fd6 | ||
|
|
8d5d777ebb | ||
|
|
17a7655c74 | ||
|
|
832a1edd79 |
5
example/Jamroot
Executable file → Normal file
5
example/Jamroot
Executable file → Normal file
@@ -11,7 +11,10 @@ use-project boost
|
||||
# boost_python library from the project whose global ID is
|
||||
# /boost/python.
|
||||
project
|
||||
: requirements <library>/boost/python//boost_python ;
|
||||
: requirements <library>/boost/python//boost_python
|
||||
<implicit-dependency>/boost//headers
|
||||
: usage-requirements <implicit-dependency>/boost//headers
|
||||
;
|
||||
|
||||
# Declare the three extension modules. You can specify multiple
|
||||
# source files after the colon separated by spaces.
|
||||
|
||||
2
example/quickstart/Jamroot
Executable file → Normal file
2
example/quickstart/Jamroot
Executable file → Normal file
@@ -12,6 +12,8 @@ use-project boost
|
||||
# /boost/python.
|
||||
project boost-python-quickstart
|
||||
: requirements <library>/boost/python//boost_python
|
||||
<implicit-dependency>/boost//headers
|
||||
: usage-requirements <implicit-dependency>/boost//headers
|
||||
;
|
||||
|
||||
# Make the definition of the python-extension rule available
|
||||
|
||||
@@ -20,7 +20,10 @@ use-project boost
|
||||
# boost_python library from the project whose global ID is
|
||||
# /boost/python.
|
||||
project
|
||||
: requirements <library>/boost/python//boost_python ;
|
||||
: requirements <library>/boost/python//boost_python
|
||||
<implicit-dependency>/boost//headers
|
||||
: usage-requirements <implicit-dependency>/boost//headers
|
||||
;
|
||||
|
||||
# Declare the three extension modules. You can specify multiple
|
||||
# source files after the colon separated by spaces.
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
# include <boost/python/detail/prefix.hpp>
|
||||
|
||||
# include <boost/bind.hpp>
|
||||
# include <boost/bind/placeholders.hpp>
|
||||
# include <boost/type.hpp>
|
||||
# include <boost/python/detail/translate_exception.hpp>
|
||||
# include <boost/python/detail/exception_handler.hpp>
|
||||
|
||||
15
meta/libraries.json
Normal file
15
meta/libraries.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"key": "python",
|
||||
"name": "Python",
|
||||
"authors": [
|
||||
"Dave Abrahams"
|
||||
],
|
||||
"description": "The Boost Python Library is a framework for interfacing Python and C++. It allows you to quickly and seamlessly expose C++ classes functions and objects to Python, and vice-versa, using no special tools -- just your C++ compiler.",
|
||||
"category": [
|
||||
"Inter-language"
|
||||
],
|
||||
"maintainers": [
|
||||
"Ralf Grosse-Kunstleve <rwgrosse-kunstleve -at- lbl.gov>",
|
||||
"Ravi Rajagopal <lists_ravi -at- lavabit.com>"
|
||||
]
|
||||
}
|
||||
18
src/exec.cpp
18
src/exec.cpp
@@ -84,22 +84,24 @@ object BOOST_PYTHON_DECL exec_file(str filename, object global, object local)
|
||||
if (local.is_none()) local = global;
|
||||
// should be 'char const *' but older python versions don't use 'const' yet.
|
||||
char *f = python::extract<char *>(filename);
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
// TODO(bhy) temporary workaround for Python 3.
|
||||
// should figure out a way to avoid binary incompatibilities as the Python 2
|
||||
// version did.
|
||||
FILE *fs = fopen(f, "r");
|
||||
#else
|
||||
|
||||
// Let python open the file to avoid potential binary incompatibilities.
|
||||
#if PY_VERSION_HEX >= 0x03000000
|
||||
// See http://www.codeproject.com/Articles/820116/Embedding-Python-program-in-a-C-Cplusplus-code
|
||||
FILE *fs = _Py_fopen(f, "r");
|
||||
#else
|
||||
PyObject *pyfile = PyFile_FromString(f, const_cast<char*>("r"));
|
||||
if (!pyfile) throw std::invalid_argument(std::string(f) + " : no such file");
|
||||
python::handle<> file(pyfile);
|
||||
FILE *fs = PyFile_AsFile(file.get());
|
||||
#endif
|
||||
PyObject* result = PyRun_File(fs,
|
||||
|
||||
int closeit = 1; // Close file before PyRun returns
|
||||
PyObject* result = PyRun_FileEx(fs,
|
||||
f,
|
||||
Py_file_input,
|
||||
global.ptr(), local.ptr());
|
||||
global.ptr(), local.ptr(),
|
||||
closeit);
|
||||
if (!result) throw_error_already_set();
|
||||
return object(detail::new_reference(result));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user