@@ -813,6 +813,7 @@ def execute_command(command: str) -> None:
813
813
execute_command (f"find { destination } -type f -exec chmod 664 {{}} \\ ;" )
814
814
815
815
816
+ @functools .cache
816
817
def extract_github_owner (url : str ) -> str :
817
818
if https_match := re .match (r"(https://)?github\.com/([^/]+)/" , url ):
818
819
return https_match .group (2 )
@@ -824,25 +825,36 @@ def extract_github_owner(url: str) -> str:
824
825
)
825
826
826
827
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"""
829
831
commit_sha = (
830
832
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
832
834
)
833
835
.decode ()
834
836
.strip ()
835
837
)
838
+ return commit_sha
839
+
836
840
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."""
839
845
origin_remote_url = (
840
846
subprocess .check_output (
841
- ["git" , "ls-remote" , "--get-url" , "origin" ], cwd = db [ " git_repo" ]
847
+ ["git" , "ls-remote" , "--get-url" , "origin" ], cwd = git_repo
842
848
)
843
849
.decode ()
844
850
.strip ()
845
851
)
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" ])
846
858
origin_remote_github_owner = extract_github_owner (origin_remote_url )
847
859
# We ask for human verification at this point since this commit SHA is 'locked in'
848
860
print ()
@@ -887,6 +899,19 @@ def start_build_of_source_and_docs(db: ReleaseShelf) -> None:
887
899
888
900
889
901
def 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" ])
<
8589
code>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
+
890
915
if not ask_question (
891
916
"Have you notified the platform release managers about the availability of the commit SHA and tag?"
892
917
):
0 commit comments