Skip to content

Commit 5771cad

Browse files
authored
fix: python wheel incorrect architecture on mac (grafana#162)
1 parent fc13cb4 commit 5771cad

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ jobs:
195195
with:
196196
python-version: 3.11
197197

198-
- run: make wheel/mac/${{ matrix.mk-arch }}
198+
- run: make pyroscope_ffi/clean wheel/mac/${{ matrix.mk-arch }}
199199

200200
- uses: actions/upload-artifact@v2
201201
with:
@@ -314,9 +314,6 @@ jobs:
314314
name: macOS - ${{ matrix.target }}
315315
runs-on: macos-${{ matrix.macos-version }}
316316

317-
env:
318-
RUST_TARGET: ${{ matrix.target }}
319-
320317
steps:
321318
- uses: actions/checkout@v3
322319
- uses: ruby/setup-ruby@v1
@@ -328,7 +325,9 @@ jobs:
328325
target: ${{ matrix.target }}
329326
profile: minimal
330327
override: true
331-
- run: make gem/mac/${{ matrix.mk-arch }}
328+
329+
- run: make pyroscope_ffi/clean gem/mac/${{ matrix.mk-arch }}
330+
332331
- uses: actions/upload-artifact@v2
333332
with:
334333
name: ${{ github.sha }}

ffi.mk

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ wheel/linux/arm64: pyroscope_ffi/clean
3333
wheel/mac/amd64:
3434
cd pyroscope_ffi/python && \
3535
pip install wheel && \
36-
python setup.py bdist_wheel -p macosx-11_0_x86_64
36+
CARGO_BUILD_TARGET=x86_64-apple-darwin \
37+
python setup.py bdist_wheel -p macosx-11_0_x86_64
3738

3839
.phony: wheel/mac/arm64
3940
wheel/mac/arm64:
4041
cd pyroscope_ffi/python && \
4142
pip install wheel && \
42-
python setup.py bdist_wheel -p macosx-11_0_arm64
43+
CARGO_BUILD_TARGET=aarch64-apple-darwin \
44+
python setup.py bdist_wheel -p macosx-11_0_arm64
4345

4446

4547
.phony: gem/linux/amd64
@@ -66,14 +68,14 @@ gem/linux/arm64: pyroscope_ffi/clean
6668
gem/mac/amd64: pyroscope_ffi/clean
6769
cd pyroscope_ffi/ruby && \
6870
bundle && \
69-
rake rbspy_install && \
70-
rake thread_id_install && \
71-
rake x86_64_darwin:gem
71+
RUST_TARGET=x86_64-apple-darwin rake rbspy_install && \
72+
RUST_TARGET=x86_64-apple-darwin rake thread_id_install && \
73+
RUST_TARGET=x86_64-apple-darwin rake x86_64_darwin:gem
7274

7375
.phony: gem/mac/arm64
7476
gem/mac/arm64: pyroscope_ffi/clean
7577
cd pyroscope_ffi/ruby && \
7678
bundle && \
77-
rake rbspy_install && \
78-
rake thread_id_install && \
79-
rake arm64_darwin:gem
79+
RUST_TARGET=aarch64-apple-darwin rake rbspy_install && \
80+
RUST_TARGET=aarch64-apple-darwin rake thread_id_install && \
81+
RUST_TARGET=aarch64-apple-darwin rake arm64_darwin:gem

pyroscope_ffi/python/setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = pyroscope-io
3-
version= 0.8.6
3+
version= 0.8.7
44
description = Pyroscope Python integration
55
long_description = file: README.md
66
long_description_content_type = text/markdown

pyroscope_ffi/python/setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ def build_native(spec):
1515
)
1616

1717
def find_dylib():
18-
in_path = '../../../target/release'
18+
cargo_target = os.environ.get('CARGO_BUILD_TARGET')
19+
if cargo_target:
20+
in_path = '../../../target/%s/release' % (cargo_target)
21+
else:
22+
in_path = '../../../target/release'
1923
return build.find_dylib('pyroscope_ffi', in_path=in_path)
2024

2125
# Step 2: package the compiled library
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Pyroscope
2-
VERSION = '0.5.11'.freeze
2+
VERSION = '0.5.12'.freeze
33
end

0 commit comments

Comments
 (0)