From 7f4c3eeab5ec96672f632feb5ab2a54c34f2b9b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elo=C3=AFse=20Brocas?= Date: Thu, 30 Nov 2023 10:14:51 +0100 Subject: [PATCH 1/5] [fix] build: remove setup.py and merge it into pyproject.toml Fix building issues with Python 3.11. --- pyproject.toml | 2 ++ setup.py | 38 -------------------------------------- 2 files changed, 2 insertions(+), 38 deletions(-) delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index 264f976..c674d75 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,6 +8,8 @@ version = "0.2.1" description = "Python wrapper to manipulate binexport files (protobuf)" readme = { file = "README.md", content-type = "text/markdown" } authors = [{ name = "Quarkslab", email = "diffing@quarkslab.com" }] +license = {text = "AGPL-3.0"} +requires-python = ">=3.9" dependencies = [ "python-magic", "python-magic-bin; os_name=='nt'", diff --git a/setup.py b/setup.py deleted file mode 100644 index 820c14d..0000000 --- a/setup.py +++ /dev/null @@ -1,38 +0,0 @@ -from setuptools import setup - -with open("README.md") as f: - README = f.read() - - -setup( - name="python-binexport", - version="0.2.1", - description="Python wrapper to manipulate binexport files (protobuf)", - long_description_content_type='text/markdown', - long_description=README, - author="Robin David", - author_email="rdavid@quarkslab.com", - url="https://github.com/quarkslab/python-binexport", - packages=["binexport"], - python_requires=">=3.9", - project_urls={ - "Documentation": "https://quarkslab.github.io/diffing-portal/exporter/binexport.html#python-binexport", - "Bug Tracker": "https://github.com/quarkslab/python-binexport/issues", - "Source": "https://github.com/quarkslab/python-binexport" - }, - install_requires=[ - "python-magic", - "click", - "protobuf", - "networkx", - "enum_tools", - "idascript" - ], - scripts=["bin/binexporter"], - license="AGPL-3.0", - classifiers=[ - 'Topic :: Security', - 'Environment :: Console', - 'Operating System :: OS Independent', - ], -) From 1a59801229075b5acd182b4d16dce42f62436fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elo=C3=AFse=20Brocas?= Date: Thu, 30 Nov 2023 13:30:59 +0100 Subject: [PATCH 2/5] bin: transform binexporter as an entry point Fix build issue from sources with Python 3.11 (do not install binexport and only module). Follow guidelines and recommandations provided by setuptools documentation to insure cross platform compatibility --- pyproject.toml | 4 ++-- bin/binexporter => src/binexport/__main__.py | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename bin/binexporter => src/binexport/__main__.py (100%) diff --git a/pyproject.toml b/pyproject.toml index c674d75..1bc3137 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,8 +31,8 @@ Repository = "https://github.com/quarkslab/python-binexport" Documentation = "https://quarkslab.github.io/diffing-portal/exporter/binexport.html#python-binexport" "Bug Tracker" = "https://github.com/quarkslab/python-binexport/issues" -[tools.setuptools] -script-files = ["bin/binexporter"] +[project.scripts] +binexporter = 'binexport.__main__:main' [tool.black] line-length = 100 diff --git a/bin/binexporter b/src/binexport/__main__.py similarity index 100% rename from bin/binexporter rename to src/binexport/__main__.py From 9c41429814e09c45bfda8b9644edffb4c2cdabd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elo=C3=AFse=20Brocas?= Date: Mon, 11 Dec 2023 09:40:40 +0100 Subject: [PATCH 3/5] ci: patch release workflow --- .github/workflows/release.yml | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b5fccaf..53b63ec 100755 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,8 +5,8 @@ on: types: [published] jobs: - build_wheels: - name: Build wheel + build_wheel_and_sdist: + name: Build wheel and tar.gz runs-on: ubuntu-latest steps: @@ -15,32 +15,20 @@ jobs: with: python-version: '3.10' - name: Install dependencies - run: pip install wheel - - name: Build wheel - run: pip wheel -w wheels . + run: pip install build + - name: Build wheel and sdist + run: python -m buld - uses: actions/upload-artifact@v3 with: name: artifact path: ./wheels/python_binexport*.whl - - build_sdist: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Build sdist - run: | - python -m pip install -U pip build - python -m build --sdist - uses: actions/upload-artifact@v3 with: name: artifact path: dist/*.tar.gz upload_pypi: - needs: [build_wheels, build_sdist] + needs: build_wheel_and_sdist runs-on: ubuntu-latest steps: - uses: actions/download-artifact@v3 From db1a873e62ea4c06c3653e624ee6351596388f6d Mon Sep 17 00:00:00 2001 From: Riccardo Mori Date: Wed, 3 Jan 2024 13:56:35 +0100 Subject: [PATCH 4/5] Fix typo and paths. Upgrade to upload-artifact v4 --- .github/workflows/release.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 53b63ec..f0e0996 100755 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,15 +17,13 @@ jobs: - name: Install dependencies run: pip install build - name: Build wheel and sdist - run: python -m buld - - uses: actions/upload-artifact@v3 + run: python -m build + - uses: actions/upload-artifact@v4 with: name: artifact - path: ./wheels/python_binexport*.whl - - uses: actions/upload-artifact@v3 - with: - name: artifact - path: dist/*.tar.gz + path: | + ./dist/python_binexport*.whl + ./dist/*.tar.gz upload_pypi: needs: build_wheel_and_sdist From 82a8a7ef7cc93f323c58356f265e514ceaec0041 Mon Sep 17 00:00:00 2001 From: Riccardo Mori Date: Wed, 3 Jan 2024 13:56:59 +0100 Subject: [PATCH 5/5] Update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f58a61f..724d4f9 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ __pycache__/ *$py.class build/ +dist/ *.egg-info/ /venv/