• Frédéric Dalleau's avatar
    Write filename at syntax check failure · faa7036d
    Frédéric Dalleau authored
    Without the filename it can be cumbersome to find which file caused
    the error
    user@apertis:~/apertis-tests$ make check
    misc/syntax-check.py
    Traceback (most recent call last):
      File misc/syntax-check.py, line 56, in <module>
        check_jinja2_template(template)
      File misc/syntax-check.py, line 34, in check_jinja2_template
        expanded_file = env.get_template(filename).render()
      File /usr/lib/python3/dist-packages/jinja2/environment.py, line 812, in get_template
        return self._load_template(name, self.make_globals(globals))
      File /usr/lib/python3/dist-packages/jinja2/environment.py, line 774, in _load_template
        cache_key = self.loader.get_source(self, name)[1]
      File /usr/lib/python3/dist-packages/jinja2/loaders.py, line 175, in get_source
        contents = f.read().decode(self.encoding)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0x87 in position 16: invalid start byte
    Makefile:76: recipe for target 'check' failed
    make: *** [check] Error 1
    
    Replace that ugly traceback with a more comprehensive output:
    user@apertis:~/apertis-tests$ ./misc/syntax-check.py
    Exception 'utf-8' codec can't decode byte 0x87 in position 16: invalid start byte when checking .common-boot-tpl.yaml.swp
    Signed-off-by: 's avatarFrédéric Dalleau <frederic.dalleau@collabora.com>
    faa7036d
Name
Last commit
Last update
..
add-repo.yaml Loading commit data...
dist-upgrade.yaml Loading commit data...
dpkg-query.yaml Loading commit data...
lsdisk.yaml Loading commit data...
syntax-check.py Loading commit data...