22from build .utils import filenamesmatchingof , collectattrs
33from os .path import join , abspath , dirname , relpath
44from build .pkg import has_package
5- import platform
65
76G .setdefault ("PROTOC" , "protoc" )
87G .setdefault ("HOSTPROTOC" , "hostprotoc" )
98
109assert has_package ("protobuf" ), "required package 'protobuf' not installed"
1110
12- PROTO_SEPARATOR = ";" if (platform .system () == "Windows" ) else ":"
1311
1412def _getprotodeps (deps ):
1513 r = set ()
@@ -21,7 +19,7 @@ def _getprotodeps(deps):
2119@Rule
2220def proto (self , name , srcs : Targets = [], deps : Targets = []):
2321 protodeps = _getprotodeps (deps )
24- descriptorlist = PROTO_SEPARATOR .join (
22+ descriptorlist = ":" .join (
2523 [
2624 relpath (f , start = self .dir )
2725 for f in filenamesmatchingof (protodeps , "*.descriptor" )
@@ -48,7 +46,7 @@ def proto(self, name, srcs: Targets = [], deps: Targets = []):
4846 f"--descriptor_set_out={ self .localname } .descriptor" ,
4947 ]
5048 + (
51- [f"--descriptor_set_in=' { descriptorlist } ' " ]
49+ [f"--descriptor_set_in={ descriptorlist } " ]
5250 if descriptorlist
5351 else []
5452 )
@@ -91,7 +89,7 @@ def protocc(self, name, srcs: Targets = [], deps: Targets = []):
9189 outs += ["=" + cc , "=" + h ]
9290
9391 protodeps = _getprotodeps (deps + srcs )
94- descriptorlist = PROTO_SEPARATOR .join (
92+ descriptorlist = ":" .join (
9593 [
9694 relpath (f , start = self .dir )
9795 for f in filenamesmatchingof (protodeps , "*.descriptor" )
@@ -112,7 +110,7 @@ def protocc(self, name, srcs: Targets = [], deps: Targets = []):
112110 "$(PROTOC)" ,
113111 "--proto_path=." ,
114112 "--cpp_out=." ,
115- f"--descriptor_set_in=' { descriptorlist } ' " ,
113+ f"--descriptor_set_in={ descriptorlist } " ,
116114 ]
117115 + protos
118116 )
@@ -144,7 +142,7 @@ def protojava(self, name, srcs: Targets = [], deps: Targets = []):
144142 protos += [f ]
145143 srcs += [f ]
146144
147- descriptorlist = PROTO_SEPARATOR .join (
145+ descriptorlist = ":" .join (
148146 [abspath (f ) for f in filenamesmatchingof (srcs + deps , "*.descriptor" )]
149147 )
150148
@@ -163,7 +161,7 @@ def protojava(self, name, srcs: Targets = [], deps: Targets = []):
163161 "$(PROTOC)" ,
164162 "--proto_path=." ,
165163 "--java_out=." ,
166- f"--descriptor_set_in=' { descriptorlist } ' " ,
164+ f"--descriptor_set_in={ descriptorlist } " ,
167165 ]
168166 + protos
169167 )
0 commit comments