Minor fixes.

This commit is contained in:
Zied Aouini 2022-10-25 23:59:34 +02:00
parent 5be4fcfee9
commit a875c19169
2 changed files with 59 additions and 104 deletions

View file

@ -46,113 +46,68 @@ If you are proposing a feature:
## Get started
Ready to contribute? Here's how to set up NFStream for local development.
Ready to contribute? Here's a typical contribution workflow.
* Fork the NFStream repo on GitHub.
* Clone your fork locally::
### Setup your working NFStream environment
### Fork NFStream and clone your fork:
```shell
git clone git@github.com:your_name_here/nfstream.git
git clone --recurse-submodules git@github.com:your_name_here/nfstream.git
```
* Install NFStream prerequisites:
**On Linux**
```bash
sudo apt-get update
sudo apt-get install autoconf automake libtool pkg-config gettext libjson-c-dev libpcap-dev
sudo apt-get install libusb-1.0-0-dev libdbus-glib-1-dev libbluetooth-dev libnl-genl-3-dev flex bison
```
**On OSX**
```bash
brew install autoconf automake libtool pkg-config gettext json-c
```
* Build NFStream development dependencies:
[**libgpg-error**](https://github.com/gpg/libgpg-error)
```bash
git clone --branch libgpg-error-1.42 https://github.com/gpg/libgpg-error
cd libgpg-error
./autogen.sh
./configure -enable-maintainer-mode --enable-static --enable-shared --with-pic --disable-doc --disable-nls
make
sudo make install
cd ..
rm -rf libgpg-error
```
[**libgcrypt**](https://github.com/gpg/libgcrypt)
```bash
git clone --branch libgcrypt-1.8.8 https://github.com/gpg/libgcrypt
cd libgcrypt
./autogen.sh
./configure -enable-maintainer-mode --enable-static --enable-shared --with-pic --disable-doc
make
sudo make install
cd ..
rm -rf libgcrypt
```
[**libpcap**](https://github.com/the-tcpdump-group/libpcap)
```bash
git clone --branch fanout https://github.com/tsnoam/libpcap
cd libpcap
./configure --enable-ipv6 --disable-universal --enable-dbus=no --without-libnl
make
sudo make install
cd ..
rm -rf libpcap
```
[**nDPI**](https://github.com/ntop/nDPI)
```bash
git clone --branch dev https://github.com/ntop/nDPI.git
cd nDPI
./autogen.sh
./configure
make
sudo mkdir /usr/local/include/ndpi
sudo cp -a src/include/. /usr/local/include/ndpi/
sudo cp example/ndpiReader /usr/local/bin/ndpiReader
sudo cp src/lib/libndpi.a /usr/local/lib/libndpi.a
cd ..
rm -rf nDPI
```
* Install your local copy into a virtualenv. This is an example how you set up your fork for local development
for Python3.6:
```shell
cd nfstream
virtualenv venv-nfstream-py36 -p /usr/bin/python3.6
source venv-nfstream-py36/bin/activate
pip install wheel twine setuptools codecov
pip install -r requirements.txt
MACOSX_DEPLOYMENT_TARGET=10.14 python setup.py bdist_wheel
```
* Create a branch for local development:
### Create a branch for local development:
```shell
git checkout -b name-of-your-bugfix-or-feature
```
* When you're done making changes, check that your changes pass the tests:
### Build NFStream from sources
#### Linux Prerequisites
```bash
sudo apt-get update
sudo apt-get install python3-dev autoconf automake libtool pkg-config flex bison gettext libjson-c-dev
sudo apt-get install libusb-1.0-0-dev libdbus-glib-1-dev libbluetooth-dev libnl-genl-3-dev
```
#### MacOS Prerequisites
```bash
brew install autoconf automake libtool pkg-config gettext json-c
```
### Windows Prerequisites
On Windows, NFStream build system is based MSYS2. Please follow [**msys2 installation guide**][msys2] before moving to
the next steps.
```bash
pacman -S git unzip mingw-w64-x86_64-toolchain automake1.16 automake-wrapper autoconf libtool make mingw-w64-x86_64-json-c mingw-w64-x86_64-crt-git
```
Note that you will also need to have npcap installed according to [**these instructions**][npcap].
### Build
```bash
git clone --recurse-submodules https://github.com/nfstream/nfstream.git
cd nfstream
python3 -m pip install --upgrade pip
python3 -m pip install -r dev_requirements.txt
python3 -m pip install .
```
### Test it
When you're done making changes, check that your changes pass the tests and add a test if needed:
``` shell
python tests.py
```
* Commit your changes and push your branch to GitHub:
### Commit your changes and push your branch to GitHub:
``` shell
git add .
@ -160,25 +115,22 @@ git commit -m "Your detailed description of your changes."
git push origin name-of-your-bugfix-or-feature
```
7. Submit a pull request through the GitHub website.
### Submit a pull request through the GitHub website.
## Pull request guidelines
Before you submit a pull request, check that it meets these guidelines:
1. The pull request should include tests.
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the examples in README.md.
3. The pull request should work for 3.6 and 3.7 and 3.8 and 3.9 and PyPy3 Check Github Actions and Travis CIs and
* The pull request should include tests.
* If the pull request adds functionality, the docs should be updated. Put your new
functionality into a function with a docstring, and add the feature to the examples in README.md.
* The pull request should work for 3.6 and 3.7 and 3.8 and 3.9 and PyPy3 Check Github Actions and Travis CIs and
make sure all testing jobs are OK.
## Deploying
## Deploy
A reminder for the maintainers on how to deploy.
Make sure all your changes are committed.
A reminder for the maintainers on how to deploy. Make sure all your changes are committed.
Then run:
``` shell
@ -187,4 +139,7 @@ git push
git push --tags
```
Github Actions and Travis will then automatically deploy to PyPI if tests pass.
Github Actions will then automatically deploy to PyPI if tests pass.
[msys2]: https://www.msys2.org/
[npcap]: https://npcap.com/guide/npcap-users-guide.html

View file

@ -153,4 +153,4 @@ def set_affinity(idx):
c_cpus = psutil.cpu_count(logical=True)
temp = list(chunks(range(c_cpus), 2))
x = len(temp)
psutil.Process().cpu_affinity(list(temp[idx%x]))
psutil.Process().cpu_affinity(list(temp[idx % x]))