Skip to content

Commit

Permalink
Add headers for python 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
jpieper committed Sep 15, 2023
1 parent c1c112d commit 80b6a33
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 0 deletions.
4 changes: 4 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ cc_library(
"@pcre",
"@pixman",
"@python",
"@python37//:headers",
"@python39//:headers",
"@python310//:headers",
"@python311//:headers",
"@snappy",
"@spdlog",
"@utfcpp",
Expand Down
3 changes: 3 additions & 0 deletions tools/workspace/default.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down
Empty file added tools/workspace/python311/BUILD
Empty file.
48 changes: 48 additions & 0 deletions tools/workspace/python311/package.BUILD
Original file line number Diff line number Diff line change
@@ -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",
],
)
29 changes: 29 additions & 0 deletions tools/workspace/python311/repository.bzl
Original file line number Diff line number Diff line change
@@ -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"),
)

0 comments on commit 80b6a33

Please sign in to comment.