Skip to content

Commit c2facda

Browse files
authored
Switch to poetry build system (#687)
1 parent 124868d commit c2facda

File tree

13 files changed

+150
-160
lines changed

13 files changed

+150
-160
lines changed

.github/workflows/deploy.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@ jobs:
1717
- name: Install dependencies
1818
run: |
1919
python -m pip install --upgrade pip
20-
pip install setuptools wheel twine
20+
pip install poetry
2121
- name: Build and publish
22-
env:
23-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
24-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
2522
run: |
26-
python setup.py sdist bdist_wheel
27-
twine upload dist/*
23+
poetry publish --build -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ ENV/
4848
env.bak/
4949
venv.bak/
5050
Pipfile
51+
poetry.lock
5152

5253
# Sphinx documentation
5354
docs/_build/

CHANGELOG.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ Fixes
1616
- Specified encoding on file write rather than assuming default encoding
1717
- Changed type of `default_value` from string to bytes for `FromFile`.
1818
- `s_update` primitive was out of date.
19-
- The minimum supported Python version is now 3.7.
19+
- The minimum supported Python version is now 3.8.
2020
- Removed duplicates from `BitField` primitive.
2121
- Fixed unwanted deprecation warning when using `Session.fuzz(name=name)`.
2222
- Changed type of `dep_value` argument of `Block` to bytes and added type checks.
2323
- Split sessions.py into multiple files.
24+
- Using poetry as package build system.
2425

2526
v0.4.1
2627
------

CONTRIBUTING.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ See installation instructions for details on installing boofuzz from source with
1818
Pull Request Checklist
1919
----------------------
2020

21-
1. Install python version 3.7+
21+
1. Install python version 3.8+
2222

2323
2. Verify tests pass:
2424

@@ -75,7 +75,7 @@ Prep
7575

7676
2. Increment version number from last release according to PEP 0440 and roughly according to the Semantic Versioning guidelines.
7777

78-
1. In ``boofuzz/__init__.py``.
78+
1. In ``pyproject.toml``.
7979

8080
2. In ``docs/conf.py``.
8181

INSTALL.rst

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,38 @@ environment beforehand.
5858

5959
From Source
6060
-----------
61-
62-
6361
1. Like above, it is recommended to set up a virtual environment. Depending on your
6462
concrete setup, this is largely equivalent to the steps outlined above. Make sure
65-
to upgrade ``setuptools`` and ``pip``.
63+
to upgrade ``setuptools`` and ``pip`` or ``poetry``.
6664
2. Download the source code. You can either grab a zip from https://github.com/jtpereyda/boofuzz
6765
or directly clone it with git:
6866

6967
.. code-block:: bash
7068
7169
$ git clone https://github.com/jtpereyda/boofuzz.git
7270
73-
3. Install. Run ``pip`` from within the boofuzz directory after activating the virtual
74-
environment:
71+
Install with Poetry
72+
~~~~~~~~~~~~~~~~~~~
73+
Poetry will automatically create a virtual environment for you and install the required dependencies. The installation
74+
will be editable by default, meaning that changes to the source code will be seen directly without reinstalling.
75+
76+
Simply execute the following command inside the boofuzz source dir:
77+
78+
.. code-block:: bash
79+
80+
$ poetry install
81+
82+
To install with extra dependencies like `dev` or `docs`, specify them in one of the following ways:
83+
84+
.. code-block:: bash
85+
86+
$ poetry install --extras "dev"
87+
$ poetry install -E docs
88+
$ poetry install --all-extras
89+
90+
Install with Pip
91+
~~~~~~~~~~~~~~~~
92+
Run ``pip`` from within the boofuzz directory after activating the virtual environment:
7593

7694
.. code-block:: bash
7795

MANIFEST.in

Lines changed: 0 additions & 14 deletions
This file was deleted.

boofuzz/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@
187187
"Word",
188188
]
189189

190-
__version__ = "0.4.1"
191-
192190

193191
# REQUEST MANAGEMENT
194192
def s_get(name=None):

boofuzz/fuzz_logger_curses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def __init__(
106106
self._current_num_mutations = 0
107107

108108
self._format_raw_bytes = bytes_to_str
109-
self._version = helpers.get_boofuzz_version(helpers)
109+
self._version = helpers.get_boofuzz_version()
110110

111111
# Resize console to minimum size
112112
self._width, self._height = get_terminal_size()

boofuzz/helpers.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import errno
2+
import importlib.metadata
23
import os
34
import re
45
import signal
@@ -424,22 +425,14 @@ def path_exists(path):
424425
return os.path.exists(path)
425426

426427

427-
def get_boofuzz_version(boofuzz_class):
428+
def get_boofuzz_version():
428429
"""
429-
Parses __init__.py for a version string and returns it like 'v0.0.0'
430-
431-
:type boofuzz_class: class
432-
:param boofuzz_class: Any boofuzz class in the same dir as the __init__ class.
430+
Gets the currently installed boofuzz version
433431
434432
:rtype: str
435433
:return: Boofuzz version as string
436434
"""
437-
path = os.path.dirname(boofuzz_class.__file__)
438-
with open(os.path.join(path, "__init__.py")) as search:
439-
for line in search:
440-
if line.find("__version__ = ") != -1:
441-
return "v" + re.search(r'"(.*?)"', line).group(1) # pytype: disable=attribute-error
442-
return "v-.-.-"
435+
return "v" + importlib.metadata.version("boofuzz")
443436

444437

445438
def str_to_bytes(value, encoding="utf-8", errors="replace"):

pyproject.toml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,116 @@
1+
[tool.poetry]
2+
name = "boofuzz"
3+
version = "0.4.1"
4+
description = "A fork and successor of the Sulley Fuzzing Framework"
5+
authors = ["Joshua Pereyda <joshua.t.pereyda@gmail.com>"]
6+
license = "GPL-2.0-only"
7+
readme = ["README.rst", "CHANGELOG.rst"]
8+
repository = "https://github.com/jtpereyda/boofuzz"
9+
documentation = "https://boofuzz.readthedocs.io/"
10+
keywords = ["security", "fuzzing"]
11+
classifiers = [
12+
"Development Status :: 4 - Beta",
13+
"Environment :: Console",
14+
"Environment :: Console :: Curses",
15+
"Intended Audience :: Developers",
16+
"Intended Audience :: Science/Research",
17+
"Natural Language :: English",
18+
"Operating System :: OS Independent",
19+
"Topic :: Security",
20+
"Topic :: System :: Networking",
21+
"Topic :: Software Development :: Testing :: Traffic Generation",
22+
]
23+
24+
include = [
25+
{ path = "*.py", format = "sdist" },
26+
{ path = "*.rst", format = "sdist" },
27+
{ path = "*.toml", format = "sdist" },
28+
{ path = "*.txt", format = "sdist" },
29+
{ path = "tox.ini", format = "sdist" },
30+
{ path = "_static", format = "sdist" },
31+
{ path = "artwork", format = "sdist" },
32+
{ path = "docs", format = "sdist" },
33+
{ path = "examples", format = "sdist" },
34+
{ path = "request_definitions", format = "sdist" },
35+
{ path = "unit_tests", format = "sdist" },
36+
{ path = "utils", format = "sdist" },
37+
]
38+
39+
[tool.poetry.dependencies]
40+
attrs = "*"
41+
click = "*"
42+
colorama = "*"
43+
Flask = "*"
44+
funcy = "*"
45+
psutil = "*"
46+
pydot = "*"
47+
pyserial = "*"
48+
python = "^3.8"
49+
tornado = "*"
50+
51+
# dev extras
52+
black = { version = "*", optional = true }
53+
flake8 = { version = "*", optional = true }
54+
ipaddress = { version = "*", optional = true }
55+
mock = { version = "*", optional = true }
56+
netifaces = { version = "*", optional = true }
57+
pytest = { version = "*", optional = true }
58+
pytest-bdd = { version = "*", optional = true }
59+
pytest-cov = { version = "*", optional = true }
60+
tox = { version = "*", optional = true }
61+
wheel = { version = "*", optional = true }
62+
63+
# docs extras
64+
pygments = { version = ">=2.4.0", optional = true }
65+
sphinx = { version = "*", optional = true }
66+
sphinx_rtd_theme = { version = "*", optional = true }
67+
68+
[tool.poetry.extras]
69+
dev = [
70+
"black",
71+
"flake8",
72+
"ipaddress",
73+
"mock",
74+
"netifaces",
75+
"pygments",
76+
"pytest",
77+
"pytest-bdd",
78+
"pytest-cov",
79+
"sphinx",
80+
"sphinx_rtd_theme",
81+
"tox",
82+
"wheel",
83+
]
84+
docs = [
85+
"sphinx",
86+
"sphinx_rtd_theme",
87+
"pygments",
88+
]
89+
90+
[tool.poetry.scripts]
91+
boo = 'boofuzz.cli:main'
92+
93+
[build-system]
94+
requires = ["poetry-core>=1.0.0"]
95+
build-backend = "poetry.core.masonry.api"
96+
197
[tool.black]
298
line-length = 120
99+
100+
[tool.pytest.ini_options]
101+
testpaths = ["unit_tests"]
102+
filterwarnings = [
103+
"ignore:SocketConnection is deprecated:FutureWarning",
104+
]
105+
106+
[tool.pytype]
107+
disable = [
108+
"import-error",
109+
]
110+
exclude = [
111+
"**/ida_fuzz_library_extender.py",
112+
"examples/*.py",
113+
"**/*_test_*.py",
114+
"request_definitions/*.py",
115+
"utils/*.py",
116+
]

0 commit comments

Comments
 (0)