Skip to content

Commit cb21016

Browse files
committed
Add a new --security-release flag
1 parent 6895e82 commit cb21016

File tree

2 files changed

+43
-8
lines changed

2 files changed

+43
-8
lines changed

release.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ def get(self, key: Literal["ssh_key"], default: str | None = None) -> str | None
6666
@overload
6767
def get(self, key: Literal["sign_gpg"], default: bool | None = None) -> bool: ...
6868

69+
@overload
70+
def get(self, key: Literal["security_release"], default: bool | None = None) -> bool: ...
71+
6972
@overload
7073
def get(self, key: Literal["release"], default: Tag | None = None) -> Tag: ...
7174

@@ -93,6 +96,9 @@ def __getitem__(self, key: Literal["ssh_key"]) -> str | None: ...
9396
@overload
9497
def __getitem__(self, key: Literal["sign_gpg"]) -> bool: ...
9598

99+
@overload
100+
def __getitem__(self, key: Literal["security_release"]) -> bool: ...
101+
96102
@overload
97103
def __getitem__(self, key: Literal["release"]) -> Tag: ...
98104

@@ -122,6 +128,9 @@ def __setitem__(self, key: Literal["ssh_key"], value: str | None) -> None: ...
122128
@overload
123129
def __setitem__(self, key: Literal["sign_gpg"], value: bool) -> None: ...
124130

131+
@overload
132+
def __setitem__(self, key: Literal["security_release"], value: bool) -> None: ...
133+
125134
@overload
126135
def __setitem__(self, key: Literal["release"], value: Tag) -> None: ...
127136

run_release.py

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ def __init__(
194194
ssh_user: str,
195195
sign_gpg: bool,
196196
ssh_key: str | None = None,
197+
security_release: bool = False,
197198
first_state: Task | None = None,
198199
) -> None:
199200
self.tasks = tasks
@@ -220,6 +221,8 @@ def __init__(
220221
self.db["ssh_key"] = ssh_key
221222
if not self.db.get("sign_gpg"):
222223
self.db["sign_gpg"] = sign_gpg
224+
if not self.db.get("security_release"):
225+
self.db["security_release"] = security_release
223226

224227
if not self.db.get("release"):
225228
self.db["release"] = release_tag
@@ -233,6 +236,7 @@ def __init__(
233236
print(f"- SSH key: {self.db['ssh_key'] or 'Default'}")
234237
print(f"- python.org API key: {self.db['auth_info']}")
235238
print(f"- Sign with GPG: {self.db['sign_gpg']}")
239+
print(f"- Security release: {self.db['security_release']}")
236240
print()
237241

238242
def checkpoint(self) -> None:
@@ -930,18 +934,32 @@ def wait_until_all_files_are_in_folder(db: ReleaseShelf) -> None:
930934
are_windows_files_there = f"python-{release}.exe" in all_files
931935
are_macos_files_there = f"python-{release}-macos11.pkg" in all_files
932936
are_linux_files_there = f"Python-{release}.tgz" in all_files
933-
are_all_files_there = (
934-
are_linux_files_there and are_windows_files_there and are_macos_files_there
935-
)
937+
938+
if db["security_release"]:
939+
# For security releases, only check Linux files
940+
are_all_files_there = are_linux_files_there
941+
else:
942+
# For regular releases, check all platforms
943+
are_all_files_there = (
944+
are_linux_files_there and are_windows_files_there and are_macos_files_there
945+
)
946+
936947
if not are_all_files_there:
937948
linux_tick = "✅" if are_linux_files_there else "❌"
938949
windows_tick = "✅" if are_windows_files_there else "❌"
939950
macos_tick = "✅" if are_macos_files_there else "❌"
940-
print(
941-
f"\rWaiting for files: Linux {linux_tick} Windows {windows_tick} Mac {macos_tick} ",
942-
flush=True,
943-
end="",
944-
)
951+
if db["security_release"]:
952+
print(
953+
f"\rWaiting for files: Linux {linux_tick} (security release mode - only checking Linux) ",
954+
flush=True,
955+
end="",
956+
)
957+
else:
958+
print(
959+
f"\rWaiting for files: Linux {linux_tick} Windows {windows_tick} Mac {macos_tick} ",
960+
flush=True,
961+
end="",
962+
)
945963
time.sleep(1)
946964
print()
947965

@@ -1273,6 +1291,13 @@ def _api_key(api_key: str) -> str:
12731291
help="Path to the SSH key file to use for authentication",
12741292
type=str,
12751293
)
1294+
parser.add_argument(
1295+
"--security-release",
1296+
dest="security_release",
1297+
action="store_true",
1298+
default=False,
1299+
help="Indicate this is a security release (only checks for Linux files)",
1300+
)
12761301
args = parser.parse_args()
12771302

12781303
auth_key = args.auth_key or os.getenv("AUTH_INFO")
@@ -1368,6 +1393,7 @@ def _api_key(api_key: str) -> str:
13681393
ssh_user=args.ssh_user,
13691394
sign_gpg=not no_gpg,
13701395
ssh_key=args.ssh_key,
1396+
security_release=args.security_release,
13711397
tasks=tasks,
13721398
)
13731399
automata.run()

0 commit comments

Comments
 (0)