Skip to content

Commit 78066ee

Browse files
committed
Add ignored deps to end of minimum requirements file
1 parent 894050e commit 78066ee

File tree

2 files changed

+42
-29
lines changed

2 files changed

+42
-29
lines changed

continuous-integration/requirements-minimum.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,6 @@ zipp~=3.17.0
190190
# emsarray
191191
# pytz
192192
# tzdata
193+
pytz
194+
certifi
195+
tzdata

scripts/min_deps_check.py

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import datetime
2323
import enum
2424
import itertools
25-
import shlex
2625
import subprocess
2726
import sys
2827
from collections.abc import Iterator
@@ -248,44 +247,55 @@ def main() -> None:
248247
f"{d.status:^6} {d.policy_version!s:10} ({policy_date:10})"
249248
)
250249

250+
# These packages need upgrading
251251
upgrade_args = list(itertools.chain.from_iterable(
252252
['--upgrade-package', f'{d.package_name}~={d.policy_version}']
253253
for d in dependencies
254254
if d.status is VersionStatus.older
255255
))
256+
257+
# These packages should be kept where they are
256258
maintain_args = list(itertools.chain.from_iterable(
257259
['--upgrade-package', f'{d.package_name}~={d.requirements_version}']
258260
for d in dependencies
259261
if d.status in {VersionStatus.current, VersionStatus.newer}
260262
))
261-
if upgrade_args:
262-
ignored_args = list(itertools.chain.from_iterable(
263-
['--unsafe-package', ignored]
264-
for ignored in IGNORE_DEPS
265-
))
266-
cmd = [
267-
'pip-compile',
268-
'--quiet',
269-
'--extra', 'complete',
270-
'--strip-extras',
271-
'--unsafe-package', 'emsarray',
272-
'--no-allow-unsafe',
273-
# '--no-header',
274-
# '--no-annotate',
275-
'--output-file', requirements_file,
276-
] + upgrade_args + maintain_args + ignored_args + [
277-
'pyproject.toml',
278-
]
279-
print('$', shlex.join(cmd))
280-
subprocess.check_call(cmd)
281-
cmd = [
282-
'sed',
283-
'-i',
284-
's/==/~=/',
285-
requirements_file,
286-
]
287-
print('$', shlex.join(cmd))
288-
subprocess.check_call(cmd)
263+
# These packages should be installed fresh every time, so ignore them for now.
264+
ignored_args = list(itertools.chain.from_iterable(
265+
['--unsafe-package', ignored]
266+
for ignored in IGNORE_DEPS
267+
))
268+
cmd = [
269+
'pip-compile',
270+
'--quiet',
271+
'--extra', 'complete',
272+
'--strip-extras',
273+
'--unsafe-package', 'emsarray',
274+
'--no-allow-unsafe',
275+
# '--no-header',
276+
# '--no-annotate',
277+
'--output-file', requirements_file,
278+
] + upgrade_args + maintain_args + ignored_args + [
279+
'pyproject.toml',
280+
]
281+
282+
# pip-compile always prints '==' specifiers,
283+
# but we want the latest point release in the minimum policy version.
284+
subprocess.check_call(cmd)
285+
cmd = [
286+
'sed',
287+
'-i',
288+
's/==/~=/',
289+
requirements_file,
290+
]
291+
subprocess.check_call(cmd)
292+
293+
# CI will install strictly the requirements present in this file and none more,
294+
# so append the ignored deps at the end with no version specifiers.
295+
with open(requirements_file, "a") as f:
296+
for ignored in IGNORE_DEPS:
297+
f.write(ignored)
298+
f.write("\n")
289299

290300
if errors:
291301
print("\nErrors:")

0 commit comments

Comments
 (0)