in-toto / apt-transport-in-toto

in-toto transport for apt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Python 2/3

lukpueh opened this issue · comments

Description of issue or feature request:
Modify all Python scripts of this repo intoto.py (transport) and test_intoto.py and serve_metadata.py (tests) to support Python in version 2 and 3.

FWIW, the intoto transport will usally be started from apt as executable, i.e. ./intoto, hence the Python interpreter specified in the first line (shebang) will be used. Since we don't specify an explicit version (see #!/usr/bin/env python) this will resolve to the default system Python, which, unless modified by the user, is Python2 (see Debian Python packaging manuals).

Current behavior:
Only supports Python2

Expected behavior:
From a quick check (using 2to3) the following packages have different names in Python2/Python3: Queue/queue, SocketServer/socketserver, SimpleHTTPServer/http.server, subprocess32 (requires external package)/subprocess.

Additionally, there is one call to dict.keys(), whose return value needs an explicit cast to list in Python3.