Skip to content

Commit 80f8fc9

Browse files
safe
1 parent 2af7956 commit 80f8fc9

File tree

7 files changed

+78
-2
lines changed

7 files changed

+78
-2
lines changed

.DS_Store

0 Bytes
Binary file not shown.

build_mps_wheel.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# === Konfiguration ===
5+
PYTHON_VERSION=3.12
6+
WHEEL_VERSION=4.5.1
7+
PYTHON_DIR="python"
8+
ROOT_DIR="$(cd "$(dirname "$0")" && pwd)"
9+
10+
# 1. Submodules sicherstellen
11+
cd "$ROOT_DIR"
12+
echo "[1/5] Initialisiere Submodule (Googletest etc.)..."
13+
git submodule update --init --recursive
14+
15+
# 2. Native Bibliothek bauen (MPS, ARM64)
16+
echo "[2/5] Baue native Bibliothek mit MPS-Unterstützung..."
17+
rm -rf build/
18+
mkdir build && cd build
19+
cmake -DWITH_MPS=ON -DWITH_CUDA=OFF -DWITH_PYTHON=ON -DCMAKE_OSX_ARCHITECTURES=arm64 ..
20+
make -j$(sysctl -n hw.ncpu)
21+
22+
# 3. Python-Wheel bauen
23+
cd "$ROOT_DIR/$PYTHON_DIR"
24+
echo "[3/5] Baue Python-Wheel..."
25+
rm -rf build/ dist/ ctranslate2.egg-info/
26+
$PYTHON_VERSION -m venv venv312
27+
source venv312/bin/activate
28+
pip install --upgrade pip build
29+
export ARCHFLAGS='-arch arm64'
30+
export CMAKE_OSX_ARCHITECTURES='arm64'
31+
$PYTHON_VERSION -m build --wheel
32+
33+
echo "[4/5] Prüfe Wheel-Inhalt..."
34+
if ! unzip -l dist/ctranslate2-$WHEEL_VERSION-*.whl | grep -q 'libctranslate2.*.dylib'; then
35+
echo "Fehler: libctranslate2.dylib nicht im Wheel enthalten!"
36+
exit 1
37+
fi
38+
39+
echo "[5/5] Teste Wheel in frischem venv..."
40+
cd "$ROOT_DIR/$PYTHON_DIR"
41+
$PYTHON_VERSION -m venv testvenv
42+
source testvenv/bin/activate
43+
pip install dist/ctranslate2-$WHEEL_VERSION-*.whl
44+
python -c "import ctranslate2; print(ctranslate2.list_supported_devices())"
45+
46+
echo "\nFERTIG! Das Wheel ist unter python/dist/ bereit und unterstützt nativ MPS."

python/.DS_Store

2 KB
Binary file not shown.

python/Agent/testenv/.lock

Whitespace-only changes.

python/build_universal2_wheel.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Universal2 build script for CTranslate2 Python wheel
5+
# Usage: bash build_universal2_wheel.sh
6+
7+
# Use your universal binary Python (replace 'ub python3' with your actual command if different)
8+
export ARCHFLAGS='-arch x86_64 -arch arm64'
9+
export CMAKE_OSX_ARCHITECTURES='arm64;x86_64'
10+
# Install build tool if needed
11+
uv pip install --upgrade pip build
12+
13+
# Clean previous builds
14+
echo "Cleaning previous build artifacts..."
15+
rm -rf build/ dist/ ctranslate2.egg-info/
16+
17+
# Build sdist and universal2 wheel
18+
echo "Building universal2 wheel..."
19+
uv run -m build --sdist --wheel
20+
21+
echo "\nBuild complete. Check dist/ for the universal2 wheel."
22+
ls -lh dist/
23+
24+
# Optional: Check architectures
25+
for f in ctranslate2/_ext.cpython-*-darwin.so ctranslate2/libctranslate2*.dylib; do
26+
if [ -f "$f" ]; then
27+
echo "\nChecking architectures for $f:"
28+
lipo -info "$f"
29+
fi
30+
done

python/ctranslate2/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Version information."""
22

3-
__version__ = "4.5.0"
3+
__version__ = "4.5.1"

python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from setuptools import Extension, setup, find_packages
99
from setuptools.command.build_ext import build_ext
1010

11-
VERSION = "4.5.0" # Fixed version number matching the installed library
11+
VERSION = "4.5.1" # Fixed version number matching the installed library
1212

1313
def build_cpp_lib():
1414
"""Build and install the C++ library."""

0 commit comments

Comments
 (0)