From 441caeffaad24789864111359ce5ba1288031f0e Mon Sep 17 00:00:00 2001 From: Ethan Steinberg Date: Sat, 22 Jun 2024 14:51:08 -0700 Subject: [PATCH] Revert --- native/BUILD | 10 ++++++---- native/MODULE.bazel | 13 +------------ native/MODULE.bazel.lock | 38 ++++++++++++++++++++++++++++++++------ native/WORKSPACE | 21 +++++++++++++++------ native/meds_reader.cc | 4 ++++ 5 files changed, 58 insertions(+), 28 deletions(-) diff --git a/native/BUILD b/native/BUILD index 7a58afc..a17fea4 100644 --- a/native/BUILD +++ b/native/BUILD @@ -2,6 +2,8 @@ load( "@rules_foreign_cc//foreign_cc:defs.bzl", "cmake", "configure_make", "make" ) +load("@pybind11_bazel//:build_defs.bzl", "pybind_extension") + cc_binary( name="simple_test", srcs=["simple_test.cc"], @@ -30,13 +32,13 @@ cc_binary( ], ) -cc_binary( - name="_meds_reader.so", + +pybind_extension( + name="_meds_reader", srcs=[ "meds_reader.cc", ], - deps=["@rules_python//python/cc:current_py_cc_headers", ":create_database"], - linkshared = 1, + deps=[":create_database"], ) cmake( diff --git a/native/MODULE.bazel b/native/MODULE.bazel index 18980f6..1a49310 100644 --- a/native/MODULE.bazel +++ b/native/MODULE.bazel @@ -3,15 +3,4 @@ # Please consider migrating your external dependencies from WORKSPACE to MODULE.bazel. # # For more details, please check https://github.com/bazelbuild/bazel/issues/18958 -############################################################################### - -register_toolchains("@bazel_tools//tools/python:autodetecting_toolchain") - -bazel_dep(name = "rules_python", version = "0.33.2") -python = use_extension("@rules_python//python/extensions:python.bzl", "python") - -python.toolchain( - ignore_root_user_error = True, - is_default=False, - python_version = "3.11", -) +############################################################################### \ No newline at end of file diff --git a/native/MODULE.bazel.lock b/native/MODULE.bazel.lock index 33bc0e2..5e350a6 100644 --- a/native/MODULE.bazel.lock +++ b/native/MODULE.bazel.lock @@ -9,11 +9,9 @@ "https://bcr.bazel.build/modules/apple_support/1.5.0/source.json": "eb98a7627c0bc486b57f598ad8da50f6625d974c8f723e9ea71bd39f709c9862", "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", "https://bcr.bazel.build/modules/bazel_features/1.11.0/source.json": "c9320aa53cd1c441d24bd6b716da087ad7e4ff0d9742a9884587596edfe53015", - "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a", "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a", "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5", - "https://bcr.bazel.build/modules/bazel_skylib/1.5.0/MODULE.bazel": "32880f5e2945ce6a03d1fbd588e9198c0a959bb42297b2cfaf1685b7bc32e138", "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917", "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/source.json": "082ed5f9837901fada8c68c2f3ddc958bb22b6d654f71dd73f3df30d45d4b749", "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", @@ -47,12 +45,10 @@ "https://bcr.bazel.build/modules/rules_pkg/0.7.0/source.json": "c2557066e0c0342223ba592510ad3d812d4963b9024831f7f66fd0584dd8c66c", "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06", "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7", - "https://bcr.bazel.build/modules/rules_proto/6.0.0-rc1/MODULE.bazel": "1e5b502e2e1a9e825eef74476a5a1ee524a92297085015a052510b09a1a09483", - "https://bcr.bazel.build/modules/rules_proto/6.0.0-rc1/source.json": "8d8448e71706df7450ced227ca6b3812407ff5e2ccad74a43a9fbe79c84e34e0", + "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/source.json": "d57902c052424dfda0e71646cb12668d39c4620ee0544294d9d941e7d12bc3a9", "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", "https://bcr.bazel.build/modules/rules_python/0.22.1/MODULE.bazel": "26114f0c0b5e93018c0c066d6673f1a2c3737c7e90af95eff30cfee38d0bbac7", - "https://bcr.bazel.build/modules/rules_python/0.33.2/MODULE.bazel": "3e036c4ad8d804a4dad897d333d8dce200d943df4827cb849840055be8d2e937", - "https://bcr.bazel.build/modules/rules_python/0.33.2/source.json": "e539592cd3aae4492032cecea510e46ca16eeb972271560b922cae9893944e2f", + "https://bcr.bazel.build/modules/rules_python/0.22.1/source.json": "57226905e783bae7c37c2dd662be078728e48fa28ee4324a7eabcafb5a43d014", "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", "https://bcr.bazel.build/modules/stardoc/0.5.1/source.json": "a96f95e02123320aa015b956f29c00cb818fa891ef823d55148e1a362caacf29", @@ -109,6 +105,36 @@ }, "recordedRepoMappingEntries": [] } + }, + "@@rules_python~//python/extensions:python.bzl%python": { + "general": { + "bzlTransitiveDigest": "GnREFVYskmF5MZu1H3nyqMWFZ2U/bty7gcbHX+l45kY=", + "usagesDigest": "7vjNHuEgQORYN9+9/77Q4zw1kawobM2oCQb9p0uhL68=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "pythons_hub": { + "bzlFile": "@@rules_python~//python/extensions/private:interpreter_hub.bzl", + "ruleClassName": "hub_repo", + "attributes": { + "toolchains": [] + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_python~", + "bazel_tools", + "bazel_tools" + ], + [ + "rules_python~", + "rules_python", + "rules_python~" + ] + ] + } } } } diff --git a/native/WORKSPACE b/native/WORKSPACE index 90acb78..7d49b13 100644 --- a/native/WORKSPACE +++ b/native/WORKSPACE @@ -77,9 +77,18 @@ http_archive( integrity = "sha256-Oxw7RuQW02kx79NGYxItf1G1UMh/dN4tOCSVFv59i+U=", ) -# http_archive( -# name="lz4", -# strip_prefix="lz4-1.9.4", -# urls = ["https://github.com/lz4/lz4/releases/download/v1.9.4/lz4-1.9.4.tar.gz"], -# build_file_content = all_content, -# ) \ No newline at end of file +http_archive( + name = "pybind11_bazel", + strip_prefix = "pybind11_bazel-2.11.1", + urls = ["https://github.com/pybind/pybind11_bazel/archive/v2.11.1.zip"], +) +# We still require the pybind library. +http_archive( + name = "pybind11", + build_file = "@pybind11_bazel//:pybind11.BUILD", + strip_prefix = "pybind11-2.11.1", + urls = ["https://github.com/pybind/pybind11/archive/v2.11.1.zip"], +) + +load("@pybind11_bazel//:python_configure.bzl", "python_configure") +python_configure(name = "local_config_python") \ No newline at end of file diff --git a/native/meds_reader.cc b/native/meds_reader.cc index 336884a..f0b464e 100644 --- a/native/meds_reader.cc +++ b/native/meds_reader.cc @@ -1109,6 +1109,8 @@ PyMODINIT_FUNC PyInit__meds_reader(void) { PyDateTime_IMPORT; + std::cout<