@@ -26,6 +26,8 @@ def find_project_root() -> Path:
26
26
VENV_BIN_DIR = VENV_DIR / "bin"
27
27
PYTHON_EXE = VENV_BIN_DIR / "python"
28
28
FFI_DIR = GLIDE_ROOT / "ffi"
29
+ GLIDE_SYNC_NAME = "GlidePySync"
30
+ GLIDE_ASYNC_NAME = "GlidePy"
29
31
30
32
31
33
def check_dependencies () -> None :
@@ -129,26 +131,48 @@ def generate_protobuf_files() -> None:
129
131
print (f"[OK] Protobuf files (.py + .pyi) generated at: { proto_dst } " )
130
132
131
133
132
- def build_async_client (release : bool , no_cache : bool = False ) -> None :
134
+ def build_async_client (
135
+ glide_version : str , release : bool , no_cache : bool = False
136
+ ) -> None :
133
137
print (
134
- f"[INFO] Building async client in { 'release' if release else 'debug' } mode..."
138
+ f"[INFO] Building async client with version= { glide_version } in { 'release' if release else 'debug' } mode..."
135
139
)
136
140
env = activate_venv (no_cache )
141
+ env .update (
142
+ { # Update it with your GLIDE variables
143
+ "GLIDE_NAME" : GLIDE_ASYNC_NAME ,
144
+ "GLIDE_VERSION" : glide_version ,
145
+ }
146
+ )
137
147
generate_protobuf_files ()
138
148
139
149
cmd = [str (PYTHON_EXE ), "-m" , "maturin" , "develop" ]
140
150
if release :
141
151
cmd += ["--release" , "--strip" ]
142
152
143
- run_command (cmd , cwd = PYTHON_DIR , env = env , label = "maturin develop" )
153
+ run_command (
154
+ cmd ,
155
+ cwd = PYTHON_DIR ,
156
+ env = env ,
157
+ label = "maturin develop" ,
158
+ )
144
159
print ("[OK] Async client build completed" )
145
160
146
161
147
- def build_sync_client () -> None :
148
- print ("[INFO] Building sync client..." )
162
+ def build_sync_client (glide_version : str ) -> None :
163
+ print (f "[INFO] Building sync client with version= { glide_version } ..." )
149
164
generate_protobuf_files ()
150
165
151
- run_command (["cargo" , "build" ], cwd = FFI_DIR , label = "cargo build ffi" )
166
+ run_command (
167
+ ["cargo" , "build" ],
168
+ cwd = FFI_DIR ,
169
+ label = "cargo build ffi" ,
170
+ env = {
171
+ "GLIDE_NAME" : GLIDE_SYNC_NAME ,
172
+ "GLIDE_VERSION" : glide_version ,
173
+ ** os .environ ,
174
+ },
175
+ )
152
176
153
177
print ("[OK] Sync client build completed" )
154
178
@@ -255,6 +279,12 @@ def main() -> None:
255
279
action = "store_true" ,
256
280
help = "Install Python dependencies without cache" ,
257
281
)
282
+ build_parser .add_argument (
283
+ "--glide-version" ,
284
+ type = str ,
285
+ default = "unknown" ,
286
+ help = "Specify the client version that will be used for server identification and displayed in CLIENT INFO output" ,
287
+ )
258
288
259
289
subparsers .add_parser (
260
290
"protobuf" , help = "Generate Python protobuf files including .pyi stubs"
@@ -295,10 +325,10 @@ def main() -> None:
295
325
no_cache = args .no_cache
296
326
if args .client in ["async" , "all" ]:
297
327
print (f"🛠 Building async client ({ args .mode } mode)..." )
298
- build_async_client (release , no_cache )
328
+ build_async_client (args . glide_version , release , no_cache )
299
329
if args .client in ["sync" , "all" ]:
300
330
print ("🛠 Building sync client..." )
301
- build_sync_client ()
331
+ build_sync_client (glide_version = args . glide_version )
302
332
303
333
print ("[✅ DONE] Task completed successfully." )
304
334
0 commit comments