Skip to content

Commit

Permalink
build: Add support for Python 3.10 (#772)
Browse files Browse the repository at this point in the history
* build: Add support for Python 3.10

This indicates that xml2rfc should work fine with python 3.10 as well
as the earlier versions.

I haven't tested (nor do i fully understand) the tox.ini and
.github/workflows/checks.yml changes, but hopefully some automated CI
will run against them and report if there are any problems.

* test: Bump version requirement for dict2xml to 1.7

This should fix a problem with the test suite under python3.10, since
dict2xml 1.6 used collections.Mapping, and 1.7 uses
collections.abc.Mapping.

* fix: Change manpage generation to work with Python 3.10

Co-authored-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
  • Loading branch information
kesara and dkg authored May 24, 2022
1 parent e0095fd commit 51e8b24
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

strategy:
matrix:
python-version: ['3.6', '3.7', '3.8', '3.9']
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']

steps:
- name: Checkout repository
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
echo "Installing pip + wheel..."
python -m pip install --upgrade pip wheel
echo "Installing requirements.txt + test dependencies..."
python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml==1.6 "pycairo<1.20" "PyPDF2<1.27.0" "weasyprint<53"
python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml==1.7 "pycairo<1.20" "PyPDF2<1.27.0" "weasyprint<53"
- name: Generate Valid Tests
run: |
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
echo "Installing pip + wheel..."
python -m pip install --upgrade pip wheel
echo "Installing requirements.txt + test dependencies..."
python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml==1.6 "pycairo<1.20" "PyPDF2<1.27.0" "weasyprint<53"
python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml==1.7 "pycairo<1.20" "PyPDF2<1.27.0" "weasyprint<53"
- name: Generate Valid Tests
run: |
Expand Down Expand Up @@ -201,8 +201,7 @@ jobs:
# echo "Installing pip + wheel..."
# python -m pip install --upgrade pip wheel
# echo "Installing requirements.txt + test dependencies..."
# python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml==1.6 pycairo "PyPDF2<1.27.0" "weasyprint<53"

# python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml==1.7 pycairo "PyPDF2<1.27.0" "weasyprint<53"
# - name: Generate Valid Tests
# run: |
# make yestests || true
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
license="BSD-3-Clause",

Expand Down
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
# and then run "tox" from this directory.

[tox]
envlist = py{36,37,38,39}-{linux,macos,windows}
envlist = py{36,37,38,39,310}-{linux,macos,windows}

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39
3.10: py310

[gh-actions:env]
PLATFORM =
Expand All @@ -30,7 +31,7 @@ allowlist_externals =
deps =
-rrequirements.txt
decorator
dict2xml==1.6
dict2xml==1.7
pycairo<1.20
pypdf2<1.27.0
weasyprint<53
3 changes: 2 additions & 1 deletion xml2rfc/writers/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ def process(self):
# This depend on at least one generic option with title being listed before '--config-file'
if a.container.title == 'Generic Options with Values':
genargs_group = a.container
if a.container.title == 'optional arguments':
if a.container.title == 'optional arguments' or a.container.title == 'options':
# Python 3.10 calls this 'options' while Python 3.6 to Python 3.9 calls this 'optional arguments'
a.container = genargs_group
# Deal with options that has an inverse form
option_strings = { a.option_strings[-1]: a for a in optionparser._actions if a.option_strings }
Expand Down

0 comments on commit 51e8b24

Please sign in to comment.