nsf / termbox

Library for writing text-based user interfaces
http://code.google.com/p/termbox
MIT License
1.96k stars 185 forks source link

Does not work with Python 3.7 #117

Closed ritiek closed 5 years ago

ritiek commented 6 years ago

With my python pointing to Python 3.7, results in a traceback:

$ ./waf configure
Traceback (most recent call last):
  File "/home/ritiek/Downloads/termbox/.waf3-1.8.0-5c05be2d0e42d5c2c81403948a2d295b/waflib/Node.py", line 285, in ant_iter
    raise StopIteration
StopIteration

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

Traceback (most recent call last):
  File "/home/ritiek/Downloads/termbox/.waf3-1.8.0-5c05be2d0e42d5c2c81403948a2d295b/waflib/Scripting.py", line 98, in waf_entry_point
    run_commands()
  File "/home/ritiek/Downloads/termbox/.waf3-1.8.0-5c05be2d0e42d5c2c81403948a2d295b/waflib/Scripting.py", line 155, in run_commands
    parse_options()
  File "/home/ritiek/Downloads/termbox/.waf3-1.8.0-5c05be2d0e42d5c2c81403948a2d295b/waflib/Scripting.py", line 128, in parse_options
    Context.create_context('options').execute()
  File "/home/ritiek/Downloads/termbox/.waf3-1.8.0-5c05be2d0e42d5c2c81403948a2d295b/waflib/Options.py", line 138, in execute
    super(OptionsContext,self).execute()
  File "/home/ritiek/Downloads/termbox/.waf3-1.8.0-5c05be2d0e42d5c2c81403948a2d295b/waflib/Context.py", line 92, in execute
    self.recurse([os.path.dirname(g_module.root_path)])
  File "/home/ritiek/Downloads/termbox/.waf3-1.8.0-5c05be2d0e42d5c2c81403948a2d295b/waflib/Context.py", line 133, in recurse
    user_function(self)
  File "/home/ritiek/Downloads/termbox/wscript", line 11, in options
    opt.load('compiler_c')
  File "/home/ritiek/Downloads/termbox/.waf3-1.8.0-5c05be2d0e42d5c2c81403948a2d295b/waflib/Context.py", line 89, in load
    fun(self)
  File "/home/ritiek/Downloads/termbox/.waf3-1.8.0-5c05be2d0e42d5c2c81403948a2d295b/waflib/Tools/compiler_c.py", line 36, in options
    opt.load_special_tools('c_*.py',ban=['c_dumbpreproc.py'])
  File "/home/ritiek/Downloads/termbox/.waf3-1.8.0-5c05be2d0e42d5c2c81403948a2d295b/waflib/Context.py", line 296, in load_special_tools
    lst=self.root.find_node(waf_dir).find_node('waflib/extras').ant_glob(var)
  File "/home/ritiek/Downloads/termbox/.waf3-1.8.0-5c05be2d0e42d5c2c81403948a2d295b/waflib/Node.py", line 334, in ant_glob
    ret=[x for x in self.ant_iter(accept=accept,pats=[to_pat(incl),to_pat(excl)],maxdepth=kw.get('maxdepth',25),dir=dir,src=src,remove=kw.get('remove',True))]
  File "/home/ritiek/Downloads/termbox/.waf3-1.8.0-5c05be2d0e42d5c2c81403948a2d295b/waflib/Node.py", line 334, in <listcomp>
    ret=[x for x in self.ant_iter(accept=accept,pats=[to_pat(incl),to_pat(excl)],maxdepth=kw.get('maxdepth',25),dir=dir,src=src,remove=kw.get('remove',True))]
RuntimeError: generator raised StopIteration

Everything goes fine if python points to Python 2.7, 3.5 or 3.6.

qguv commented 5 years ago

This is because we're pulling an old version of waf which does not work for Python 3.7 (reference). The waf maintainers have since fixed this, so updating waf should close this issue.

cdluminate commented 5 years ago
diff --git a/waflib/Node.py b/waflib/Node.py
index a3c81e2..f5542f3 100644
--- a/waflib/Node.py
+++ b/waflib/Node.py
@@ -282,7 +282,7 @@ class Node(object):
                    if maxdepth:
                        for k in node.ant_iter(accept=accept,maxdepth=maxdepth-1,pats=npats,dir=dir,src=src,remove=remove):
                            yield k
-       raise StopIteration
+       return
    def ant_glob(self,*k,**kw):
        src=kw.get('src',True)
        dir=kw.get('dir',False)

To fix this issue we only need to change one line. Python3.7's PEP already told us how to fix such breakage: https://www.python.org/dev/peps/pep-0479/

oblique commented 5 years ago

Any news on this?

rofl0r commented 5 years ago

i guess if someone steps up and creates a PR from the above patch, the repo owner could and would click on the merge button.