From 0d14a90c489a5c638d7c2c7b852917a4e67c3950 Mon Sep 17 00:00:00 2001 From: Davysson Silva Date: Tue, 18 Sep 2018 22:38:16 -0300 Subject: [PATCH] update .gitignore and add build instructions to README.md --- .gitignore | 3 ++- .vscode/settings.json | 54 ------------------------------------------- README.md | 52 +++++++++++++++++++++++++---------------- 3 files changed, 34 insertions(+), 75 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 62c11b2..f5404a2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ tmp/ __pycache__ compile_environment.yml *.so -.vscode/* \ No newline at end of file +.vscode/ +dist/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 2f0d629..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "files.associations": { - "cctype": "cpp", - "cmath": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "array": "cpp", - "atomic": "cpp", - "strstream": "cpp", - "*.tcc": "cpp", - "chrono": "cpp", - "clocale": "cpp", - "cstdint": "cpp", - "deque": "cpp", - "forward_list": "cpp", - "list": "cpp", - "unordered_map": "cpp", - "unordered_set": "cpp", - "vector": "cpp", - "exception": "cpp", - "optional": "cpp", - "string_view": "cpp", - "fstream": "cpp", - "functional": "cpp", - "initializer_list": "cpp", - "iosfwd": "cpp", - "iostream": "cpp", - "istream": "cpp", - "limits": "cpp", - "memory": "cpp", - "new": "cpp", - "ostream": "cpp", - "numeric": "cpp", - "ratio": "cpp", - "sstream": "cpp", - "stdexcept": "cpp", - "streambuf": "cpp", - "system_error": "cpp", - "thread": "cpp", - "cinttypes": "cpp", - "type_traits": "cpp", - "tuple": "cpp", - "typeindex": "cpp", - "typeinfo": "cpp", - "utility": "cpp", - "valarray": "cpp" - } -} \ No newline at end of file diff --git a/README.md b/README.md index ab34976..47100c8 100644 --- a/README.md +++ b/README.md @@ -10,54 +10,66 @@ Python binding for ModSecurity `libmodsecurity`, `python-dev` or `python3-dev` as well as `cmake` +### Packages -### Compiling with CMake +Pymodsecurity is available as an python package, to install it simply run: +``` +$ pip install pymodsecurity +``` -The module's shared library can be built through CMake: +### Building from source -1 - Clone this repo -2 - Update the pybind11 submodule +There are multiple ways to build pymodsecurity from source, you can either compile the module manually with CMake, install using setup.py or build a conda package using the recipe. Below are steps for each way. +#### Installing via setup.py + +1 - Clone this repo and update the pybind11 submodule: ```bash -$ git submodule init && git submodule update +$ git clone --recurse-submodules https://github.com/actions-security/pymodsecurity.git ``` -3 - Create a build directory +2 - Compile and install the module: +``` +$ python setup.py install +``` + +#### Compiling with CMake +1 - Clone this repo and update the pybind11 submodule: ```bash -$ mkdir build && cd build +$ git clone --recurse-submodules https://github.com/actions-security/pymodsecurity.git ``` -4 - Run cmake and make +2 - Create a build directory: +```bash +$ mkdir build && cd build +``` +3 - Run CMake and make: ```bash $ cmake .. && make ``` -5 - Add the shared library to python's path +4 - Add the shared library to python's path -### Building and installing with conda +#### Building and installing with conda -If you're using conda, you can build the package locally using conda-build: - -1 - Clone this repo -2 - Update the pybind11 submodule +If you're using conda, you can build the package locally using conda-build (you will need to install `conda-build`). +1 - Clone this repo and update the pybind11 submodule: ```bash -$ git submodule init && git submodule update +$ git clone --recurse-submodules https://github.com/actions-security/pymodsecurity.git ``` -3 - Run conda-build - +2 - Run conda-build: ``` $ conda-build recipe ``` -4 - Install - +3 - Install the package: ``` $ conda install --use-local pymodsecurity ``` ### Examples -Some examples are provided in the `examples/` directory +Some examples are provided in the `examples/` directory. More are coming soon.