[U-Boot] [PATCH 0/9] Python 3.x support for patman & dtoc

Paul Burton paul.burton at imgtec.com
Tue Sep 27 17:07:00 CEST 2016


On Monday, 26 September 2016 18:33:19 BST Simon Glass wrote:
> Hi Paul,
> 
> On 26 September 2016 at 08:30, Paul Burton <paul.burton at imgtec.com> wrote:
> > 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:

>>> 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

> 
> > 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(-)
> > 
> > --
> > 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>


More information about the U-Boot mailing list