Skip to content

Commit 53e5816

Browse files
authored
Merge pull request #45 from CAPESandbox/pyproject
pyproject
2 parents cde75ce + 77aee6d commit 53e5816

File tree

7 files changed

+522
-94
lines changed

7 files changed

+522
-94
lines changed
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: 'Python setup steps that can be reused'
2+
description: 'Install dependencies, poetry, requirements'
3+
inputs:
4+
python-version:
5+
required: true
6+
description: The python version
7+
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Install dependencies
12+
if: ${{ runner.os == 'Linux' }}
13+
shell: bash
14+
run: |
15+
sudo apt update && sudo apt-get install -y --no-install-recommends libxml2-dev libxslt-dev python3-dev libgeoip-dev ssdeep libfuzzy-dev zpaq p7zip-full rar unace-nonfree cabextract lzip libjpeg8-dev zlib1g-dev gnupg
16+
17+
- name: Install poetry
18+
shell: bash
19+
run: pip install poetry
20+
21+
- name: Set up Python ${{ inputs.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ inputs.python-version }}
25+
cache: 'poetry'
26+
27+
- name: Install requirements
28+
shell: bash
29+
run: |
30+
poetry install --no-interaction --no-root
31+

.github/workflows/pythonpackage.yml

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
name: build
22

3+
env:
4+
COLUMNS: 132
5+
36
on: [push, pull_request]
47

58
jobs:
6-
tester:
7-
name: Test them all
8-
runs-on: ${{ matrix.operating-system }}
9+
test:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 20
912
strategy:
10-
max-parallel: 4
1113
matrix:
12-
operating-system: [ubuntu-latest]
1314
python-version: ["3.10", "3.11"]
14-
1515
steps:
16-
- uses: actions/checkout@v3
17-
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v4
19-
with:
20-
python-version: ${{ matrix.python-version }}
21-
- name: Install dependencies
22-
run: |
23-
sudo apt-get install zpaq p7zip-full rar unace-nonfree cabextract lzip libjpeg8-dev zlib1g-dev gnupg
24-
python -m pip install --upgrade pip
25-
pip install pytest>=3.6 mock "pytest-cov<2.6.0" codecov
26-
pip install -e ".[shellcode]"
27-
- name: Test with pytest
28-
run: |
29-
pip install pytest
30-
pytest
16+
- name: Check out repository code
17+
uses: actions/checkout@v4
18+
19+
- uses: ./.github/actions/python-setup/
20+
with:
21+
python-version: ${{ matrix.python-version }}
22+
23+
- name: Install dependencies
24+
run: |
25+
poetry run pip install "pytest-cov<2.6.0" codecov
26+
poetry run pip install -e ".[shellcode,dev,linux]"
27+
28+
- name: Run unit tests
29+
run: poetry run python -m pytest --import-mode=append
30+

poetry.lock

+421
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
[tool.poetry]
3+
name = "SFlock2"
4+
version = "0.3.64"
5+
description = "Sample staging and detonation utility"
6+
readme = "README.md"
7+
license = "GPLv3"
8+
include = ["sflock/**"]
9+
keywords = [ "sflock", "unarchive"]
10+
authors = ["Hatching B.V. <[email protected]>"]
11+
12+
packages = [{ include = "sflock" }]
13+
14+
[tool.poetry.dependencies]
15+
python = ">=3.8,<4.0"
16+
click = "*"
17+
cryptography = ">=2.1"
18+
olefile = ">=0.43"
19+
pefile = "*"
20+
python-magic-bin = {version = ">=0.4.14", markers = "sys_platform == 'win32'" }
21+
python-magic = {version = ">=0.4.13", markers = "sys_platform == 'linux'" }
22+
23+
unicorn = {version = ">=2.0.0", optional = true }
24+
yara-python = {version = ">=4.1.0", optional = true }
25+
26+
mock = {version = ">=5.1.0", optional = true }
27+
pytest = {version = ">=8.2.2", optional = true }
28+
29+
[tool.distutils.bdist_wheel]
30+
universal = true
31+
32+
[tool.poetry.extras]
33+
shellcode = ["unicorn", "yara-python"]
34+
dev = ["mock", "pytest"]
35+
win32 = ["python-magic-bin"]
36+
linux = ["python-magic"]
37+
38+
[tool.poetry.scripts]
39+
sflock = "sflock.main:main"
40+
41+
[build-system]
42+
requires = ["poetry-core>=1.0.0"]
43+
build-backend = "poetry.core.masonry.api"
44+
45+
[tool.setuptools]
46+
include-package-data = false
47+
48+
[tool.setuptools.packages.find]
49+
exclude = ["docs*", "tests*"]

setup.py

-70
This file was deleted.

sflock/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@
55
import magic
66
from sflock.exception import UnpackException
77
from sflock.main import ident, unpack, supported, zipify
8-
from sflock.__version__ import __version__

sflock/__version__.py

-2
This file was deleted.

0 commit comments

Comments
 (0)