Skip to content

Commit 828096c

Browse files
committed
Attempt at Python packaging
1 parent 621572f commit 828096c

File tree

598 files changed

+255445
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

598 files changed

+255445
-141
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python/Ghidra/** linguist-generated

.github/workflows/CI.yml

Lines changed: 104 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,124 @@
1-
# This file is autogenerated by maturin v1.0.1
2-
# To update, run
3-
#
4-
# maturin generate-ci github
5-
#
61
name: CI
72

8-
on:
9-
push:
10-
branches:
11-
- main
12-
- master
13-
tags:
14-
- '*'
15-
pull_request:
16-
workflow_dispatch:
17-
18-
permissions:
19-
contents: read
3+
on: [push, pull_request]
204

215
jobs:
22-
linux:
23-
runs-on: ubuntu-latest
24-
strategy:
25-
matrix:
26-
target: [x86_64, aarch64]
27-
steps:
28-
- uses: actions/checkout@v3
29-
with:
30-
submodules: 'true'
31-
- uses: actions/setup-python@v4
32-
with:
33-
python-version: '3.10'
34-
- name: Build wheels
35-
uses: PyO3/maturin-action@v1
36-
with:
37-
target: ${{ matrix.target }}
38-
args: --release --out dist --find-interpreter
39-
sccache: 'true'
40-
manylinux: auto
41-
- name: Upload wheels
42-
uses: actions/upload-artifact@v3
43-
with:
44-
name: wheels
45-
path: dist
6+
# linux:
7+
# runs-on: ubuntu-latest
8+
# strategy:
9+
# matrix:
10+
# target: [x86_64, aarch64]
11+
# steps:
12+
# - uses: actions/checkout@v3
13+
# with:
14+
# submodules: 'true'
15+
16+
# - uses: actions/setup-python@v4
17+
# with:
18+
# python-version: '3.10'
19+
20+
# - name: Install Rust toolchain
21+
# uses: dtolnay/rust-toolchain@stable
22+
# with:
23+
# targets: aarch64-linux-gnu, x86-64-linux-gnu
4624

47-
windows:
48-
runs-on: windows-latest
49-
strategy:
50-
matrix:
51-
target: [x64]
52-
steps:
53-
- uses: actions/checkout@v3
54-
with:
55-
submodules: 'true'
56-
- uses: actions/setup-python@v4
57-
with:
58-
python-version: '3.10'
59-
architecture: ${{ matrix.target }}
60-
- name: Build wheels
61-
uses: PyO3/maturin-action@v1
62-
with:
63-
target: ${{ matrix.target }}
64-
args: --release --out dist --find-interpreter
65-
sccache: 'true'
66-
- name: Upload wheels
67-
uses: actions/upload-artifact@v3
68-
with:
69-
name: wheels
70-
path: dist
25+
# - name: Install Rust aarch64-apple-darwin target
26+
# if: matrix.platform.os == 'macos-latest'
27+
# run: rustup target add aarch64-apple-darwin
28+
29+
# - name: Upload wheels
30+
# uses: actions/upload-artifact@v3
31+
# with:
32+
# name: wheels
33+
# path: dist
34+
35+
# windows:
36+
# runs-on: windows-latest
37+
# strategy:
38+
# matrix:
39+
# target: [x64]
40+
# steps:
41+
# - uses: actions/checkout@v3
42+
# with:
43+
# submodules: 'true'
44+
45+
# - uses: actions/setup-python@v4
46+
# with:
47+
# python-version: '3.10'
48+
# architecture: ${{ matrix.target }}
49+
50+
# - name: Build wheels
51+
# uses: PyO3/maturin-action@v1
52+
# with:
53+
# target: ${{ matrix.target }}
54+
# args: --release --out dist --find-interpreter
55+
# sccache: 'true'
56+
57+
# - name: Upload wheels
58+
# uses: actions/upload-artifact@v3
59+
# with:
60+
# name: wheels
61+
# path: dist
7162

7263
macos:
64+
# Skip building pull requests from the same repository
65+
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
7366
runs-on: macos-latest
74-
strategy:
75-
matrix:
76-
target: [x86_64, aarch64]
7767
steps:
78-
- uses: actions/checkout@v3
68+
- name: Checkout
69+
uses: actions/checkout@v3
7970
with:
8071
submodules: 'true'
81-
- uses: actions/setup-python@v4
72+
73+
- name: Python environment
74+
uses: actions/setup-python@v4
8275
with:
8376
python-version: '3.10'
84-
- name: Build wheels
85-
uses: PyO3/maturin-action@v1
77+
78+
- name: Install Rust toolchain
79+
uses: dtolnay/rust-toolchain@stable
8680
with:
87-
target: ${{ matrix.target }}
88-
args: --release --out dist --find-interpreter
89-
sccache: 'true'
81+
targets: aarch64-apple-darwin, x86_64-apple-darwin
82+
83+
- name: Build
84+
shell: bash
85+
env:
86+
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer
87+
MACOSX_DEPLOYMENT_TARGET: '10.9'
88+
ARCHFLAGS: -arch x86_64 -arch arm64
89+
PYO3_CROSS_LIB_DIR: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib
90+
run: |
91+
pip install -r requirements.txt
92+
python setup.py bdist_wheel --py-limited-api=cp37
93+
pip install --force-reinstall dist/*_universal2.whl
94+
python -c "import icicle"
95+
96+
- name: Test
97+
run: |
98+
pip install -r tests/requirements.txt
99+
python tests/example.py
100+
python tests/invalid.py
101+
90102
- name: Upload wheels
91103
uses: actions/upload-artifact@v3
92104
with:
93105
name: wheels
94106
path: dist
95107

96-
release:
97-
name: Release
98-
runs-on: ubuntu-latest
99-
if: "startsWith(github.ref, 'refs/tags/')"
100-
needs: [linux, windows, macos]
101-
steps:
102-
- uses: actions/download-artifact@v3
103-
with:
104-
name: wheels
105-
- name: Publish to PyPI
106-
uses: PyO3/maturin-action@v1
107-
env:
108-
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
109-
with:
110-
command: upload
111-
args: --skip-existing *
108+
109+
# release:
110+
# name: Release
111+
# runs-on: ubuntu-latest
112+
# if: "startsWith(github.ref, 'refs/tags/')"
113+
# needs: [linux, windows, macos]
114+
# steps:
115+
# - uses: actions/download-artifact@v3
116+
# with:
117+
# name: wheels
118+
# - name: Publish to PyPI
119+
# uses: PyO3/maturin-action@v1
120+
# env:
121+
# MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
122+
# with:
123+
# command: upload
124+
# args: --skip-existing *

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,10 @@ debug/
55
venv*/
66
.env/
77
dist/
8-
.DS_Store
8+
build/
9+
.DS_Store
10+
__pycache__/
11+
*.egg-info/
12+
*.so
13+
*.dll
14+
*.dylib

