Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/ros2' into mjcarroll/bazel
Browse files Browse the repository at this point in the history
  • Loading branch information
mjcarroll committed Jan 8, 2025
2 parents c739c42 + 6ca51e6 commit d2e0934
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -27,7 +27,7 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/pycqa/flake8
rev: 4.0.1
rev: 7.1.1
hooks:
- id: flake8
args:
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
Changelog for package xacro
^^^^^^^^^^^^^^^^^^^^^^^^^^^

2.0.12 (2025-01-08)
-------------------
* Python 3.13 introduced new attr argument to _write_data (`#353 <https://github.com/ros/xacro/issues/353>`_)
* pyproject.toml: Automatically determine version from git
* Add function python.vars() (`#348 <https://github.com/ros/xacro/issues/348>`_)
* Contributors: Robert Haschke

2.0.11 (2024-04-02)
-------------------
* Allow substitution args without ROS (`#340 <https://github.com/ros/xacro/issues/340>`_)
Expand Down
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<package format="2">
<name>xacro</name>
<version>2.0.11</version>
<version>2.0.12</version>
<description>Xacro (XML Macros)
Xacro is an XML macro language. With xacro, you can construct shorter and more readable XML files by using macros that expand to larger XML expressions.
</description>
Expand Down
2 changes: 1 addition & 1 deletion xacro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def expose(*args, **kwargs):
# Expose all builtin symbols into the python namespace. Thus the stay accessible if the global symbol was overriden
expose('list', 'dict', 'map', 'len', 'str', 'float', 'int', 'True', 'False', 'min', 'max', 'round',
'abs', 'all', 'any', 'complex', 'divmod', 'enumerate', 'filter', 'frozenset', 'hash', 'isinstance', 'issubclass',
'ord', 'repr', 'reversed', 'slice', 'set', 'sum', 'tuple', 'type', 'zip', source=__builtins__, ns='python')
'ord', 'repr', 'reversed', 'slice', 'set', 'sum', 'tuple', 'type', 'vars', 'zip', source=__builtins__, ns='python')

# Expose all math symbols and functions into namespace math (and directly for backwards compatibility -- w/o deprecation)
expose([(k, v) for k, v in math.__dict__.items() if not k.startswith('_')], ns='math', deprecate_msg='')
Expand Down
9 changes: 8 additions & 1 deletion xacro/xmlutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ def reqd_attrs(tag, attrs):
raise RuntimeError("%s: missing attribute '%s'" % (tag.nodeName, name))
return result

# Python 3.13 introduced a new argument to xml.dom.minidom._write_data
# https://github.com/ros/xacro/issues/352
_WRITE_DATA_EXTRA_KWARGS = dict(attr=True)
try:
xml.dom.minidom._write_data(None, None, attr=True)
except TypeError:
_WRITE_DATA_EXTRA_KWARGS = {}

# Better pretty printing of xml
# Taken from http://ronrothman.com/public/leftbraned/xml-dom-minidom-toprettyxml-and-silly-whitespace/
Expand All @@ -120,7 +127,7 @@ def fixed_writexml(self, writer, indent="", addindent="", newl=""):

for a_name in a_names:
writer.write(" %s=\"" % a_name)
xml.dom.minidom._write_data(writer, attrs[a_name].value)
xml.dom.minidom._write_data(writer, attrs[a_name].value, **_WRITE_DATA_EXTRA_KWARGS)
writer.write("\"")
if self.childNodes:
if len(self.childNodes) == 1 \
Expand Down

0 comments on commit d2e0934

Please sign in to comment.