silnrsi / smith

font development, testing and release
Other
14 stars 5 forks source link

Cannot run font tests on Ubuntu Focal #58

Closed devosb closed 3 years ago

devosb commented 4 years ago

On Ubuntu Bionic (with Python 3.6 (I suspect the version of Python is the main issue)) running font tests (such as smith pdfs works). On Ubuntu Focal (with Python 3.8) smith pdfs (or any other font test sub-commands) produces

Traceback (most recent call last):
  File "/home/ubuntu/builds/smith/waflib/Node.py", line 479, in ant_iter
    raise StopIteration
StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/ubuntu/builds/smith/waflib/Scripting.py", line 154, in waf_entry_point
    run_commands()
  File "/home/ubuntu/builds/smith/waflib/Scripting.py", line 245, in run_commands
    run_command(cmd_name)
  File "/home/ubuntu/builds/smith/waflib/Scripting.py", line 231, in run_command
    ctx.execute()
  File "/home/ubuntu/builds/smith/waflib/Scripting.py", line 551, in execute
    return execute_method(self)
  File "/home/ubuntu/builds/smith/smithlib/wafplus.py", line 369, in execute
    return old_exec(bld)
  File "/home/ubuntu/builds/smith/waflib/Build.py", line 228, in execute
    self.execute_build()
  File "/home/ubuntu/builds/smith/waflib/Build.py", line 242, in execute_build
    self.pre_build()
  File "/home/ubuntu/builds/smith/smithlib/package.py", line 796, in pre_build
    p.build_test(self, test=self.cmd)
  File "/home/ubuntu/builds/smith/smithlib/package.py", line 236, in build_test
    self.fontTests.build_tests(bld, test)
  File "/home/ubuntu/builds/smith/smithlib/font_tests.py", line 177, in build_tests
    if not len(tests) or not any(x.has_work(ctx, self._testfiles) for x in tests) : continue
  File "/home/ubuntu/builds/smith/smithlib/font_tests.py", line 177, in <genexpr>
    if not len(tests) or not any(x.has_work(ctx, self._testfiles) for x in tests) : continue
  File "/home/ubuntu/builds/smith/smithlib/font_tests.py", line 512, in has_work
    self._build_intermediates(ctx, testfiles)
  File "/home/ubuntu/builds/smith/smithlib/font_tests.py", line 389, in _build_intermediates
    self._setFiles(ctx, testfiles)
  File "/home/ubuntu/builds/smith/smithlib/font_tests.py", line 344, in _setFiles
    somefiles = [x for x in antlist(ctx, testsdir, '**/*') if os.path.splitext(str(x))[1] in self.supports]
  File "/home/ubuntu/builds/smith/smithlib/font_tests.py", line 32, in antlist
    if found : return found.ant_glob(globs)
  File "/home/ubuntu/builds/smith/waflib/Node.py", line 566, in ant_glob
    ret = [x for x in self.ant_iter(accept=accept, pats=[to_pat(incl), to_pat(excl)], maxdepth=25, dir=dir, src=src, remove=kw.get('remove', True))]
  File "/home/ubuntu/builds/smith/waflib/Node.py", line 566, in <listcomp>
    ret = [x for x in self.ant_iter(accept=accept, pats=[to_pat(incl), to_pat(excl)], maxdepth=25, dir=dir, src=src, remove=kw.get('remove', True))]
RuntimeError: generator raised StopIteration

Tested with Narnoor but other font projects have the same behaviour as well. Searching for the exception lead to a helpful Stack Overflow post which mentioned PEP 479.

Searching for waflib found the home page for the WAF build system that Smith is built on. The home page links to the source code and I noticed that the ant_iter function does not end with raise StopIteration while in the current Smith source code this function does end with raise StopIteration. Removing raise StopIteration seems to make everything work on Ubuntu Focal (with Python 3.8).

n7s commented 3 years ago

Sucessfully tested not to be an issue on Focal any longer.