From f9dbbf516c3a71450f92385ca46bb28f39d740de Mon Sep 17 00:00:00 2001
From: Dong-hee Na <donghee.na@python.org>
Date: Mon, 20 Feb 2023 22:28:49 +0900
Subject: [PATCH 1/8] gh-101981: Make macOS CI as same as dev-guide

---
 .github/workflows/build.yml | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index acc8d936774af5..f3a48e45eb5981 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -160,15 +160,11 @@ jobs:
     - name: Install Homebrew dependencies
       run: brew install pkg-config openssl@1.1 xz gdbm tcl-tk
     - name: Prepare Homebrew environment variables
-      run: |
-        echo "CFLAGS=-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" >> $GITHUB_ENV
-        echo "LDFLAGS=-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" >> $GITHUB_ENV
-        echo "PKG_CONFIG_PATH=$(brew --prefix openssl@1.1)/lib/pkgconfig:$(brew --prefix tcl-tk)/lib/pkgconfig" >> $GITHUB_ENV
+      run: CFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" ./configure --with-pydebug --with-openssl=$(brew --prefix openssl@1.1)
     - name: Configure CPython
       run: |
         ./configure \
           --with-pydebug \
-          --prefix=/opt/python-dev \
           --with-openssl="$(brew --prefix openssl@1.1)"
     - name: Build CPython
       run: make -j4

From 61b0e25f8bbf39cabf9f233acc8da32c73d575ca Mon Sep 17 00:00:00 2001
From: Dong-hee Na <donghee.na92@gmail.com>
Date: Mon, 20 Feb 2023 22:31:42 +0900
Subject: [PATCH 2/8] Update .github/workflows/build.yml

Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
---
 .github/workflows/build.yml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f3a48e45eb5981..94257c62c04261 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -160,7 +160,11 @@ jobs:
     - name: Install Homebrew dependencies
       run: brew install pkg-config openssl@1.1 xz gdbm tcl-tk
     - name: Prepare Homebrew environment variables
-      run: CFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" ./configure --with-pydebug --with-openssl=$(brew --prefix openssl@1.1)
+      run: |
+        CFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" \
+        LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" \
+        PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \
+        ./configure --with-pydebug --with-openssl=$(brew --prefix openssl@1.1)
     - name: Configure CPython
       run: |
         ./configure \

From 0894d6fad2b463998cec6fe8b854f99d40bbbeb9 Mon Sep 17 00:00:00 2001
From: Dong-hee Na <donghee.na@python.org>
Date: Mon, 20 Feb 2023 22:33:52 +0900
Subject: [PATCH 3/8] Address code review

---
 .github/workflows/build.yml | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 94257c62c04261..ad60a912718672 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -159,17 +159,12 @@ jobs:
     - uses: actions/checkout@v3
     - name: Install Homebrew dependencies
       run: brew install pkg-config openssl@1.1 xz gdbm tcl-tk
-    - name: Prepare Homebrew environment variables
+    - name: Configure CPython by preparing Homebrew environment variables
       run: |
         CFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" \
         LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" \
         PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \
         ./configure --with-pydebug --with-openssl=$(brew --prefix openssl@1.1)
-    - name: Configure CPython
-      run: |
-        ./configure \
-          --with-pydebug \
-          --with-openssl="$(brew --prefix openssl@1.1)"
     - name: Build CPython
       run: make -j4
     - name: Display build info

From 990c31603ef4bbcf104ffff28a12ee99829d808c Mon Sep 17 00:00:00 2001
From: Dong-hee Na <donghee.na@python.org>
Date: Mon, 20 Feb 2023 22:37:54 +0900
Subject: [PATCH 4/8] Address code review

---
 .github/workflows/build.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ad60a912718672..693b9451f54a2c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -159,7 +159,7 @@ jobs:
     - uses: actions/checkout@v3
     - name: Install Homebrew dependencies
       run: brew install pkg-config openssl@1.1 xz gdbm tcl-tk
-    - name: Configure CPython by preparing Homebrew environment variables
+    - name: Configure CPython
       run: |
         CFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" \
         LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" \

