added README to examples and improved database version check when used from Sourcetrail

This commit is contained in:
Eberhard Graether
2018-12-18 10:48:43 +01:00
parent f4cf5f171a
commit aa85d20e73
13 changed files with 190 additions and 140 deletions
+30
View File
@@ -0,0 +1,30 @@
## Python API Example
### Requirements
* CMake
* C++ Compiler
* Python
* SWIG
### Running from Command Line
* Run cmake with `BUILD_BINDINGS_PYTHON=ON`
* Build target `_sourcetraildb`
* Copy two files from the `bindings_python` build directory into `SourcetrailDB/examples/python_api_example/src`:
- `sourcetraildb.py`
- Windows: `_sourcetraildb.pyd`
- Linux: `_sourcetraildb.so`
- macOS: `_sourcetraildb.dylib` and rename to `_sourcetraildb.so`
* Run example from the directory `SourcetrailDB/examples/python_api_example/src` with:
```
$ python example.py --database-file-path=absolute/path/to/SourcetrailDB/examples/python_api_example/src/example.srctrldb --source-file-path=absolute/path/to/SourcetrailDB/examples/python_api_example/data/file.py
```
### Running with Sourcetrail
* Run cmake with `BUILD_EXAMPLES=ON` and `BUILD_BINDINGS_PYTHON=ON`
* Build target `_sourcetraildb` and `python_api_example`.
* Open `python_api_exampl.srctrlprj` located in the build directory of `python_api_example` with Sourcetrail and index the project.