Skip to content

Commit

Permalink
fix: python wheel incorrect architecture on mac (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
korniltsev authored Apr 15, 2024
1 parent fc13cb4 commit 5771cad
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ jobs:
with:
python-version: 3.11

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

- uses: actions/upload-artifact@v2
with:
Expand Down Expand Up @@ -314,9 +314,6 @@ jobs:
name: macOS - ${{ matrix.target }}
runs-on: macos-${{ matrix.macos-version }}

env:
RUST_TARGET: ${{ matrix.target }}

steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
Expand All @@ -328,7 +325,9 @@ jobs:
target: ${{ matrix.target }}
profile: minimal
override: true
- run: make gem/mac/${{ matrix.mk-arch }}

- run: make pyroscope_ffi/clean gem/mac/${{ matrix.mk-arch }}

- uses: actions/upload-artifact@v2
with:
name: ${{ github.sha }}
Expand Down
18 changes: 10 additions & 8 deletions ffi.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ wheel/linux/arm64: pyroscope_ffi/clean
wheel/mac/amd64:
cd pyroscope_ffi/python && \
pip install wheel && \
python setup.py bdist_wheel -p macosx-11_0_x86_64
CARGO_BUILD_TARGET=x86_64-apple-darwin \
python setup.py bdist_wheel -p macosx-11_0_x86_64

.phony: wheel/mac/arm64
wheel/mac/arm64:
cd pyroscope_ffi/python && \
pip install wheel && \
python setup.py bdist_wheel -p macosx-11_0_arm64
CARGO_BUILD_TARGET=aarch64-apple-darwin \
python setup.py bdist_wheel -p macosx-11_0_arm64


.phony: gem/linux/amd64
Expand All @@ -66,14 +68,14 @@ gem/linux/arm64: pyroscope_ffi/clean
gem/mac/amd64: pyroscope_ffi/clean
cd pyroscope_ffi/ruby && \
bundle && \
rake rbspy_install && \
rake thread_id_install && \
rake x86_64_darwin:gem
RUST_TARGET=x86_64-apple-darwin rake rbspy_install && \
RUST_TARGET=x86_64-apple-darwin rake thread_id_install && \
RUST_TARGET=x86_64-apple-darwin rake x86_64_darwin:gem

.phony: gem/mac/arm64
gem/mac/arm64: pyroscope_ffi/clean
cd pyroscope_ffi/ruby && \
bundle && \
rake rbspy_install && \
rake thread_id_install && \
rake arm64_darwin:gem
RUST_TARGET=aarch64-apple-darwin rake rbspy_install && \
RUST_TARGET=aarch64-apple-darwin rake thread_id_install && \
RUST_TARGET=aarch64-apple-darwin rake arm64_darwin:gem
2 changes: 1 addition & 1 deletion pyroscope_ffi/python/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = pyroscope-io
version= 0.8.6
version= 0.8.7
description = Pyroscope Python integration
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down
6 changes: 5 additions & 1 deletion pyroscope_ffi/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ def build_native(spec):
)

def find_dylib():
in_path = '../../../target/release'
cargo_target = os.environ.get('CARGO_BUILD_TARGET')
if cargo_target:
in_path = '../../../target/%s/release' % (cargo_target)
else:
in_path = '../../../target/release'
return build.find_dylib('pyroscope_ffi', in_path=in_path)

# Step 2: package the compiled library
Expand Down
2 changes: 1 addition & 1 deletion pyroscope_ffi/ruby/lib/pyroscope/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Pyroscope
VERSION = '0.5.11'.freeze
VERSION = '0.5.12'.freeze
end

0 comments on commit 5771cad

Please sign in to comment.