@@ -415,19 +415,21 @@ def gen_typespec(
415
415
typespec_python = "@azure-tools/typespec-python"
416
416
# call scirpt to generate sdk
417
417
try :
418
- tsp_dir = (Path (spec_folder ) / typespec_relative_path ).resolve ()
419
- repo_url = rest_repo_url .replace ("https://github.com/" , "" )
420
- tspconfig = tsp_dir / "tspconfig.yaml"
421
- if api_version and tspconfig .exists ():
422
- with open (tspconfig , "r" ) as file_in :
423
- content = yaml .safe_load (file_in )
424
- if content .get ("options" , {}).get ("@azure-tools/typespec-python" ):
425
- content ["options" ]["@azure-tools/typespec-python" ]["api-version" ] = api_version
426
- with open (tspconfig , "w" ) as file_out :
427
- yaml .dump (content , file_out )
428
- cmd = (
429
- f"tsp-client init --tsp-config { tsp_dir } --local-spec-repo { tsp_dir } --commit { head_sha } --repo { repo_url } "
430
- )
418
+ if spec_folder :
419
+ tsp_dir = (Path (spec_folder ) / typespec_relative_path ).resolve ()
420
+ repo_url = rest_repo_url .replace ("https://github.com/" , "" )
421
+ tspconfig = tsp_dir / "tspconfig.yaml"
422
+ if api_version and tspconfig .exists ():
423
+ with open (tspconfig , "r" ) as file_in :
424
+ content = yaml .safe_load (file_in )
425
+ if content .get ("options" , {}).get ("@azure-tools/typespec-python" ):
426
+ content ["options" ]["@azure-tools/typespec-python" ]["api-version" ] = api_version
427
+ with open (tspconfig , "w" ) as file_out :
428
+ yaml .dump (content , file_out )
429
+ cmd = f"tsp-client init --tsp-config { tsp_dir } --local-spec-repo { tsp_dir } --commit { head_sha } --repo { repo_url } "
430
+ else :
431
+ tsp_config_url = f"{ rest_repo_url } /blob/{ head_sha } /{ typespec_relative_path } /tspconfig.yaml"
432
+ cmd = f"tsp-client init -c { tsp_config_url } "
431
433
if run_in_pipeline :
432
434
emitter_name = "@azure-tools/typespec-python"
433
435
if not os .path .exists (f"node_modules/{ emitter_name } " ):
0 commit comments