|
1 | | -#!/bin/bash |
2 | | - |
3 | | -python -m venv .env |
| 1 | +#!/usr/bin/env bash |
| 2 | +# Step 1: Create venv |
| 3 | +python${PYTHON_VERSION} -m venv .env |
4 | 4 | source .env/bin/activate |
5 | | -python -m pip install --upgrade pip |
| 5 | +python -m pip install "setuptools<68" wheel |
6 | 6 |
|
7 | | -cd workers |
| 7 | +# Step 2: Install Bazel |
| 8 | +# Try system package manager first, otherwise fallback to binary download |
| 9 | +echo "=== Install Bazel ===" |
| 10 | +if command -v apt-get &>/dev/null; then |
| 11 | + sudo apt-get update |
| 12 | + sudo apt-get install -y bazel |
| 13 | +elif command -v brew &>/dev/null; then |
| 14 | + brew install bazelisk # macOS: bazelisk auto-tracks correct Bazel version |
| 15 | +else |
| 16 | + BAZEL_VERSION=6.5.0 |
| 17 | + curl -LO "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-linux-x86_64" |
| 18 | + chmod +x "bazel-${BAZEL_VERSION}-linux-x86_64" |
| 19 | + sudo mv "bazel-${BAZEL_VERSION}-linux-x86_64" /usr/local/bin/bazel |
| 20 | +fi |
| 21 | + |
| 22 | +bazel --version |
| 23 | + |
| 24 | +echo "=== Checking Python version being used ===" |
| 25 | +python --version |
| 26 | +pip --version |
| 27 | + |
| 28 | +echo "=== Cloning grpc repo ===" |
| 29 | +if [ ! -d "grpc" ]; then |
| 30 | + git clone --recursive https://github.com/grpc/grpc |
| 31 | +else |
| 32 | + ( cd grpc && git fetch origin && git submodule update --init --recursive ) |
| 33 | +fi |
8 | 34 |
|
9 | | -# Build and install grpcio from source |
10 | | -git clone --recursive https://github.com/grpc/grpc |
11 | 35 | cd grpc |
12 | | -python tools/distrib/python/make_grpcio_tools.py |
13 | | -python tools/distrib/python/make_grpcio_wheel.py |
14 | | -pip install artifacts/grpcio-*.whl |
15 | 36 |
|
| 37 | +echo "=== Building grpcio wheel with setup.py ===" |
| 38 | +python setup.py bdist_wheel -d dist |
| 39 | + |
| 40 | +echo "=== Checking built wheels ===" |
| 41 | +ls -la dist |
| 42 | + |
| 43 | +echo "=== Installing grpcio wheel into venv ===" |
| 44 | +for whl in dist/grpcio-*.whl; do |
| 45 | + if [ -f "$whl" ]; then |
| 46 | + echo "Installing wheel: $whl" |
| 47 | + pip install "$whl" |
| 48 | + else |
| 49 | + echo "❌ No grpcio wheel found in dist/" |
| 50 | + exit 1 |
| 51 | + fi |
| 52 | +done |
16 | 53 |
|
| 54 | +cd .. |
| 55 | +echo "=== Installing your workers package ===" |
| 56 | +cd workers |
17 | 57 | python -m pip install . |
| 58 | + |
18 | 59 | python -m pip install . --no-compile --target "$BUILD_SOURCESDIRECTORY/deps" |
19 | 60 |
|
20 | 61 | python -m pip install invoke |
|
0 commit comments