@@ -813,6 +813,7 @@ def execute_command(command: str) -> None:
813813 execute_command (f"find { destination } -type f -exec chmod 664 {{}} \\ ;" )
814814
815815
816+ @functools .cache
816817def extract_github_owner (url : str ) -> str :
817818 if https_match := re .match (r"(https://)?github\.com/([^/]+)/" , url ):
818819 return https_match .group (2 )
@@ -824,25 +825,36 @@ def extract_github_owner(url: str) -> str:
824825 )
825826
826827
827- def start_build_of_source_and_docs (db : ReleaseShelf ) -> None :
828- # Get the git commit SHA for the tag
828+ @functools .cache
829+ def get_commit_sha (git_version : str , git_repo : Path ) -> str :
830+ """Get the Git commit SHA for the tag"""
829831 commit_sha = (
830832 subprocess .check_output (
831- ["git" , "rev-list" , "-n" , "1" , db [ "release" ]. gitname ] , cwd = db [ " git_repo" ]
833+ ["git" , "rev-list" , "-n" , "1" , git_version ] , cwd = git_repo
832834 )
833835 .decode ()
834836 .strip ()
835837 )
838+ return commit_sha
839+
836840
837- # Get the owner of the GitHub repo (first path segment in a 'github.com' remote URL)
838- # This works for both 'https' and 'ssh' style remote URLs.
841+ @functools .cache
842+ def get_origin_remote_url (git_repo : Path ) -> str :
843+ """Get the owner of the GitHub repo (first path segment in a 'github.com' remote URL)
844+ This works for both 'https' and 'ssh' style remote URLs."""
839845 origin_remote_url = (
840846 subprocess .check_output (
841- ["git" , "ls-remote" , "--get-url" , "origin" ], cwd = db [ " git_repo" ]
847+ ["git" , "ls-remote" , "--get-url" , "origin" ], cwd = git_repo
842848 )
843849 .decode ()
844850 .strip ()
845851 )
852+ return origin_remote_url
853+
854+
855+ def start_build_of_source_and_docs (db : ReleaseShelf ) -> None :
856+ commit_sha = get_commit_sha (db ["release" ].gitname , db ["git_repo" ])
857+ origin_remote_url = get_origin_remote_url (db ["git_repo" ])
846858 origin_remote_github_owner = extract_github_owner (origin_remote_url )
847859 # We ask for human verification at this point since this commit SHA is 'locked in'
848860 print ()
@@ -887,6 +899,19 @@ def start_build_of_source_and_docs(db: ReleaseShelf) -> None:
887899
888900
889901def send_email_to_platform_release_managers (db : ReleaseShelf ) -> None :
902+ commit_sha = get_commit_sha (db ["release" ].gitname , db ["git_repo" ])
903+ origin_remote_url = get_origin_remote_url (db ["git_repo" ])
904+ origin_remote_github_owner = extract_github_owner (origin_remote_url )
905+ github_prefix = f"https://github.com/{ origin_remote_github_owner } /cpython/tree"
906+
907+ print ()
908+ print (f"{ github_prefix } /{ db ['release' ].gitname } " )
909+ print (f"Git commit SHA: { commit_sha } " )
910+ print (
911+ "Source/docs build: https://github.com/python/release-tools/actions/runs/[ENTER-RUN-ID-HERE]"
912+ )
913+ print ()
914+
890915 if not ask_question (
891916 "Have you notified the platform release managers about the availability of the commit SHA and tag?"
892917 ):
0 commit comments