I had a need for this so had a go at packagaing it.
Turns out the the dependency pymp4 is not in debian, so I packaged that too.
However the tests for pymp4 are giving an error "NameError: name
'String' is not defined ", and if you ignore that and build
mapillary-tools anyway you get test errors there, and if you press on
and then try to use it, you hit the same issue:
File "/usr/lib/python3/dist-packages/pymp4/parser.py", line 86, in <module>
"major_brand" / String(4),
NameError: name 'String' is not defined
So something is wrong that needs investigation.
Build log:
Traceback (most recent call last):
File "/home/wookey/packages/mapillary/pymp4/python-pymp4-1.2.0/setup.py", line 29, in <module>
setup(name="pymp4",
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.9/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.9/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.9/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/test.py", line 223, in run
self.run_tests()
File "/usr/lib/python3/dist-packages/setuptools/command/test.py", line 226, in run_tests
test = unittest.main(
File "/usr/lib/python3.9/unittest/main.py", line 100, in __init__
self.parseArgs(argv)
File "/usr/lib/python3.9/unittest/main.py", line 147, in parseArgs
self.createTests()
File "/usr/lib/python3.9/unittest/main.py", line 158, in createTests
self.test = self.testLoader.loadTestsFromNames(self.testNames,
File "/usr/lib/python3.9/unittest/loader.py", line 220, in loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/lib/python3.9/unittest/loader.py", line 220, in <listcomp>
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/lib/python3.9/unittest/loader.py", line 191, in loadTestsFromName
return self.loadTestsFromModule(obj)
File "/usr/lib/python3/dist-packages/setuptools/command/test.py", line 56, in loadTestsFromModule
tests.append(self.loadTestsFromName(submodule))
File "/usr/lib/python3.9/unittest/loader.py", line 154, in loadTestsFromName
module = __import__(module_name)
File "/home/wookey/packages/mapillary/pymp4/python-pymp4-1.2.0/tests/test_box.py", line 21, in <module>
from pymp4.parser import Box
File "/home/wookey/packages/mapillary/pymp4/python-pymp4-1.2.0/src/pymp4/parser.py", line 86, in <module>
"major_brand" / String(4),
NameError: name 'String' is not defined
E: pybuild pybuild:355: test: plugin distutils failed with: exit code=1: python3.9 setup.py test
dh_auto_test: error: pybuild --test -i python{version} -p "3.10 3.9" returned exit code 13
make: *** [debian/rules:10: build] Error 25
Running the tool:
$ mapillary_tools
Traceback (most recent call last):
File "/usr/bin/mapillary_tools", line 33, in <module>
sys.exit(load_entry_point('mapillary-tools==0.8.0', 'console_scripts', 'mapillary_tools')())
File "/usr/bin/mapillary_tools", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/usr/lib/python3.9/dist-packages/mapillary_tools/__main__.py", line 6, in <module>
from .commands import authenticate
File "/usr/lib/python3.9/dist-packages/mapillary_tools/commands/__init__.py", line 2, in <module>
from . import process
File "/usr/lib/python3.9/dist-packages/mapillary_tools/commands/process.py", line 4, in <module>
from ..insert_MAPJson import insert_MAPJson
File "/usr/lib/python3.9/dist-packages/mapillary_tools/insert_MAPJson.py", line 9, in <module>
from . import image_log, types, processing, error
File "/usr/lib/python3.9/dist-packages/mapillary_tools/processing.py", line 16, in <module>
from .gpx_from_blackvue import gpx_from_blackvue
File "/usr/lib/python3.9/dist-packages/mapillary_tools/gpx_from_blackvue.py", line 8, in <module>
from pymp4.parser import Box
File "/usr/lib/python3/dist-packages/pymp4/parser.py", line 86, in <module>
"major_brand" / String(4),
NameError: name 'String' is not defined
This is the offending code:
FileTypeBox = Struct(
"type" / Const(b"ftyp"),
"major_brand" / String(4),
"minor_version" / Int32ub,
"compatible_brands" / GreedyRange(String(4)),
)
My python-foo is very weak so I have no idea what's up here.
I also had some trouble with a .eggs directory being created but not
cleaned up and pybuild seeming to prevent the normal overriding of
dh_foo targets in the rules file.
I also find python packaging very confusing with disttools and
setuptools and pybuild and eggs and setup.py and various other python
build tools/mechanisms that have come and gone and some that get
layered. I'm never sure a) how things are supposed to work and b) what
tools one is currently supposed to be using.
I guess I should mail the python team for advice on these things.
The main point is that a reasonable basic packaging job has been done
so no need to repeat it. With a bit of help it should be good for
uploading.
I decided that mapillary-tools was a better name for the package (than
python-mapillary-tools) as it's a user-facing tool and this matches
the upstream name people would be looking for.
Wookey