Skip to content

Commit dcffc42

Browse files
committed
fix: Resolve Bazel external repository loading and Python type registration errors
1 parent c53a4c6 commit dcffc42

5 files changed

Lines changed: 328 additions & 1 deletion

File tree

.ijwb/.bazelproject

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
directories:
2+
.
3+
4+
# Automatically includes all relevant targets under the 'directories' above
5+
derive_targets_from_directories: true
6+
7+
targets:
8+
# If source code isn't resolving, add additional targets that compile it here
9+
10+
additional_languages:
11+
# Uncomment any additional languages you want supported
12+
# android
13+
# dart
14+
# go
15+
# javascript
16+
# kotlin
17+
# python
18+
# scala
19+
# typescript

ci/test-arm64-ci.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+
IMAGE_NAME="quay.io/pypa/manylinux_2_28_aarch64"
5+
6+
# Enable BuildKit
7+
export DOCKER_BUILDKIT=1
8+
9+
# Create cache volumes if they don't exist
10+
docker volume create --name fory_bazel_cache >/dev/null
11+
docker volume create --name fory_pip_cache >/dev/null
12+
docker volume create --name fory_usr_local >/dev/null
13+
docker volume create --name fory_yum_cache >/dev/null
14+
15+
echo "Running build in container..."
16+
# Mount the Bazel cache and set the BAZEL_OPTS environment variable to use it
17+
docker run --rm --platform linux/arm64 \
18+
-v fory_yum_cache:/var/cache/yum \
19+
-v fory_bazel_cache:/root/.cache/bazel \
20+
-v fory_pip_cache:/root/.cache/pip \
21+
-v fory_usr_local:/usr/local \
22+
-e BAZEL_OPTS="--output_user_root=/root/.cache/bazel" \
23+
-w /workspace -v "$(pwd)":/workspace "$IMAGE_NAME" bash -c "
24+
set -ex
25+
# Install dependencies required by the build scripts
26+
yum install -y git sudo wget which
27+
# The git repository is mounted from the host, so we need to mark it as safe for git commands
28+
git config --global --add safe.directory /workspace
29+
30+
# The manylinux image has multiple python versions. Instead of manipulating PATH,
31+
# which can be tricky with subshells, we will create symlinks in /usr/local/bin,
32+
# which is in the default system PATH. We are using Python 3.8.
33+
# Use -f to overwrite existing symlinks if any
34+
ln -s -f /opt/python/cp38-cp38/bin/python /usr/local/bin/python
35+
ln -s -f /opt/python/cp38-cp38/bin/pip /usr/local/bin/pip
36+
ln -s -f /opt/python/cp38-cp38/bin/python3 /usr/local/bin/python3
37+
ln -s -f /opt/python/cp38-cp38/bin/pip3 /usr/local/bin/pip3
38+
39+
./ci/deploy.sh install_pyarrow
40+
pip3 install Cython wheel pytest setuptools -U
41+
# Install Bazel using the new Python-based system
42+
python ./ci/run_ci.py cpp --install-deps-only
43+
# Run Python CI tasks
44+
python ./ci/run_ci.py python
45+
"
46+
echo "Build completed. Check ./dist directory for wheels"

python/core

Whitespace-only changes.

python/setup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ def __init__(self, attrs=None):
5454
bazel_args += ["//:cp_fory_so"]
5555
# Ensure Windows path compatibility
5656
cwd_path = os.path.normpath(project_dir)
57-
print(f"Running bazel with cwd={cwd_path}: {' '.join(bazel_args)}")
57+
# Force Bazel to run a sync first to ensure repositories are loaded
58+
sync_args = ["bazel", "sync", "--configure"]
59+
print(f"Running bazel sync with cwd={cwd_path}: {' '.join(sync_args)}")
60+
subprocess.check_call(sync_args, cwd=cwd_path)
61+
62+
print(f"Running bazel build with cwd={cwd_path}: {' '.join(bazel_args)}")
5863
subprocess.check_call(bazel_args, cwd=cwd_path)
5964

6065
def has_ext_modules(self):

0 commit comments

Comments
 (0)