Skip to content

Commit

Permalink
New version fixing several bugs, especially on Windows platform, addi…
Browse files Browse the repository at this point in the history
…ng tests and github workflow, and adding support for preserving input archives' directory structure in the output directory
  • Loading branch information
sc-anssi committed Mar 14, 2024
1 parent e3d825e commit 7f9439a
Show file tree
Hide file tree
Showing 36 changed files with 1,904 additions and 428 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Python tests

on:
push:
pull_request:

jobs:
test:

runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ruff pytest pytest-cov pytest-console-scripts
python -m pip install -vvv .
- name: Lint with Ruff
run: |
ruff check .
continue-on-error: true
- name: "Test with pytest on ${{ matrix.os }} Python ${{ matrix.python-version }}"
run: |
coverage run -m pytest --log-level INFO
- name: Generate Coverage Report
run: |
coverage report -m
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
build*
.idea
dist
build
*.egg-info
__pycache__
.tox
.coverage
report.xml
coverage.xml
11 changes: 0 additions & 11 deletions Makefile

This file was deleted.

43 changes: 36 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
import os
import shutil
import subprocess
import sys
from pathlib import Path

from setuptools import find_packages
from setuptools import setup
from setuptools.command.build import build
from setuptools.command.install import install

here = Path(__file__).parent.resolve()
build_dir = here / "build"
build_type = "Release"


class MyInstall(install):
class MyBuild(build):
def run(self):
if subprocess.call(["cmake", "-S", ".", "-B", build_dir.resolve()]) != 0:
sys.exit(-1)
if subprocess.call(["cmake", "--build", build_dir.resolve(), "--config", build_type]) != 0:
if (
subprocess.call(
["cmake", "--build", build_dir.resolve(), "--config", build_type]
)
!= 0
):
sys.exit(-1)
# Try to install but ignore errors if permission is denied
subprocess.call(["cmake", "--install", build_dir.resolve(), "--config", build_type])
install.run(self)
return super().run()


class MyInstall(install):
def run(self):
if "VIRTUAL_ENV" in os.environ and sys.platform == "win32":
shutil.copy(
build_dir / build_type / "unstream.exe",
Path(os.environ["VIRTUAL_ENV"]) / "Scripts" / "unstream.exe",
)
return super().run()


setup(
name="anssi-orcdecrypt",
version="4.1",
version="5.3.2",
url="https://github.com/DFIR-ORC/orc-decrypt",
license="LGPL-2.1+",
author="Sebastien Chapiron",
Expand All @@ -36,10 +51,22 @@ def run(self):
install_requires=["cryptography>=0.6"],
packages=find_packages(where="src"),
package_dir={"": "src"},
data_files=[
(
"bin",
[
(
str(build_dir / build_type / "unstream.exe")
if sys.platform == "win32"
else str(build_dir / "unstream")
),
],
),
],
zip_safe=False,
entry_points={
"console_scripts": [
"orc-decrypt=anssi_orcdecrypt.cli:main",
"orc-decrypt=orcdecrypt.cli:entrypoint",
],
},
classifiers=[ # Optional
Expand All @@ -49,11 +76,13 @@ def run(self):
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3 :: Only",
"Operating System :: Unix",
],
python_requires=">=3.8, <4",
cmdclass={
"build": MyBuild,
"install": MyInstall,
},
)
3 changes: 0 additions & 3 deletions src/anssi_orcdecrypt/__init__.py

This file was deleted.

Loading

0 comments on commit 7f9439a

Please sign in to comment.