Skip to content

Commit

Permalink
Include Python 3.12 when gathering constraints.
Browse files Browse the repository at this point in the history
  • Loading branch information
mauritsvanrees committed Dec 14, 2023
1 parent 438a582 commit 392886a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
24 changes: 18 additions & 6 deletions release/combine-constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,20 @@ def parse_file(filename):
constraints39 = os.path.join(directory, "constraints39.txt")
constraints310 = os.path.join(directory, "constraints310.txt")
constraints311 = os.path.join(directory, "constraints311.txt")
for filename in (constraints38, constraints39, constraints310, constraints311):
constraints312 = os.path.join(directory, "constraints312.txt")
for filename in (constraints38, constraints39, constraints310, constraints311, constraints312):
if not os.path.exists(filename):
print(f"ERROR: {filename} does not exist.")
print(
"Run: tox -p auto -e constraints38,constraints39,constraints310,constraints311,constraints"
"Run: tox -p auto -e constraints38,constraints39,constraints310,constraints311,constraints312,constraints"
)
sys.exit(1)

c38 = parse_file(constraints38)
c39 = parse_file(constraints39)
c310 = parse_file(constraints310)
c311 = parse_file(constraints311)
c312 = parse_file(constraints312)

# Gather them all in one dictionary.
pins = defaultdict(dict)
Expand All @@ -55,6 +57,8 @@ def parse_file(filename):
pins[package][310] = version
for package, version in c311.items():
pins[package][311] = version
for package, version in c312.items():
pins[package][312] = version

# Combine them.
combi = []
Expand All @@ -63,7 +67,8 @@ def parse_file(filename):
py39_version = versions.pop(39, None)
py310_version = versions.pop(310, None)
py311_version = versions.pop(311, None)
if py38_version == py39_version == py310_version == py311_version:
py312_version = versions.pop(312, None)
if py38_version == py39_version == py310_version == py311_version == py312_version:
# All versions are the same.
combi.append(f"{package}=={py311_version}")
continue
Expand All @@ -74,22 +79,29 @@ def parse_file(filename):
combi.append(f'{package}=={py38_version}; python_version == "3.8"')

# Check if Python 3.9 differs from the rest.
if py39_version == py310_version == py311_version and py39_version is not None:
if py39_version == py310_version == py311_version == py312_version and py39_version is not None:
combi.append(f'{package}=={py39_version}; python_version >= "3.9"')
continue
if py39_version is not None:
combi.append(f'{package}=={py39_version}; python_version == "3.9"')

# Check if Python 3.10 differs from the rest.
if py310_version == py311_version and py310_version is not None:
if py310_version == py311_version == py312_version and py310_version is not None:
combi.append(f'{package}=={py310_version}; python_version >= "3.10"')
continue
if py310_version is not None:
combi.append(f'{package}=={py310_version}; python_version == "3.10"')

# Check if Python 3.11 differs from the rest.
if py311_version == py312_version and py311_version is not None:
combi.append(f'{package}=={py310_version}; python_version >= "3.11"')
continue
if py311_version is not None:
combi.append(f'{package}=={py311_version}; python_version >= "3.11"')
combi.append(f'{package}=={py311_version}; python_version == "3.11"')

# Check if Python 3.12 differs from the rest.
if py312_version is not None:
combi.append(f'{package}=={py312_version}; python_version >= "3.12"')

output = "\n".join(combi) + "\n"
# sanity check:
Expand Down
6 changes: 5 additions & 1 deletion release/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ WSGIProxy2==0.5.1
WebOb==1.8.7
WebTest==3.0.0
ZConfig==4.0
ZEO==5.4.1
ZEO==5.4.1; python_version == "3.8"
ZEO==5.4.1; python_version == "3.9"
ZEO==5.4.1; python_version == "3.10"
ZEO==5.4.1; python_version == "3.11"
ZEO==6.0.0; python_version >= "3.12"
ZODB==5.8.1
ZODB3==3.11.0
Zope==5.9
Expand Down
7 changes: 6 additions & 1 deletion release/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ envlist =
constraints39,
constraints310,
constraints311,
constraints312,
constraints,
gather,

Expand All @@ -28,10 +29,14 @@ commands = python create-constraints.py {toxinidir}/../ecosystem.cfg {toxinidir}
basepython = python3.11
commands = python create-constraints.py {toxinidir}/../ecosystem.cfg {toxinidir}/constraints311.txt

[testenv:constraints312]
basepython = python3.12
commands = python create-constraints.py {toxinidir}/../ecosystem.cfg {toxinidir}/constraints312.txt

[testenv:constraints]
basepython = python3
# Specifying other tox envs as dependencies helps when running in parallel.
depends = constraints38, constraints39, constraints310, constraints311
depends = constraints38, constraints39, constraints310, constraints311, constraints312
commands_pre =
commands = python combine-constraints.py {toxinidir}

Expand Down

0 comments on commit 392886a

Please sign in to comment.