Make mtedit Python 3 compatible

Due to the way relative imports work in Python 3, mtedit/main.py has to
be moved outside of the mtedit package, as when run using its hashbang
line it is package `__main__`, and therefore cannot use relative
imports.

The other manual changes are:

* to properly distinguish between strings and binary data in
  mtlib/util.py, mtlib/log.py, and mtedit/server.py;
* to switch between methods for getting headers in mtedit/server.py; and
* updating some `import` statements (as well as removing unused ones).

The rest of the changes were done using `futurize`:

    $ futurize --stage1 --all-imports --write --nobackups mtedit/**/*.py

Two features remain broken:

* retrieving logs over SSH fails to retrieve
  /var/log/xorg/cmt_input_events.dat, but that was broken already; and
* editing logs by adding the `-o` switch and clicking the shrink button
  in the Web UI fails to import `MTReplay`, presumably because I haven't
  updated that module yet.

TEST=run `mtedit` with the path of a downloaded ZIP file, choose a log
     to view, and check that you can view the data properly in the
     browser.
BUG=none

Cq-Depend: chromium:2024460
Change-Id: Ie59c191d3bc2827d3e94e45a9a8a38e3d524a1a2
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/mttools/+/2025612
Tested-by: Harry Cutts <hcutts@chromium.org>
Reviewed-by: Sean O'Brien <seobrien@chromium.org>
Commit-Queue: Harry Cutts <hcutts@chromium.org>
7 files changed
tree: 1b4ae63484c2f4644b218acdb116d2a571afcc25
  1. mtbringup/
  2. mtedit/
  3. mtlib/
  4. mtreplay/
  5. mtstat/
  6. platforms/
  7. .gitignore
  8. __init__.py
  9. common.mk
  10. Makefile
  11. mtedit.py
  12. OWNERS
  13. PRESUBMIT.cfg