diff --git a/BUILD b/BUILD index 2f3f45a..ec837ff 100644 --- a/BUILD +++ b/BUILD @@ -61,6 +61,10 @@ cc_library( "@pcre", "@pixman", "@python", + "@python37//:headers", + "@python39//:headers", + "@python310//:headers", + "@python311//:headers", "@snappy", "@spdlog", "@utfcpp", diff --git a/tools/workspace/default.bzl b/tools/workspace/default.bzl index 3c1e1a0..ea0016e 100644 --- a/tools/workspace/default.bzl +++ b/tools/workspace/default.bzl @@ -62,6 +62,7 @@ load("//tools/workspace/python:repository.bzl", "python_repository") load("//tools/workspace/python37:repository.bzl", "python37_repository") load("//tools/workspace/python39:repository.bzl", "python39_repository") load("//tools/workspace/python310:repository.bzl", "python310_repository") +load("//tools/workspace/python311:repository.bzl", "python311_repository") load("//tools/workspace/snappy:repository.bzl", "snappy_repository") load("//tools/workspace/spdlog:repository.bzl", "spdlog_repository") load("//tools/workspace/utfcpp:repository.bzl", "utfcpp_repository") @@ -176,6 +177,8 @@ def add_default_repositories(excludes = [], config = get_default_config()): python39_repository(name = "python39") if "python310" not in excludes: python310_repository(name = "python310") + if "python311" not in excludes: + python311_repository(name = "python311") if "snappy" not in excludes: snappy_repository(name = "snappy") if "spdlog" not in excludes: diff --git a/tools/workspace/python311/BUILD b/tools/workspace/python311/BUILD new file mode 100644 index 0000000..e69de29 diff --git a/tools/workspace/python311/package.BUILD b/tools/workspace/python311/package.BUILD new file mode 100644 index 0000000..fcc879f --- /dev/null +++ b/tools/workspace/python311/package.BUILD @@ -0,0 +1,48 @@ +# -*- python -*- + +# Copyright 2018-2023 Josh Pieper, jjp@pobox.com. +# +# 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("@com_github_mjbots_bazel_deps//tools/workspace:autoconf_config.bzl", + "autoconf_config", "autoconf_standard_defines") +load("@com_github_mjbots_bazel_deps//tools/workspace:template_file.bzl", + "template_file") +load("@com_github_mjbots_bazel_deps//tools/workspace:generate_file.bzl", + "generate_file") + +package(default_visibility = ["//visibility:public"]) + +cc_library( + name = "headers", + hdrs = glob(["Include/*.h", "Include/cpython/*.h"]) + ["Include/pyconfig.h"], + includes = ["Include"], +) + +autoconf_config( + name = "Include/pyconfig.h", + src = "pyconfig.h.in", + package = "python", + version = "3.11.5", + defines = autoconf_standard_defines + [ + "DOUBLE_IS_LITTLE_ENDIAN_IEEE754", + "ENABLE_IPV6", + "PY_FORMAT_SIZE_T=\"z\"", + "RETSIGTYPE=void", + "USE_INLINE", + "WITH_DOC_STRINGS", + "WITH_THREAD", + "_FILE_OFFSET_BITS=64", + "_LARGEFILE_SOURCE", + ], +) diff --git a/tools/workspace/python311/repository.bzl b/tools/workspace/python311/repository.bzl new file mode 100644 index 0000000..bc7744e --- /dev/null +++ b/tools/workspace/python311/repository.bzl @@ -0,0 +1,29 @@ +# -*- python -*- + +# Copyright 2018-2023 Josh Pieper, jjp@pobox.com. +# +# 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("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + + +def python311_repository(name): + http_archive( + name = name, + urls = [ + "https://www.python.org/ftp/python/3.11.5/Python-3.11.5.tar.xz", + ], + sha256 = "85cd12e9cf1d6d5a45f17f7afe1cebe7ee628d3282281c492e86adf636defa3f", + strip_prefix = "Python-3.11.5", + build_file = Label("//tools/workspace/python311:package.BUILD"), + )