Commit Graph

9 Commits

Author SHA1 Message Date
Igor Ponomarev
daecc226ee tools: Fix generate-docs-nm-settings-docs-gir.py on Python 2
On python2 the following error is raised:

`LookupError: unknown encoding: unicode`

Seems like `unicode` is a correct encoding in Python 3 but not 2.

Fix:

1. Change encoding to `utf-8`
2. Pass output path string instead of opening file and passing
   opened file object. Python2 and 3 might need different file
   modes, passing just path lets ElementTree select appropriate
   file mode.

Fixes: f00e90923c ('tools: Use ElementTree to write XML in generate-docs-nm-settings-docs-gir.py')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1249
2022-06-03 08:26:12 +02:00
Igor Ponomarev
f00e90923c tools: Use ElementTree to write XML in generate-docs-nm-settings-docs-gir.py
Instead of manually writting XML line by line.
Quoting is automatic.
Makes it much easier to modify. (just add new elements)

Generated XML not indented at the moment.
2022-05-31 13:28:59 +02:00
Igor Ponomarev
a2298d31c0 tools: Modernize generate-docs-nm-settings-docs-gir.py to 2022 standards
* Create main() function and put its execution under
  __name__ == '__main__' guard.
* Only one module import per line
* Use required=True to check if necessary arguments have
  been passed.
* Remove usage() as ArgumentParser handles that already
2022-05-31 13:28:51 +02:00
Thomas Haller
aaf2155023 libnm/docs: fix documentation for "proxy.pac-script" 2022-03-21 15:21:37 +01:00
Thomas Haller
977ea352a0 all: update deprecated SPDX license identifiers
These SPDX license identifiers are deprecated ([1]). Update them.

[1] https://spdx.org/licenses/

  sed \
     -e '1 s%^/\* SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+ \*/$%/* SPDX-License-Identifier: \1-or-later */%' \
     -e '1,2 s%^\(--\|#\|//\) SPDX-License-Identifier: \(GPL-2.0\|LGPL-2.1\)+$%\1 SPDX-License-Identifier: \2-or-later%' \
     -i \
     $(git grep -l SPDX-License-Identifier -- \
         ':(exclude)shared/c-*/' \
         ':(exclude)shared/n-*/' \
         ':(exclude)shared/systemd/src' \
         ':(exclude)src/systemd/src')
2021-01-05 09:46:21 +01:00
Valentin David
54e25f23f5 build/docs: fix generated XML syntax in tools/generate-docs-nm-settings-docs-gir.py
Class description may contains double quotes which is not valid as XML
attribute value.

[thaller@redhat.com: adjust original patch to reformat code with python black]

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/620
2020-09-08 17:35:14 +02:00
Thomas Haller
5b7d39f8e1 docs: fix escaping XML in "tools/generate-docs-nm-settings-docs-gir.py"
The gtk-doc text that the tool receives is not XML, it's a plain text.
When setting the plain text as XML attribute, we need to properly escape
it. The previous XML escape code was naive, and didn't cover for a
plain ampersand.

(cherry picked from commit 1641cc1d03)
2020-06-26 13:33:41 +02:00
Sayed Shah
be822b52e6 all: reformat python files with python black
Part of !537.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/537
2020-06-15 16:40:38 +02:00
Thomas Haller
87edf2f298 docs: move generate-docs scripts from "libnm/" to "tools/"
They are not only used in "libnm/" directory. Move to "tools/".
2020-06-11 10:53:50 +02:00