From cb01a132b61c78be3c6d84905c6c322794ef7d53 Mon Sep 17 00:00:00 2001
From: Dong-hee Na <donghee.na@python.org>
Date: Mon, 20 Feb 2023 22:39:07 +0900
Subject: [PATCH 5/8] Apply @hugovk's suggestion

---
 .github/workflows/build.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 693b9451f54a2c..ae07bbd223f884 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -154,6 +154,8 @@ jobs:
     needs: check_source
     if: needs.check_source.outputs.run_tests == 'true'
     env:
+      HOMEBREW_NO_AUTO_UPDATE: 1
+      HOMEBREW_NO_INSTALL_CLEANUP: 1
       PYTHONSTRICTEXTENSIONBUILD: 1
     steps:
     - uses: actions/checkout@v3

From 9b0ed37709949ad7c74994ae9a4b2890a3faeef0 Mon Sep 17 00:00:00 2001
From: Dong-hee Na <donghee.na@python.org>
Date: Mon, 20 Feb 2023 23:11:37 +0900
Subject: [PATCH 6/8] Revive --prefix=/opt/python-dev

---
 .github/workflows/build.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ae07bbd223f884..9e5e91a9355e03 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -166,7 +166,7 @@ jobs:
         CFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" \
         LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" \
         PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \
-        ./configure --with-pydebug --with-openssl=$(brew --prefix openssl@1.1)
+        ./configure --with-pydebug --prefix=/opt/python-dev --with-openssl=$(brew --prefix openssl@1.1)
     - name: Build CPython
       run: make -j4
     - name: Display build info

From 60b44cb737aa9cd09430e08dc1717dcd88a87902 Mon Sep 17 00:00:00 2001
From: Dong-hee Na <donghee.na@python.org>
Date: Mon, 20 Feb 2023 23:16:57 +0900
Subject: [PATCH 7/8] Address code review

---
 .github/workflows/build.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 9e5e91a9355e03..3baa5104e2d3bc 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -154,6 +154,7 @@ jobs:
     needs: check_source
     if: needs.check_source.outputs.run_tests == 'true'
     env:
+      HOMEBREW_NO_ANALYTICS: 1
       HOMEBREW_NO_AUTO_UPDATE: 1
       HOMEBREW_NO_INSTALL_CLEANUP: 1
       PYTHONSTRICTEXTENSIONBUILD: 1

From fa06dede6479594282e5e9f282965eac6f489cc4 Mon Sep 17 00:00:00 2001
From: Dong-hee Na <donghee.na@python.org>
Date: Mon, 20 Feb 2023 23:54:10 +0900
Subject: [PATCH 8/8] Revert some changes

---
 .github/workflows/build.yml | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 3baa5104e2d3bc..eec11e25a7c7f6 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -162,12 +162,17 @@ jobs:
     - uses: actions/checkout@v3
     - name: Install Homebrew dependencies
       run: brew install pkg-config openssl@1.1 xz gdbm tcl-tk
+    - name: Prepare Homebrew environment variables
+      run: |
+        echo "CFLAGS=-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" >> $GITHUB_ENV
+        echo "LDFLAGS=-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" >> $GITHUB_ENV
+        echo "PKG_CONFIG_PATH=$(brew --prefix openssl@1.1)/lib/pkgconfig:$(brew --prefix tcl-tk)/lib/pkgconfig" >> $GITHUB_ENV
     - name: Configure CPython
       run: |
-        CFLAGS="-I$(brew --prefix gdbm)/include -I$(brew --prefix xz)/include" \
-        LDFLAGS="-L$(brew --prefix gdbm)/lib -I$(brew --prefix xz)/lib" \
-        PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \
-        ./configure --with-pydebug --prefix=/opt/python-dev --with-openssl=$(brew --prefix openssl@1.1)
+        ./configure \
+          --with-pydebug \
+          --prefix=/opt/python-dev \
+          --with-openssl="$(brew --prefix openssl@1.1)"
     - name: Build CPython
       run: make -j4
     - name: Display build info