Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support old 'toml' package for Focal #670

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions colcon_core/python_project/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@

try:
# Python 3.11+
from tomllib import load as toml_load
from tomllib import loads as toml_loads
except ImportError:
from tomli import load as toml_load
try:
from tomli import loads as toml_loads
except ImportError:
from toml import loads as toml_loads

Check warning on line 11 in colcon_core/python_project/spec.py

View check run for this annotation

Codecov / codecov/patch

colcon_core/python_project/spec.py#L10-L11

Added lines #L10 - L11 were not covered by tests


SPEC_NAME = 'pyproject.toml'
Expand All @@ -25,7 +28,7 @@
spec_file = project_path / SPEC_NAME
try:
with spec_file.open('rb') as f:
spec = toml_load(f)
spec = toml_loads(f.read().decode())
except FileNotFoundError:
spec = {}

Expand Down
9 changes: 7 additions & 2 deletions debian/patches/setup.cfg.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Author: Dirk Thomas <[email protected]>

--- setup.cfg 2018-05-27 11:22:33.000000000 -0700
+++ setup.cfg.patched 2018-05-27 11:22:33.000000000 -0700
@@ -33,9 +33,12 @@
@@ -33,11 +33,16 @@
importlib-metadata; python_version < "3.8"
packaging
pytest
Expand All @@ -19,5 +19,10 @@ Author: Dirk Thomas <[email protected]>
+ # pytest-repeat
+ # pytest-rerunfailures
setuptools>=30.3.0
tomli>=1.0.0; python_version < "3.11"
- tomli>=1.0.0; python_version < "3.11"
+ # toml is also supported, rely on deb dependencies to select the
+ # appropriate package
+ # tomli>=1.0.0; python_version < "3.11"
packages = find:
zip_safe = false

1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ install_requires =
pytest-repeat
pytest-rerunfailures
setuptools>=30.3.0
# toml is also supported but deprecated
tomli>=1.0.0; python_version < "3.11"
packages = find:
zip_safe = false
Expand Down
2 changes: 1 addition & 1 deletion stdeb.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[colcon-core]
No-Python2:
Depends3: python3-distlib, python3-empy, python3-packaging, python3-pytest, python3-setuptools, python3 (>= 3.8) | python3-importlib-metadata, python3 (>= 3.11) | python3-tomli (>= 1)
Depends3: python3-distlib, python3-empy, python3-packaging, python3-pytest, python3-setuptools, python3 (>= 3.8) | python3-importlib-metadata, python3 (>= 3.11) | python3-tomli (>= 1) | python3-toml
Recommends3: python3-pytest-cov
Suggests3: python3-pytest-repeat, python3-pytest-rerunfailures
Replaces3: colcon
Expand Down
Loading