Skip to content

Commit 2096f5c

Browse files
authored
Merge pull request #203 from garrettmoon/master
Upgrade to python3 / fix build on 12.3
2 parents 5b03215 + 2071382 commit 2096f5c

File tree

9 files changed

+29
-39
lines changed

9 files changed

+29
-39
lines changed

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.0
1+
5.1.0

BazelExtensions/acknowledgement_merger.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22

33
import sys
44
import plistlib
5-
from sets import Set
65

76
if len(sys.argv) < 3:
87
print("Usage <merge|finalize> output_file [inputs]")
@@ -12,21 +11,22 @@
1211
action = sys.argv[1]
1312

1413
merged_fragments = []
15-
seen_licenses = Set()
14+
seen_licenses = set()
1615
for idx, arg in enumerate(sys.argv):
1716
if idx <= 2:
1817
continue
19-
input_plist = plistlib.readPlist(arg)
20-
if not input_plist:
21-
continue
22-
fragments = input_plist if isinstance(input_plist, list) else [input_plist]
23-
for fragment in fragments:
24-
# We only want to insert a given software license 1 time
25-
title = fragment.get("Title")
26-
if title in seen_licenses:
18+
with open(arg, 'rb') as f:
19+
input_plist = plistlib.load(f, fmt=plistlib.FMT_XML)
20+
if not input_plist:
2721
continue
28-
seen_licenses.add(title)
29-
merged_fragments.append(fragment)
22+
fragments = input_plist if isinstance(input_plist, list) else [input_plist]
23+
for fragment in fragments:
24+
# We only want to insert a given software license 1 time
25+
title = fragment.get("Title")
26+
if title in seen_licenses:
27+
continue
28+
seen_licenses.add(title)
29+
merged_fragments.append(fragment)
3030

3131
if action == "--finalize":
3232
out_plist = {

BazelExtensions/headermap_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
from __future__ import print_function
33

44
import json

BazelExtensions/headermap_tool.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# This file is part of The LLVM Compiler Infrastructure
33
#
44
# This file is distributed under the University of Illinois Open Source
@@ -31,6 +31,8 @@ class HeaderMap(object):
3131
def frompath(path):
3232
with open(path, 'rb') as f:
3333
magic = f.read(4)
34+
if isinstance(magic, bytes):
35+
magic = magic.decode("utf-8")
3436
if magic == k_header_magic_LE:
3537
endian_code = '<'
3638
elif magic == k_header_magic_BE:
@@ -84,6 +86,8 @@ def frompath(path):
8486
raise SystemExit("error: %s: unable to read zero-sized string table"%(
8587
path,))
8688
strtable = f.read(strtable_size)
89+
if isinstance(strtable, bytes):
90+
strtable = strtable.decode("utf-8")
8791

8892
if len(strtable) != strtable_size:
8993
raise SystemExit("error: %s: unable to read complete string table"%(

Examples/BasiciOS/.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.0
1+
5.1.0

Examples/BasiciOS/WORKSPACE

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ load("@rules_pods//BazelExtensions:workspace.bzl", "new_pod_repository")
99

1010
http_archive(
1111
name = "build_bazel_rules_apple",
12-
sha256 = "a41a75c291c69676b9974458ceee09aea60cee0e1ee282e27cdc90b679dfd30f",
13-
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.21.2/rules_apple.0.21.2.tar.gz",
12+
sha256 = "77e8bf6fda706f420a55874ae6ee4df0c9d95da6c7838228b26910fc82eea5a2",
13+
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.32.0/rules_apple.0.32.0.tar.gz",
1414
)
1515

1616
load(
@@ -34,13 +34,6 @@ load(
3434

3535
swift_rules_dependencies()
3636

37-
load(
38-
"@com_google_protobuf//:protobuf_deps.bzl",
39-
"protobuf_deps",
40-
)
41-
42-
protobuf_deps()
43-
4437
new_pod_repository(
4538
name = "SlackTextViewController",
4639
url = "https://github.com/slackhq/SlackTextViewController/archive/v1.9.6.zip",

Examples/React/.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.0
1+
5.1.0

Examples/React/WORKSPACE

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ http_archive(
77

88
http_archive(
99
name = "build_bazel_rules_apple",
10-
sha256 = "a41a75c291c69676b9974458ceee09aea60cee0e1ee282e27cdc90b679dfd30f",
11-
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.21.2/rules_apple.0.21.2.tar.gz",
10+
sha256 = "77e8bf6fda706f420a55874ae6ee4df0c9d95da6c7838228b26910fc82eea5a2",
11+
url = "https://github.com/bazelbuild/rules_apple/releases/download/0.32.0/rules_apple.0.32.0.tar.gz",
1212
)
1313

1414
load(
@@ -31,10 +31,3 @@ load(
3131
)
3232

3333
swift_rules_dependencies()
34-
35-
load(
36-
"@com_google_protobuf//:protobuf_deps.bzl",
37-
"protobuf_deps",
38-
)
39-
40-
protobuf_deps()

bin/update_pods.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python3
22
# update_pods.py Installs pods specified in Pods.WORKSPACE to $SRC_ROOT/Vendor/
33

44
from subprocess import Popen, PIPE
@@ -129,7 +129,7 @@ def GetTrace(self):
129129
return self.trace
130130

131131
def HashFile(path):
132-
f = open(path, "r")
132+
f = open(path, "rb")
133133
f_hash = str(hash(f.read()))
134134
f.close()
135135
return str(f_hash)
@@ -203,7 +203,7 @@ def _needs_update(invocation_info):
203203
pod_root_dir = repository_ctx.GetPodRootDir()
204204
_exec(repository_ctx, ["/bin/bash", "-c", "mkdir -p " + pod_root_dir])
205205
_exec(repository_ctx, ["/bin/bash", "-c", "touch .pod-version"], pod_root_dir)
206-
cached_version = _exec(repository_ctx, ["/bin/bash", "-c", "cat .pod-version"], pod_root_dir).split("\n")[0]
206+
cached_version = _exec(repository_ctx, ["/bin/bash", "-c", "cat .pod-version"], pod_root_dir).split(b'\n')[0]
207207
return GetVersion(invocation_info) != cached_version
208208

209209
def _load_repo_if_needed(repository_ctx, repo_tool_bin_path):

0 commit comments

Comments
 (0)