Skip to content

Commit 5a878d7

Browse files
committed
[4/4] Support for macOS - update
1 parent 6e1d4b4 commit 5a878d7

6 files changed

Lines changed: 19 additions & 120 deletions

File tree

docker/dev.dockerfile

Lines changed: 0 additions & 102 deletions
This file was deleted.

docker/release.dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ ARG pip_dependencies=' \
7070
numpy \
7171
oauth2client \
7272
pandas \
73-
platform \
7473
portpicker'
7574

7675
RUN for python in ${python_version}; do \

oss_build.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,17 @@ for python_version in $PYTHON_VERSIONS; do
105105
else
106106
echo "Error unknown --python. Only [3.7|3.8|3.9|3.10]"
107107
exit 1
108+
fi
108109

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

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

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

143142
# Installs pip package.
144-
$PYTHON_BIN_PATH -mpip install --force-reinstall ${OUTPUT_DIR}*${ABI}*.whl
143+
$PYTHON_BIN_PATH -m pip install --force-reinstall ${OUTPUT_DIR}*${ABI}*.whl
145144

146145
if [ "$PYTHON_TESTS" = "true" ]; then
147146
echo "Run Python tests..."

reverb/cc/platform/default/repo.bzl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,20 +235,23 @@ def _tensorflow_solib_repo_impl(repo_ctx):
235235
tf_lib_path = _find_tf_lib_path(repo_ctx)
236236
repo_ctx.symlink(tf_lib_path, "tensorflow_solib")
237237
if is_darwin(repo_ctx):
238-
suffix = "2.dylib"
238+
tensorflow_solib = "libtensorflow_cc.2.dylib"
239+
full_path = repo_ctx.path("tensorflow_solib/{}".format(tensorflow_solib))
240+
if not full_path.exists:
241+
tensorflow_solib = "libtensorflow_framework.2.dylib"
239242
else:
240-
suffix = "so.2"
243+
tensorflow_solib = "libtensorflow_framework.so.2"
241244

242245
repo_ctx.file(
243246
"BUILD",
244247
content = """
245248
cc_library(
246249
name = "framework_lib",
247-
srcs = ["tensorflow_solib/libtensorflow_framework.{suffix}"],
250+
srcs = ["tensorflow_solib/{tensorflow_solib}"],
248251
deps = ["@python_includes", "@python_includes//:numpy_includes"],
249252
visibility = ["//visibility:public"],
250253
)
251-
""".format(suffix=suffix))
254+
""".format(tensorflow_solib=tensorflow_solib))
252255

253256
def _python_includes_repo_impl(repo_ctx):
254257
python_include_path = _find_python_include_path(repo_ctx)
@@ -267,9 +270,6 @@ def _python_includes_repo_impl(repo_ctx):
267270
else:
268271
python_includes_srcs = 'srcs = ["%s"],' % python_solib.basename
269272

270-
# Note, "@python_includes" is a misnomer since we include the
271-
# libpythonX.Y.so in the srcs, so we can get access to python's various
272-
# symbols at link time.
273273
repo_ctx.file(
274274
"BUILD",
275275
content = """
@@ -394,7 +394,7 @@ def _protoc_archive(ctx):
394394

395395
if is_darwin(ctx):
396396
platform = "osx"
397-
sha256 = ""
397+
sha256 = "99729771ccb2f70621ac20f241f6ab1c70271f2c6bd2ea1ddbd9c2f7ae08d316"
398398
else:
399399
platform = "linux"
400400

reverb/cc/table.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,12 @@ Table::Table(std::string name, std::shared_ptr<ItemSelector> sampler,
154154
num_unique_samples_(0),
155155
max_size_(max_size),
156156
max_enqueued_inserts_(
157-
std::max(1L, std::min<int64_t>(max_size * kMaxEnqueuedInsertsPerc,
157+
std::max(static_cast<int64_t>(1),
158+
std::min<int64_t>(max_size * kMaxEnqueuedInsertsPerc,
158159
kMaxEnqueuedInserts))),
159160
max_enqueued_extension_ops_(
160-
std::max(1L, std::min<int64_t>(max_size * kMaxPendingExtensionOpsPerc,
161+
std::max(static_cast<int64_t>(1),
162+
std::min<int64_t>(max_size * kMaxPendingExtensionOpsPerc,
161163
kMaxPendingExtensionOps))),
162164
max_times_sampled_(max_times_sampled),
163165
name_(std::move(name)),

run_python_tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ py_test() {
2929

3030
echo "===========Running Python tests============"
3131

32-
for test_file in `find reverb/ -name '*_test.py' -print`
32+
cd reverb/ # Fix OSX circular import error
33+
for test_file in `find ./ -name '*_test.py' -print`
3334
do
3435
echo "####=======Testing ${test_file}=======####"
3536
${PYTHON_BIN_PATH} "${test_file}"

0 commit comments

Comments
 (0)