diff --git a/dependency_support/com_github_yosyshq_nextpnr/bundled.BUILD.bazel b/dependency_support/com_github_yosyshq_nextpnr/bundled.BUILD.bazel index a71fbd9f..041b9a2d 100644 --- a/dependency_support/com_github_yosyshq_nextpnr/bundled.BUILD.bazel +++ b/dependency_support/com_github_yosyshq_nextpnr/bundled.BUILD.bazel @@ -129,7 +129,7 @@ cc_binary( linkopts = ["-lpthread"], visibility = ["//visibility:public"], deps = DEPS + [ - "@rules_hdl//dependency_support/embedded_python_interpreter", + "@python39//:libpython", ":common", ":%s_chipdb" % family, ], @@ -158,7 +158,7 @@ cc_binary( ":common", ":%s_chipdb" % family, "@com_google_googletest//:gtest_main", - "@rules_hdl//dependency_support/embedded_python_interpreter", + "@python39//:libpython", ], ) for family in [ # There are no unit tests for ECP5 under tests/ecp5. diff --git a/dependency_support/embedded_python_interpreter/BUILD b/dependency_support/embedded_python_interpreter/BUILD deleted file mode 100644 index 81e730b2..00000000 --- a/dependency_support/embedded_python_interpreter/BUILD +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -load("@rules_cc//cc:defs.bzl", "cc_import") -load("@rules_python//python:defs.bzl", "py_binary") - -package( - default_applicable_licenses = ["//:package_license"], - default_visibility = ["//visibility:private"], -) - -py_binary( - name = "print_libpython_path", - srcs = ["print_libpython_path.py"], - python_version = "PY3", - srcs_version = "PY3", -) - -genrule( - name = "embdedded_python_interpreter_so", - outs = ["embedded_python_interpreter.so"], - # The .so file for the Python runtime has a name that is not known at - # analysis time. Because Bazel needs to know the name of the .so file - # at analysis time we use a genrule to copy the .so file to a known path. - # This causes problems with linking though, because the .so file has a - # SONAME entry which causes the linker to create an executable that points - # to the path named in SONAME rather than embdedded_python_interpreter.so. - # To force the linker to make an executable that points to the right shared - # library, the .so file is rewritten so that the SONAME field has the right - # path in it. - cmd = "cp \"$$($(location :print_libpython_path))\" $@ && $(location @org_nixos_patchelf//:patchelf) --set-soname embedded_python_interpreter.so $@", - exec_tools = [ - ":print_libpython_path", - "@org_nixos_patchelf//:patchelf", - ], -) - -# C binaries that embed a Python interpreter can depend on this library to get -# access to the Python symbols. This target uses libpython from the Python -# interpreter that is used by Bazel. -cc_import( - name = "embedded_python_interpreter", - shared_library = "embedded_python_interpreter.so", - visibility = ["//visibility:public"], -) diff --git a/dependency_support/embedded_python_interpreter/README.md b/dependency_support/embedded_python_interpreter/README.md deleted file mode 100644 index 3df68648..00000000 --- a/dependency_support/embedded_python_interpreter/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Embedded Python interpreter - -Unlike most other directories under `dependency_support`, this package doesn't -download a external source. Instead it exposes the -`@rules_hdl//dependency_support/embedded_python_interpreter` target, which C++ -targets can depend on to get access to Python symbols. This points to the Python -libraries that are provided by the Python interpreter that is used by Bazel. diff --git a/dependency_support/embedded_python_interpreter/print_libpython_path.py b/dependency_support/embedded_python_interpreter/print_libpython_path.py deleted file mode 100644 index 5b798eee..00000000 --- a/dependency_support/embedded_python_interpreter/print_libpython_path.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Prints the path to the libpython shared library.""" - -from distutils import sysconfig -import os - -config_vars = sysconfig.get_config_vars() -file_paths = [ - os.path.join(config_vars[pv], config_vars['LDLIBRARY']) - for pv in ('LIBDIR', 'LIBPL') -] - -if 'rules_hdl_cpython' in config_vars['prefix']: - # Hack: Work around broken library paths in the hermetic Python toolchain that - # is used in rules_hdl CI runs (and can optionally be used by its users as - # well). It reports that the library path is an absolute path like - # - # /install/lib/libpython3.8.so - # - # but this path doesn't exist. So we'll fix it here. - file_paths = [path.replace('/install', config_vars['prefix']) for path in file_paths] - -print(list(filter(os.path.exists, file_paths))[0])