Skip to content

Commit

Permalink
Seperate cython bindings into seperate bindings package
Browse files Browse the repository at this point in the history
  • Loading branch information
twizmwazin committed Jul 4, 2024
1 parent f29e4f9 commit f504d54
Show file tree
Hide file tree
Showing 15 changed files with 140 additions and 463 deletions.
79 changes: 6 additions & 73 deletions .github/workflows/CITest.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Run Test
on:
on:
push:
paths-ignore:
- ".gitignore"
- "docs/**"
- "ChangeLog"
- "ChangeLog"
- "CREDITS.TXT"
- "COMPILE.TXT"
- "COMPILE_MSVC.TXT"
Expand All @@ -30,85 +30,30 @@ jobs:
matrix:
config:
- {
name: 'ubuntu-22.04 x64 python3.9 make',
name: 'ubuntu-22.04 x64 make',
os: ubuntu-22.04,
arch: x64,
python-arch: x64,
python-version: '3.9',
build-system: 'make',
enable-asan: 'OFF'
}
- {
name: 'ubuntu-22.04 x64 python3.7 cmake',
name: 'ubuntu-22.04 x64 cmake',
os: ubuntu-22.04,
arch: x64,
python-arch: x64,
python-version: '3.7',
build-system: 'cmake',
enable-asan: 'OFF'
}
- {
name: 'ubuntu-22.04 x64 python3.8 cmake',
os: ubuntu-22.04,
arch: x64,
python-arch: x64,
python-version: '3.8',
build-system: 'cmake',
enable-asan: 'OFF'
}
- {
name: 'ubuntu-22.04 x64 python3.9 cmake',
os: ubuntu-22.04,
arch: x64,
python-arch: x64,
python-version: '3.9',
build-system: 'cmake',
enable-asan: 'OFF'
}
- {
name: 'ubuntu-22.04 x64 python3.10 cmake',
os: ubuntu-22.04,
arch: x64,
python-arch: x64,
python-version: '3.10',
build-system: 'cmake',
enable-asan: 'OFF'
}
- {
name: 'ubuntu-22.04 x64 python3.11 cmake',
os: ubuntu-22.04,
arch: x64,
python-arch: x64,
python-version: '3.11',
build-system: 'cmake',
enable-asan: 'OFF'
}
- {
name: 'ubuntu-22.04 x64 python3.11 ASAN',
name: 'ubuntu-22.04 x64 ASAN',
os: ubuntu-latest,
arch: x64,
python-arch: x64,
python-version: '3.11',
build-system: 'cmake',
enable-asan: 'ON'
}
- {
name: 'ubuntu-22.04 x64 python3.12 cmake',
os: ubuntu-22.04,
arch: x64,
python-arch: x64,
python-version: '3.12',
build-system: 'cmake',
}

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.config.python-version }}

- name: prepare
run: |
export LD_LIBRARY_PATH=`pwd`/tests/:$LD_LIBRARY_PATH
Expand All @@ -117,8 +62,6 @@ jobs:
git clone https://git.cryptomilk.org/projects/cmocka.git suite/cstest/cmocka
chmod +x suite/cstest/build_cstest.sh
pip install "importlib_resources;python_version<'3.9'"
- name: make
if: startsWith(matrix.config.build-system, 'make')
run: |
Expand Down Expand Up @@ -182,16 +125,6 @@ jobs:
python cstest_report.py -D -t build/cstest -f ../../tests/cs_details/issue.cs
cd ../../
- name: run cython binding test
if: matrix.config.enable-asan == 'OFF'
run: |
pip install cython
cd bindings/python
make install_cython
cd ..
python -c "import capstone;print(capstone.debug())" | grep Cython
BUILD_TESTS=no make tests
Windows:
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }}
Expand All @@ -214,7 +147,7 @@ jobs:

- name: '🛠️ Win MSVC 64 setup'
if: contains(matrix.config.name, 'MSVC 64')
uses: ilammy/msvc-dev-cmd@v1
uses: ilammy/msvc-dev-cmd@v1
with:
arch: 'x64'

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
matrix:
os: [ubuntu-24.04, windows-2022, macOS-14]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
bindings: [python, cython]

steps:
- uses: actions/checkout@v4
Expand All @@ -26,8 +27,7 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1

- name: Build and install capstone
run: pip install ./bindings/python
run: pip install ./bindings/${{ matrix.bindings }}

