Skip to content

Commit

Permalink
[4/4] Support for macOS - update
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeiteng committed Jan 12, 2023
1 parent 6e1d4b4 commit 4416953
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
11 changes: 5 additions & 6 deletions oss_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,17 @@ for python_version in $PYTHON_VERSIONS; do
else
echo "Error unknown --python. Only [3.7|3.8|3.9|3.10]"
exit 1
fi

export PYTHON_BIN_PATH=`which python${python_version}`
export PYTHON_LIB_PATH=`${PYTHON_BIN_PATH} -c 'import site; print(site.getsitepackages()[0])'`

if [ "$(uname)" = "Darwin" ]; then
bazel_config=""
version=`sw_vers -productVersion | sed 's/\./_/g' | cut -d"_" -f1,2`
PLATFORM="macosx_${version}_"`uname -m`
PLATFORM=`${PYTHON_BIN_PATH} -c "from distutils import util; print(util.get_platform())"`
else
bazel_config="--config=manylinux2010"
bazel_config=""
PLATFORM="manylinux2010_x86_64"
bazel_config="--config=manylinux2014"
PLATFORM="manylinux2014_x86_64"
fi

# Configures Bazel environment for selected Python version.
Expand All @@ -141,7 +140,7 @@ for python_version in $PYTHON_VERSIONS; do
./bazel-bin/reverb/pip_package/build_pip_package --dst $OUTPUT_DIR $PIP_PKG_EXTRA_ARGS --platform "$PLATFORM"

# Installs pip package.
$PYTHON_BIN_PATH -mpip install --force-reinstall ${OUTPUT_DIR}*${ABI}*.whl
$PYTHON_BIN_PATH -m pip install --force-reinstall ${OUTPUT_DIR}*${ABI}*.whl

if [ "$PYTHON_TESTS" = "true" ]; then
echo "Run Python tests..."
Expand Down
2 changes: 1 addition & 1 deletion reverb/cc/platform/default/repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def _protoc_archive(ctx):

if is_darwin(ctx):
platform = "osx"
sha256 = ""
sha256 = "99729771ccb2f70621ac20f241f6ab1c70271f2c6bd2ea1ddbd9c2f7ae08d316"
else:
platform = "linux"

Expand Down
6 changes: 4 additions & 2 deletions reverb/cc/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,12 @@ Table::Table(std::string name, std::shared_ptr<ItemSelector> sampler,
num_unique_samples_(0),
max_size_(max_size),
max_enqueued_inserts_(
std::max(1L, std::min<int64_t>(max_size * kMaxEnqueuedInsertsPerc,
std::max(static_cast<int64_t>(1),
std::min<int64_t>(max_size * kMaxEnqueuedInsertsPerc,
kMaxEnqueuedInserts))),
max_enqueued_extension_ops_(
std::max(1L, std::min<int64_t>(max_size * kMaxPendingExtensionOpsPerc,
std::max(static_cast<int64_t>(1),
std::min<int64_t>(max_size * kMaxPendingExtensionOpsPerc,
kMaxPendingExtensionOps))),
max_times_sampled_(max_times_sampled),
name_(std::move(name)),
Expand Down

0 comments on commit 4416953

Please sign in to comment.