termbox: patch for Python 3.11

This commit is contained in:
Đoàn Trần Công Danh 2022-12-04 00:52:12 +07:00
parent 70a3b1dca4
commit fcab3e63e2
3 changed files with 68 additions and 6 deletions

View File

@ -0,0 +1,15 @@
Index: termbox-1.1.2/wscript
===================================================================
--- termbox-1.1.2.orig/wscript
+++ termbox-1.1.2/wscript
@@ -21,10 +21,6 @@ def configure(conf):
conf.load('gnu_dirs')
conf.load('compiler_c')
conf.env.append_unique('CFLAGS', ['-std=gnu99', '-Wall', '-Wextra', '-D_XOPEN_SOURCE'])
- if conf.options.debug:
- conf.env.append_unique('CFLAGS', ['-g', '-Og'])
- else:
- conf.env.append_unique('CFLAGS', '-O3')
def build(bld):
bld.recurse('src')

View File

@ -0,0 +1,47 @@
Index: termbox-1.1.2/.waf3/waflib/ConfigSet.py
===================================================================
--- termbox-1.1.2.orig/.waf3/waflib/ConfigSet.py
+++ termbox-1.1.2/.waf3/waflib/ConfigSet.py
@@ -134,7 +134,7 @@ class ConfigSet(object):
Utils.writef(filename,''.join(buf))
def load(self,filename):
tbl=self.table
- code=Utils.readf(filename,m='rU')
+ code=Utils.readf(filename,m='r')
for m in re_imp.finditer(code):
g=m.group
tbl[g(2)]=eval(g(3))
Index: termbox-1.1.2/.waf3/waflib/Context.py
===================================================================
--- termbox-1.1.2.orig/.waf3/waflib/Context.py
+++ termbox-1.1.2/.waf3/waflib/Context.py
@@ -113,7 +113,7 @@ class Context(ctx):
cache[node]=True
self.pre_recurse(node)
try:
- function_code=node.read('rU')
+ function_code=node.read('r')
exec(compile(function_code,node.abspath(),'exec'),self.exec_dict)
finally:
self.post_recurse(node)
@@ -321,7 +321,7 @@ def load_module(path):
pass
module=imp.new_module(WSCRIPT_FILE)
try:
- code=Utils.readf(path,m='rU')
+ code=Utils.readf(path,m='r')
except(IOError,OSError):
raise Errors.WafError('Could not read the file %r'%path)
module_dir=os.path.dirname(path)
Index: termbox-1.1.2/.waf3/waflib/Node.py
===================================================================
--- termbox-1.1.2.orig/.waf3/waflib/Node.py
+++ termbox-1.1.2/.waf3/waflib/Node.py
@@ -282,7 +282,6 @@ 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
def ant_glob(self,*k,**kw):
src=kw.get('src',True)
dir=kw.get('dir',False)

View File

@ -10,15 +10,15 @@ homepage="https://github.com/nsf/termbox/"
distfiles="https://github.com/nsf/termbox/archive/v${version}.tar.gz" distfiles="https://github.com/nsf/termbox/archive/v${version}.tar.gz"
checksum=61c9940b42b3ac44bf0cba67eacba75e3c02088b8c695149528c77def04d69b1 checksum=61c9940b42b3ac44bf0cba67eacba75e3c02088b8c695149528c77def04d69b1
pre_configure() { post_extract() {
# waf file is self extracting archive written in python # waf file is self extracting archive written in python
# it self extracts in top level, then runs extracted module in __main__ # it self extracts in top level, then runs extracted module in __main__
# importing allows to patch contents of archive # importing allows to patch contents of archive
mv waf waf.py cp waf waf.py
python3 -c 'import waf; print(waf.wafdir + "/waflib/Node.py")' > node sed -i '/__name__.*__main__/i sys.exit(0)' waf.py
vsed -i "$(cat node)" -e '/raise StopIteration/d' python3 waf.py
rm node ln -s .waf3-* .waf3
mv waf.py waf rm waf.py
} }
post_install() { post_install() {