Skip to content

Commit 9470cbf

Browse files
committed
Try and make the protobuf stuff work on Windows, which uses a ;
separator rather than a : one.
1 parent 53a959c commit 9470cbf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

build/protobuf.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
from build.utils import filenamesmatchingof, collectattrs
33
from os.path import join, abspath, dirname, relpath
44
from build.pkg import has_package
5+
import platform
56

67
G.setdefault("PROTOC", "protoc")
78
G.setdefault("HOSTPROTOC", "hostprotoc")
89

910
assert has_package("protobuf"), "required package 'protobuf' not installed"
1011

12+
PROTO_SEPARATOR = ";" if (platform.system() == "Windows") else ":"
1113

1214
def _getprotodeps(deps):
1315
r = set()
@@ -19,7 +21,7 @@ def _getprotodeps(deps):
1921
@Rule
2022
def proto(self, name, srcs: Targets = [], deps: Targets = []):
2123
protodeps = _getprotodeps(deps)
22-
descriptorlist = ":".join(
24+
descriptorlist = PROTO_SEPARATOR.join(
2325
[
2426
relpath(f, start=self.dir)
2527
for f in filenamesmatchingof(protodeps, "*.descriptor")
@@ -89,7 +91,7 @@ def protocc(self, name, srcs: Targets = [], deps: Targets = []):
8991
outs += ["=" + cc, "=" + h]
9092

9193
protodeps = _getprotodeps(deps + srcs)
92-
descriptorlist = ":".join(
94+
descriptorlist = PROTO_SEPARATOR.join(
9395
[
9496
relpath(f, start=self.dir)
9597
for f in filenamesmatchingof(protodeps, "*.descriptor")
@@ -142,7 +144,7 @@ def protojava(self, name, srcs: Targets = [], deps: Targets = []):
142144
protos += [f]
143145
srcs += [f]
144146

145-
descriptorlist = ":".join(
147+
descriptorlist = PROTO_SEPARATOR.join(
146148
[abspath(f) for f in filenamesmatchingof(srcs + deps, "*.descriptor")]
147149
)
148150

0 commit comments

Comments
 (0)