Skip to content

Python 3.x support for patman & dtoc

Paul Burton u-boot 1 version New

Get series with b4
b4 am 6829127.WmcsQfSS5k@np-p-burton

Versions newest first

  1. v1 Latest0 of 9 patches 0 repliesNew

Patches in v1 No applies recorded yet

None of the 9 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [U-Boot] [PATCH 0/9] Python 3.x support for patman & dtoc
Quoted 9 lines · On Monday, 26 September 2016 18:33:19 BST Simon Glass wrote:

Hi Paul,

Quoted 4 lines · Paul Burton

This series makes patman & dtoc run on python 3.x, which allows them to work without hacks on distributions where the python binary is python 3.x. All changes are made in a way that continue to work on python 2.x, so both tools should work on either major version of python.

Thanks for doing this! Does it still install correctly with setup.py?

Hi Simon,

No problem - I've been meaning to for a while!

It seems to install fine when using python2 (& neat, I hadn't noticed there was an installer before). When using python3 it installs fine but then when running it imports fail with messages like:

Quoted 1 line
Quoted 1 line
Quoted 1 line

from patman import settings

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pburton/.local/lib/python3.5/site-packages/patman/settings.py",
line 16, in <module>
import command
ImportError: No module named 'command'

I'm not sure what the best way to fix that is. We could import in all files the way patman.py does, wrapped in a try except block (though should that go the other way round to what it is now? ie. won't it currently always import the installed version even if you run patman from the source tree?) Alternatively we could run patman using a wrapper script in tools/ or move all the patman source a level down & have a wrapper script in tools/patman/ then use "from patman import x" in all cases. Any preferences?

Thanks,
Paul

Quoted 29 lines
Quoted 29 lines

Paul Burton (9):
patman: Replace tabs with spaces
patman: Make print statements python 3.x safe
patman: Make exception handling python 3.x safe
patman: Import 'configparser' lower case to be python 3.x safe
patman: Decode stdout/stderr as utf8, be python 3.x safe
patman: Use items() to iterate over dictionaries in python 3.x
dtoc: Use items() to iterate over dictionaries in python 3.x
dtoc: Decode strings for struct.unpack on python 3.x
dtoc: Make integer division python 3.x safe

 tools/dtoc/dtoc.py              | 26 ++++++++++++++++++++-----
 tools/dtoc/fdt_fallback.py      |  8 +++++++-
 tools/dtoc/fdt_util.py          |  3 +++
 tools/patman/checkpatch.py      | 16 ++++++++--------
 tools/patman/command.py         |  2 +-
 tools/patman/cros_subprocess.py |  6 +++---
 tools/patman/get_maintainer.py  |  2 +-
 tools/patman/gitutil.py         | 18 +++++++++---------
 tools/patman/patchstream.py     |  6 +++---
 tools/patman/patman.py          | 12 ++++++------
 tools/patman/series.py          | 42
 +++++++++++++++++++++-------------------- tools/patman/settings.py      
  | 28 ++++++++++++++++++---------
 tools/patman/terminal.py        | 12 +++++++-----
 tools/patman/test.py            |  2 +-
 14 files changed, 111 insertions(+), 72 deletions(-)
Quoted 5 lines
Quoted 2 lines

--
2.10.0

Regards,
Simon

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160927/80103f4e/attachment.sig>