- name: Run tests
run: python test_all.py
working-directory: ./bindings/python/tests
run: python ./bindings/${{ matrix.bindings }}/test_all.py
9 changes: 9 additions & 0 deletions bindings/cython/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MANIFEST
dist/
src/
capstone/lib
capstone/include
pyx/lib
pyx/include
pyx/*.c
pyx/*.pyx
1 change: 1 addition & 0 deletions bindings/cython/capstone
12 changes: 12 additions & 0 deletions bindings/cython/capstone.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Metadata-Version: 2.1
Name: capstone
Version: 5.0.0.post1
Summary: Capstone disassembly engine
Home-page: https://www.capstone-engine.org
Author: Nguyen Anh Quynh
Author-email: [email protected]
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Provides: capstone
102 changes: 102 additions & 0 deletions bindings/cython/capstone.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
pyproject.toml
setup.py
capstone.egg-info/PKG-INFO
capstone.egg-info/SOURCES.txt
capstone.egg-info/dependency_links.txt
capstone.egg-info/top_level.txt
pyx/__init__.py
pyx/aarch64.pyx
pyx/aarch64_const.pyx
pyx/alpha.pyx
pyx/alpha_const.pyx
pyx/arm.pyx
pyx/arm_const.pyx
pyx/bpf.pyx
pyx/bpf_const.pyx
pyx/ccapstone.pyx
pyx/evm.pyx
pyx/evm_const.pyx
pyx/hppa.pyx
pyx/hppa_const.pyx
pyx/m680x.pyx
pyx/m680x_const.pyx
pyx/m68k.pyx
pyx/m68k_const.pyx
pyx/mips.pyx
pyx/mips_const.pyx
pyx/mos65xx.pyx
pyx/mos65xx_const.pyx
pyx/ppc.pyx
pyx/ppc_const.pyx
pyx/riscv.pyx
pyx/riscv_const.pyx
pyx/sh.pyx
pyx/sh_const.pyx
pyx/sparc.pyx
pyx/sparc_const.pyx
pyx/systemz.pyx
pyx/sysz_const.pyx
pyx/tms320c64x.pyx
pyx/tms320c64x_const.pyx
pyx/tricore.pyx
pyx/tricore_const.pyx
pyx/wasm.pyx
pyx/wasm_const.pyx
pyx/x86.pyx
pyx/x86_const.pyx
pyx/xcore.pyx
pyx/xcore_const.pyx
pyx/include/capstone/aarch64.h
pyx/include/capstone/alpha.h
pyx/include/capstone/arm.h
pyx/include/capstone/arm64.h
pyx/include/capstone/bpf.h
pyx/include/capstone/capstone.h
pyx/include/capstone/cs_operand.h
pyx/include/capstone/evm.h
pyx/include/capstone/hppa.h
pyx/include/capstone/loongarch.h
pyx/include/capstone/m680x.h
pyx/include/capstone/m68k.h
pyx/include/capstone/mips.h
pyx/include/capstone/mos65xx.h
pyx/include/capstone/platform.h
pyx/include/capstone/ppc.h
pyx/include/capstone/riscv.h
pyx/include/capstone/sh.h
pyx/include/capstone/sparc.h
pyx/include/capstone/systemz.h
pyx/include/capstone/tms320c64x.h
pyx/include/capstone/tricore.h
pyx/include/capstone/wasm.h
pyx/include/capstone/x86.h
pyx/include/capstone/xcore.h
pyx/lib/libcapstone.a
pyx/lib/libcapstone.dylib
tests/test_aarch64.py
tests/test_all.py
tests/test_alpha.py
tests/test_arm.py
tests/test_basic.py
tests/test_bpf.py
tests/test_customized_mnem.py
tests/test_detail.py
tests/test_evm.py
tests/test_hppa.py
tests/test_iter.py
tests/test_lite.py
tests/test_m680x.py
tests/test_m68k.py
tests/test_mips.py
tests/test_mos65xx.py
tests/test_ppc.py
tests/test_riscv.py
tests/test_sh.py
tests/test_skipdata.py
tests/test_sparc.py
tests/test_systemz.py
tests/test_tms320c64x.py
tests/test_tricore.py
tests/test_wasm.py
tests/test_x86.py
tests/test_xcore.py
1 change: 1 addition & 0 deletions bindings/cython/capstone.egg-info/dependency_links.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions bindings/cython/capstone.egg-info/top_level.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
capstone
3 changes: 3 additions & 0 deletions bindings/cython/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "cython"]
build-backend = "setuptools.build_meta"
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions bindings/cython/tests
2 changes: 1 addition & 1 deletion bindings/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
Loading

0 comments on commit f504d54

Please sign in to comment.