4848from urllib .parse import urljoin
4949
5050import jinja2
51- import tomlkit
51+ import tomllib
5252import urllib3
5353import zc .lockfile
5454
@@ -915,7 +915,7 @@ def should_rebuild(self):
915915 def load_state (self ) -> dict :
916916 state_file = self .build_root / "state.toml"
917917 try :
918- return tomlkit .loads (state_file .read_text (encoding = "UTF-8" ))[
918+ return tomllib .loads (state_file .read_text (encoding = "UTF-8" ))[
919919 f"/{ self .language .tag } /{ self .version .name } /"
920920 ]
921921 except (KeyError , FileNotFoundError ):
@@ -928,9 +928,9 @@ def save_state(self, build_duration: float):
928928 """
929929 state_file = self .build_root / "state.toml"
930930 try :
931- states = tomlkit .parse (state_file .read_text (encoding = "UTF-8" ))
931+ states = tomllib .parse (state_file .read_text (encoding = "UTF-8" ))
932932 except FileNotFoundError :
933- states = tomlkit .document ()
933+ states = tomllib .document ()
934934
935935 state = {}
936936 state ["cpython_sha" ] = self .cpython_repo .run ("rev-parse" , "HEAD" ).stdout .strip ()
@@ -941,7 +941,7 @@ def save_state(self, build_duration: float):
941941 state ["last_build" ] = dt .now (timezone .utc )
942942 state ["last_build_duration" ] = build_duration
943943 states [f"/{ self .language .tag } /{ self .version .name } /" ] = state
944- state_file .write_text (tomlkit .dumps (states ), encoding = "UTF-8" )
944+ state_file .write_text (tomllib .dumps (states ), encoding = "UTF-8" )
945945
946946
947947def symlink (
@@ -1092,7 +1092,7 @@ def parse_versions_from_devguide(http: urllib3.PoolManager) -> list[Version]:
10921092
10931093def parse_languages_from_config () -> list [Language ]:
10941094 """Read config.toml to discover languages to build."""
1095- config = tomlkit .parse ((HERE / "config.toml" ).read_text (encoding = "UTF-8" ))
1095+ config = tomllib .parse ((HERE / "config.toml" ).read_text (encoding = "UTF-8" ))
10961096 languages = []
10971097 defaults = config ["defaults" ]
10981098 for iso639_tag , section in config ["languages" ].items ():
0 commit comments