Cargo.lock

Lines changed: 21 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ icicle-vm = { path = "icicle-emu/icicle-vm" }
1515
pcode = { path = "icicle-emu/sleigh/pcode" }
1616
sleigh-runtime = { path = "icicle-emu/sleigh/sleigh-runtime" }
1717
indexmap = "1.9.3"
18-
pyo3 = { version = "0.18.3", features = ["extension-module", "indexmap"] }
18+
pyo3 = { version = "0.19.2", features = ["extension-module", "indexmap", "abi3-py37"] }
1919
target-lexicon = "0.12.7"
2020
tracing = "*"
2121
tracing-subscriber = "0.3.17"
2222

2323
[build-dependencies]
24-
pyo3-build-config = "0.18.3"
24+
pyo3-build-config = "0.19.2"

LICENSE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Boost Software License - Version 1.0 - August 17th, 2003
2+
3+
Permission is hereby granted, free of charge, to any person or organization
4+
obtaining a copy of the software and accompanying documentation covered by
5+
this license (the "Software") to use, reproduce, display, distribute,
6+
execute, and transmit the Software, and to prepare derivative works of the
7+
Software, and to permit third-parties to whom the Software is furnished to
8+
do so, all subject to the following:
9+
10+
The copyright notices in the Software and this entire statement, including
11+
the above license grant, this restriction and the following disclaimer,
12+
must be included in all copies of the Software, in whole or in part, and
13+
all derivative works of the Software, unless such copies or derivative
14+
works are solely in the form of machine-executable object code generated by
15+
a source language processor.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23+
DEALINGS IN THE SOFTWARE.

MANIFEST.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
include Cargo.lock
2+
include Cargo.toml
3+
include README.md
4+
include build.rs
5+
include requirements.txt
6+
include copy-ghidra.py
7+
recursive-include src *
8+
recursive-include icicle-emu *
9+
recursive-include python *.py
10+
recursive-include python *.pyi
11+
recursive-include python py.typed
12+
recursive-include python/icicle/Ghidra *

0 commit comments

Comments
 (0)