Commit Graph

152 Commits

Author SHA1 Message Date
@Antelox 6ad2608dcb
Python package building rework (#2538)
* - Refactored setup.py to remove hacks regarding packaging of wheels for different platforms, improve and cleanup the code
- Updated README.txt
- Removed old Makefile and build_wheel.sh scripts
- Created a new workflow that takes care of building and testing python packages for different platforms/architectures/python versions

* Added SPDX headers to the setup.py

* - cstest_py: Fixed positional argument since it doesn't accept a `required` flag. It turns to have a mandatory tests folder path
- integration_tests.py: Use pathlib to determine the required path
- GitHub action: Simplified the tests execution command

* GitHub Actions: Run python 3.8 (lowest) and 3.13 (current highest) for native runners only during testings and the rest during tag release

* GitHub Action:
- Fixed the cibw_build matrix element
- Added a step to prepare artifact name

* GitHub Action: Added run_tests.py script to run all tests during CI workflow

* - Added SPDX headers to the run_tests.py script and to the build-wheels-publish.yml workflow file
- Minor fixes to the workflow as pointed out in the PR review
- Updated MANIFEST.in to reflect the actual libraries built during python wheel creation process
- Use subprocess.run in place of os.system in run_tests.py script

* GitHub Action:
- Run qemu step only if non-native Linux runner
- Added arch:universal2 matrix element for macos-latest runner

* Python bindings: Refreshed the list of files needed to be copied for sdist archive

* GitHub Action: Commented out arch:x86 matrix elements

* GitHub Action: Run qemu step only if non-native Linux runner

* GitHub Action: Minor fixes

* Python bindings: Added missing .in pattern when collecting src files for sdist archive
2024-11-18 19:10:27 +08:00
Rot127 379e2a4114
Rename build arguments: (#2534)
- BUILD_SHARED_LIBS -> CAPSTONE_BUILD_SHARED_LIBS
- BUILD_STATIC_LIBS -> CAPSTONE_BUILD_STATIC_LIBS
- BUILD_STATIC_LIBS -> CAPSTONE_BUILD_STATIC_MSVC_RUNTIME
2024-11-09 15:05:30 +08:00
Andrew d7be5f9f9f
Change CI to create Debian Package to Release (#2521)
* Updating CI to create Debian package and version is assigned by tag
version. Also updating release CI to not use end-of-life workflows

* Clear up usage of static libraries.

- Python bindings only use the dynamic lib. But built and copied the static ones sometimes nonetheless.
- Add toggles to build only static, static/dyn or only dynamic.

---------

Co-authored-by: Rot127 <unisono@quyllur.org>
2024-11-04 20:32:53 +08:00
Rot127 191db14531
Modern Testing (#2456) 2024-08-31 21:33:38 +08:00
Rot127 42d3acf5ec
[next] Wheel build fixes: manylinux1, trigger upload on release, Linux AArch64... (#2444)
* Add AArch64 linux build again.

* Enable package build also for PRs and pushes.

* Fix: don't append python version to injected platform name.

* Add musllinux build to wheel checking script

* Trigger wheel upload only on published full-releases.

* Remove duplicate workflow file

* Ensure all artifacts are moved to the same directory 'dist'

* Enable verbose twine upload.

* Add step to show downloaded artifacts for debugging.
2024-08-19 16:33:08 +08:00
Rot127 5e6807bab9
[next] Updates and fixes to the Python wheel builder workflow (#2441) 2024-08-15 20:57:23 +08:00
Kevin Phoenix 8ddb2b971f Update setup.py to reflect minimum python 3.8 2024-07-16 12:26:15 -07:00
Kevin Phoenix 19ce4baaf5 Disable zip_safe 2024-07-15 12:14:03 -07:00
Kevin Phoenix f23d862b03 Use importlib_resources on python<3.9 2024-07-15 12:14:03 -07:00
Pyrox b555844526 Remove distutils
Removes distutils from the setup.py script for the python bindings, as
it is removed in Python 3.12 onwards.
2024-07-15 12:14:03 -07:00
Kevin Phoenix 8ce088bf58
Python2 leftovers v2 (#2395)
* Remove python2 leftovers
* Remove python2 references from BUILDING.txt
* Remove some leftover install3 references
* Update shebangs to python3
* Delete suite/test_corpus.py
2024-07-01 14:10:12 +08:00
Wu ChenXu a3fd6ac3a4
Revert "Remove python2 leftovers (#2378)" (#2391)
This reverts commit 60d5b7ec2f.
2024-06-24 16:42:27 +08:00
Rot127 1adc45f265
Use python3 as default interpreter for all python scripts (#2390) 2024-06-19 18:52:51 +08:00
Kevin Phoenix 60d5b7ec2f
Remove python2 leftovers (#2378)
* Remove python2 leftovers

* Remove python2 references from BUILDING.txt

* Remove some leftover install3 references
2024-06-09 17:29:50 +08:00
Rot127 7746648f0b
[Auto-Sync] LLVM 18 update (#2296)
Refactor auto-sync updater

This refactors the auto-sync updater scripts, adds multiple tests and some other smaller things:

- Converts the updater in a proper Python package.
- Renaming was done to fit this new package structure.
- Format code with usort and black and enforce it with the CI.
- Add license information to auto-sync scripts.
- Update tree-sitter-cpp to v20.0.5
- Fix py-tree-sitter version to `< 0.22.0` due to https://github.com/tree-sitter/tree-sitter-cpp/issues/250
- Allow file/dir creation of non existing paths.
- Add CI tests for Patch, inc gen, translation and diff persistence testing.
- Implement editing of diffs with an editor.
- Fix: Add Namespace id also to anonymous enumeration members.
2024-04-22 11:55:44 +08:00
Rick Mark a554a1dfb8
By default compile as universal2 for macOS (#2221) 2024-01-12 10:05:45 +08:00
peace-maker e00a210a3d Test Python bindings in CI (#2161) 2023-09-15 14:35:09 +08:00
Anton Kochkov d3a0e7ff99 ci: use cibuildwheel for python wheels (#2099)
* ci: use cibuildwheel for python wheels

* fix several issues

* fix setup.py

* fix issue

* Compatible with python2

* fix str

* trigger ci

---------

Co-authored-by: kabeor <kabeor00@gmail.com>
2023-07-21 23:15:46 +08:00
Rot127 102a6bdc28 Bumb manylinux version to 2014 (x86) and 2_28 (x86_64) repectivly.
manylinux1 is EOL since 2 years. Just like Python 3.6
Fixes wheel build.
2023-07-19 11:13:25 -05:00
Peace-Maker 68c8943e32 Normalize rc4 version string
/usr/local/lib/python2.7/dist-packages/setuptools/dist.py:476: UserWarning: Normalizing '5.0.0.rc4' to '5.0.0rc4'
  normalized_version,
2023-06-28 18:31:41 +02:00
kabeor 4d423560df [bindings] Adapt python2 for setup.py 2023-06-18 19:38:22 +08:00
kabeor fd6832ce4b [bindings] fix twine issue when publish 2023-06-18 18:48:07 +08:00
kabeor 2c5074af63 [bindings] fix twine issue when publish 2023-06-18 18:44:46 +08:00
John Ott 9f727d495f Remove outdated ctypes requirement
The library ctypes has shipped with the python standard library since
Python 2.5, however this was still added via the `requires` keyword in
setuptools.setup. This results in a spurious requirement being created
in the .whl METADATA file, causing warnings when packaged via tools like
pex:

```
$ python3 -m pex capstone -o capstone.pex
/Users/ott/.venv/lib/python3.9/site-packages/pex/dist_metadata.py:397: PEXWarning: Ignoring 1 `Requires` field in /Users/ott/.pex/installed_wheels/2a4c7a0d4c87aceed3134ae20997a764af1811fee8e151cf5da90e0462822893/capstone-4.0.2-py3-none-macosx_12_arm64.whl metadata:
1.) Requires: ctypes

You may have issues using the 'capstone' distribution as a result.
More information on this workaround can be found here:
  https://github.com/pantsbuild/pex/issues/1201#issuecomment-791715585
```

Since this requirement is outdated, it can just be removed.
2022-08-24 11:29:48 -07:00
kabeor 2b05b8ef94 replace missing option CMAKE_BUILD_SHARED for python setup.py 2022-02-28 00:01:09 +08:00
Duncan Ogilvie f4d86a3034 Modernize CMake and switch to CMake 3.15 2022-02-25 20:39:30 +01:00
Nguyen Anh Quynh 4e13196da8 python: classifier Python3 for setup.py 2020-01-26 13:26:58 +08:00
Benno Fünfstück 08ca4fa4bb bindings/python: fix install error due to old libname (#1338) 2019-01-11 00:10:25 +08:00
Hugo 633050764d Add python_requires and update Trove classifiers (#1251) 2018-10-02 17:45:45 +08:00
Nguyen Anh Quynh 76c1c3c4e9 merge next to master 2018-07-20 12:36:50 +08:00
Audrey Dutcher f32a63b03b Add option for inhibiting the core build while installing the python components. Add option for loading the core from a custom path. (#1089) 2018-02-20 21:12:46 +08:00
Audrey Dutcher 10c4aa807d Add option for inhibiting the core build while installing the python components. Add option for loading the core from a custom path. (#1089) 2018-02-20 21:11:19 +08:00
Nguyen Anh Quynh e9394bba5c python: cleanup 2018-01-15 13:42:00 +08:00
tdube e1aaa50a5b python: fix merge confliction of #1073 2018-01-15 13:34:13 +08:00
tdube 1a1077db01 Update setup.py (#1073)
Check to make sure static library file exists before trying to copy it. Current build options include option to not build a static lib.
2018-01-15 13:30:51 +08:00
Andrew Dutcher 425bf530f2 Add ability to copy prebuilt libraries from prebuilt directory during python build 2017-03-04 17:09:07 -08:00
Andrew Dutcher 6e95167865 Add ability to copy prebuilt libraries from prebuilt directory during python build 2017-03-05 06:08:36 +08:00
Nguyen Anh Quynh 617c64fbb5 Python: Automatically conform to PEP440 for version numbers. ported from Unicorn Python binding 2017-02-01 13:23:15 +08:00
Nguyen Anh Quynh 3925b332ce Python: Automatically conform to PEP440 for version numbers. ported from Unicorn Python binding 2017-02-01 13:11:21 +08:00
Nguyen Anh Quynh f1aa0a3d04 python: version 4.0.0 2016-11-04 23:55:20 +08:00
Andrew Dutcher 2f1c3ce8a6 On this branch, dylib and so files are versioned 2016-10-31 10:54:58 -07:00
Andrew Dutcher b2504b963e Python setup: Clean up some merge failures, adapt for changes on next branch 2016-10-26 23:15:42 -07:00
Andrew Dutcher 06b26efbf4 Python: remove special case for cygwin build 2016-10-25 21:49:58 -07:00
Andrew Dutcher 816f131d27 Python: Make cython work with extreme prejudice 2016-10-25 21:49:58 -07:00
Andrew Dutcher 1008716ee5 Python: Clean up the capstone-windows stuff with extreme prejudice 2016-10-25 21:48:41 -07:00
Andrew Dutcher 3b5b5ff58c Python: make setup work as expected 2016-10-25 21:48:18 -07:00
Nguyen Anh Quynh 3bd582ef64 python: bump version to 3.0.5 2016-10-26 10:52:53 +08:00
Andrew Dutcher 0532314562 Python: remove special case for cygwin build 2016-10-21 03:30:53 -07:00
Andrew Dutcher ac5121c7e0 Python: Make cython work with extreme prejudice 2016-10-21 03:30:50 -07:00
Andrew Dutcher ad36604b55 Python: Clean up the capstone-windows stuff with extreme prejudice 2016-10-21 03:30:44 -07:00