@@ -424,6 +424,24 @@ def run_blurb_release(db: ReleaseShelf) -> None:
424424 )
425425
426426
427+ def check_cpython_repo_age (db : ReleaseShelf ) -> None :
428+ # %ct = committer date, UNIX timestamp (for example, "1768300016")
429+ timestamp = subprocess .check_output (
430+ shlex .split ('git log -1 --format="%ct"' ), text = True , cwd = db ["git_repo" ]
431+ ).strip ()
432+ age_seconds = time .time () - int (timestamp .strip ())
433+ is_old = age_seconds > 86400 # 1 day
434+
435+ # cr = committer date, relative (for example, "3 days ago")
436+ out = subprocess .check_output (
437+ shlex .split ('git log -1 --format="%cr"' ), text = True , cwd = db ["git_repo" ]
438+ )
439+ print (f"Last CPython commit was { out .strip ()} " )
440+
441+ if is_old and not ask_question ("Continue with old repo?" ):
442+ raise ReleaseException ("CPython repository is old" )
443+
444+
427445def check_cpython_repo_is_clean (db : ReleaseShelf ) -> None :
428446 if subprocess .check_output (["git" , "status" , "--porcelain" ], cwd = db ["git_repo" ]):
429447 raise ReleaseException ("Git repository is not clean" )
@@ -1381,6 +1399,7 @@ def _api_key(api_key: str) -> str:
13811399 ),
13821400 Task (check_sigstore_client , "Checking Sigstore CLI" ),
13831401 Task (check_buildbots , "Check buildbots are good" ),
1402+ Task (check_cpython_repo_age , "Checking CPython repository age" ),
13841403 Task (check_cpython_repo_is_clean , "Checking Git repository is clean" ),
13851404 * (
13861405 [Task (check_magic_number , "Checking the magic number is up-to-date" )]
0 commit comments