Skip to content

Commit bb79a77

Browse files
ahmedihabb2viferga
andauthored
feat: Build with Python support for MacOS (#391)
* feat: Build with Python support for MacOS * set python paths * fix build with python [skip ci] * Update metacall-environment-macos.sh --------- Co-authored-by: Vicente Eduardo Ferrer Garcia <[email protected]>
1 parent e625393 commit bb79a77

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

.github/workflows/macos-test.yml

+12-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
pull_request:
66
push:
77
tags:
8-
- 'v*.*.*'
8+
- "v*.*.*"
99
branches:
1010
- master
1111
- develop
@@ -18,25 +18,25 @@ jobs:
1818
strategy:
1919
matrix:
2020
buildtype: [debug] # TODO: [debug, release]
21-
21+
2222
env:
2323
LTTNG_UST_REGISTER_TIMEOUT: 0
2424
NUGET_XMLDOC_MODE: skip
25-
DOTNET_CLI_TELEMETRY_OPTOUT: 'true'
25+
DOTNET_CLI_TELEMETRY_OPTOUT: "true"
2626

2727
steps:
2828
- name: Check out the repository
2929
uses: actions/checkout@v2
3030
with:
3131
fetch-depth: 0
3232

33-
- name: Uninstall NodeJS and NPM
33+
- name: Uninstall NodeJS and NPM
3434
run: |
3535
npm uninstall npm -g
3636
rm -rf /usr/local/lib/node_modules/npm
3737
3838
# TODO: This must go in metacall-environment-macos.sh as base dependencies
39-
- name: Configure Clang
39+
- name: Configure Clang
4040
run: |
4141
brew install llvm cmake git wget gnupg ca-certificates
4242
@@ -51,13 +51,18 @@ jobs:
5151
cd build
5252
bash ../tools/metacall-configure.sh $METACALL_CONFIGURE_OPTIONS
5353
env:
54-
METACALL_CONFIGURE_OPTIONS: ${{ matrix.buildtype }} scripts ports tests sanitizer # nodejs python java sanitizer ruby netcore5 typescript file rpc wasm java c cobol rust examples dynamic install pack benchmarks # v8 coverage
54+
METACALL_CONFIGURE_OPTIONS: ${{ matrix.buildtype }} scripts ports tests sanitizer python # nodejs python java sanitizer ruby netcore5 typescript file rpc wasm java c cobol rust examples dynamic install pack benchmarks # v8 coverage
5555

5656
- name: Build
5757
working-directory: ./build
5858
# TODO: Remove the disable option for fork safe once funchook problem is solved
5959
run: |
60-
cmake -DOPTION_FORK_SAFE=OFF ..
60+
cmake -DOPTION_FORK_SAFE=OFF \
61+
-DPython_INCLUDE_DIRS="$HOME/.pyenv/versions/3.11.1/include/python3.11" \
62+
-DPython_LIBRARY="$HOME/.pyenv/versions/3.11.1/lib/libpython3.11.dylib" \
63+
-DPython_EXECUTABLE="$HOME/.pyenv/versions/3.11.1/bin/python3.11" \
64+
-DPython_ROOT="$HOME/.pyenv/versions/3.11.1" \
65+
-DPython_VERSION="3.11.1" ..
6166
bash ../tools/metacall-build.sh $METACALL_BUILD_OPTIONS
6267
env:
6368
METACALL_BUILD_OPTIONS: ${{ matrix.buildtype }} tests

tools/metacall-environment-macos.sh

+10-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,16 @@ sub_swig() {
4444

4545
# Python
4646
sub_python() {
47-
echo "configuring python"
48-
brew install python3 python3-pip
47+
echo "configuring python"
48+
brew install pyenv openssl
49+
export PKG_CONFIG_PATH=$(brew --prefix openssl)/lib/pkgconfig
50+
export PYTHON_CONFIGURE_OPTS="--enable-shared"
51+
pyenv install 3.11.1
52+
pyenv global 3.11.1
53+
pyenv rehash
54+
echo -e '\nif command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
55+
source ~/.bash_profile
56+
which python3
4957
pip3 install requests
5058
pip3 install setuptools
5159
pip3 install wheel

0 commit comments

Comments
 (0)