@@ -238,9 +238,13 @@ def edit_sdk_readme(content: List[str]):
238
238
239
239
modify_file (sdk_readme , edit_sdk_readme )
240
240
241
+ @property
242
+ def readme_md_path (self )-> Path :
243
+ return Path (self .spec_repo ) / "specification" / self .spec_readme .split ("specification/" )[- 1 ]
244
+
241
245
@property
242
246
def readme_python_md_path (self )-> Path :
243
- return Path (self .spec_repo ) / "specification" / self . spec_readme . split ( "specification/" )[ - 1 ]. replace ("readme.md" , "readme.python.md" )
247
+ return Path (str ( self .readme_md_path ). replace ("readme.md" , "readme.python.md" ) )
244
248
245
249
# Use the template to update readme and setup by packaging_tools
246
250
@return_origin_path
@@ -255,7 +259,7 @@ def check_file_with_packaging_tool(self):
255
259
title = line .replace ("title:" , "" ).strip (" \r \n " )
256
260
break
257
261
else :
258
- log ("{python_md} does not exist" )
262
+ log (f "{ python_md } does not exist" )
259
263
os .chdir (Path (f'sdk/{ self .sdk_folder } ' ))
260
264
# add `title` and update `is_stable` in sdk_packaging.toml
261
265
toml = Path (f"azure-mgmt-{ self .package_name } " ) / "sdk_packaging.toml"
@@ -406,15 +410,18 @@ def check_package_size(self):
406
410
def check_model_flatten (self ):
407
411
last_version = self .get_last_release_version ()
408
412
if last_version == "" or last_version .startswith ("1.0.0b" ):
413
+ with open (self .readme_md_path , 'r' ) as file_in :
414
+ readme_md_content = file_in .read ()
415
+
409
416
with open (self .readme_python_md_path , 'r' ) as file_in :
410
- content = file_in .read ()
417
+ readme_python_md_content = file_in .read ()
411
418
412
- if "flatten-models: false" not in content and self .issue_link :
419
+ if "flatten-models: false" not in readme_md_content and "flatten-models: false" not in readme_python_md_content and self .issue_link :
413
420
api = Github (self .bot_token ).get_repo ("Azure/sdk-release-request" )
414
421
issue_number = int (self .issue_link .split ('/' )[- 1 ])
415
422
issue = api .get_issue (issue_number )
416
423
assignee = issue .assignee .login if issue .assignee else ""
417
- message = "please set `flatten-models: false` in readme.python.md"
424
+ message = "please set `flatten-models: false` in readme.md or readme. python.md"
418
425
issue .create_comment (f'@{ assignee } , { message } ' )
419
426
raise Exception (message )
420
427
0 commit comments