Skip to content

Instantly share code, notes, and snippets.

@moselhy
Created October 29, 2023 15:08
Show Gist options
  • Save moselhy/c9e8e9605c15082319f668c63cebb19f to your computer and use it in GitHub Desktop.
Save moselhy/c9e8e9605c15082319f668c63cebb19f to your computer and use it in GitHub Desktop.
Patch Azure Functions Core Tools @ 4 to support ARM until https://github.com/Azure/azure-functions-python-worker/issues/915 is closed
#!/bin/bash
brew install python@3.10 azure-functions-core-tools@4 jq
# Core tool installation path if installed with Homebrew
directory="/opt/homebrew/Cellar/azure-functions-core-tools@4"
# Use 'find' to locate directories starting with '4.' and sort by modification time
latest_directory=$(find "$directory" -type d -name "4.*" | sort -n | tail -1)
python_worker_dir=$latest_directory/workers/python
# Check if a directory was found
if [ -z "$latest_directory" ]; then
echo "No directory starting with '4.' found in $directory"
else
echo "Latest directory starting with '4.' in $directory is: $latest_directory"
cd "$python_worker_dir/3.10/OSX/"
# Create symbolic links X64 and ARM64
ln -s X64 Arm64
echo "Created sym link for ARM64"
# Create a temporary file for modification
tmpfile=$(mktemp)
jq '(.description.supportedArchitectures) |= ["X64", "X86", "ARM64"]' $python_worker_dir/worker.config.json > $tmpfile
mv $tmpfile $python_worker_dir/worker.config.json
echo "Worker config updated"
pip3.10 install grpcio > /dev/null
rm -rf $python_worker_dir/3.10/OSX/X64/grpc
cp -r /opt/homebrew/lib/python3.10/site-packages/grpc $python_worker_dir/3.10/OSX/X64/grpc
echo "gRPC updated"
echo "Done patching Azure Functions Core Tools to work with ARM processors"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment