@@ -44,10 +44,10 @@ def configure_state_yaml() -> None:
4444 with open (PACKAGES_TO_ONBOARD_YAML , "r" ) as packages_to_onboard_yaml_file :
4545 packages_to_onboard = yaml .safe_load (packages_to_onboard_yaml_file )
4646
47- state_dict [
48- "image"
49- ] = "us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator:latest"
50- state_dict [ "libraries" ] = []
47+ state_dict = {}
48+ with open ( LIBRARIAN_YAML , "r" ) as state_yaml_file :
49+ state_dict = yaml . safe_load ( state_yaml_file )
50+
5151 for package_name in packages_to_onboard ["packages_to_onboard" ]:
5252 package_path = Path (PACKAGES_DIR / package_name ).resolve ()
5353 api_paths = []
@@ -61,30 +61,32 @@ def configure_state_yaml() -> None:
6161 }
6262 ]
6363 )
64- state_dict ["libraries" ].append (
65- {
66- "id" : package_name ,
67- "version" : release_please_manifest [f"packages/{ package_name } " ],
68- "last_generated_commit" : "97a83d76a09a7f6dcab43675c87bdfeb5bcf1cb5" ,
69- "apis" : api_paths ,
70- "source_roots" : [f"packages/{ package_path .name } " ],
71- "preserve_regex" : [
72- # Use the full path to avoid ambiguity with the root CHANGELOG.md
73- f"packages/{ package_path .name } /CHANGELOG.md" ,
74- "docs/CHANGELOG.md" ,
75- "docs/README.rst" ,
76- "samples/README.txt" ,
77- "tar.gz" ,
78- "gapic_version.py" ,
79- "samples/generated_samples/snippet_metadata_" ,
80- "scripts/client-post-processing" ,
81- "samples/snippets/README.rst" ,
82- "tests/system" ,
83- ],
84- "remove_regex" : [f"packages/{ package_path .name } " ],
85- "tag_format" : "{id}-v{version}" ,
86- }
87- )
64+
65+ if release_please_manifest .get (f"packages/{ package_name } " , None ):
66+ state_dict ["libraries" ].append (
67+ {
68+ "id" : package_name ,
69+ "version" : release_please_manifest [f"packages/{ package_name } " ],
70+ "last_generated_commit" : "97a83d76a09a7f6dcab43675c87bdfeb5bcf1cb5" ,
71+ "apis" : api_paths ,
72+ "source_roots" : [f"packages/{ package_path .name } " ],
73+ "preserve_regex" : [
74+ # Use the full path to avoid ambiguity with the root CHANGELOG.md
75+ f"packages/{ package_path .name } /CHANGELOG.md" ,
76+ "docs/CHANGELOG.md" ,
77+ "docs/README.rst" ,
78+ "samples/README.txt" ,
79+ "tar.gz" ,
80+ "gapic_version.py" ,
81+ "samples/generated_samples/snippet_metadata_" ,
82+ "scripts/client-post-processing" ,
83+ "samples/snippets/README.rst" ,
84+ "tests/system" ,
85+ ],
86+ "remove_regex" : [f"packages/{ package_path .name } " ],
87+ "tag_format" : "{id}-v{version}" ,
88+ }
89+ )
8890
8991 with open (LIBRARIAN_YAML , "w" ) as f :
9092 yaml .dump (state_dict , f , sort_keys = False , indent = 2 )
0 commit comments