mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-23 18:29:27 +01:00
Due to arparse, Python >= 2.7 is now required
This commit is contained in:
parent
b47fceb86a
commit
bdd70055df
@ -9,7 +9,7 @@ Waf is a Python-based framework for configuring, compiling and installing applic
|
||||
* *Extensibility*: though many programming languages and compilers are already supported by default, many others are available as extensions
|
||||
* *IDE support*: Eclipse, Visual Studio and Xcode project generators (`waflib/extras/`)
|
||||
* *Documentation*: the application is based on a robust model documented in [The Waf Book](https://waf.io/book/) and in the [API docs](https://waf.io/apidocs/)
|
||||
* *Python compatibility*: cPython 2.5 to 3.x, Jython 2.5, IronPython, and PyPy
|
||||
* *Python compatibility*: cPython 2.7 to 3.x, Jython 2.7 and PyPy
|
||||
|
||||
Learn more about Waf by reading [The Waf Book](https://waf.io/book/). For researchers and build system writers, Waf also provides a framework and examples for creating [custom build systems](https://gitlab.com/ita1024/waf/tree/master/build_system_kit) and [package distribution systems](https://gitlab.com/ita1024/waf/blob/master/playground/distnet/README.rst).
|
||||
|
||||
@ -17,8 +17,6 @@ Download the project from our page on [waf.io](https://waf.io/), consult the [ma
|
||||
|
||||
## HOW TO CREATE THE WAF SCRIPT
|
||||
|
||||
Python >= 2.7 is required to generate the waf script:
|
||||
|
||||
```sh
|
||||
python ./waf-light configure build
|
||||
```
|
||||
|
@ -2,66 +2,29 @@
|
||||
# encoding: utf-8
|
||||
# Thomas Nagy, 2010-2018 (ita)
|
||||
|
||||
from __future__ import with_statement
|
||||
|
||||
import os
|
||||
|
||||
all_modifs = {}
|
||||
|
||||
def fixdir(dir):
|
||||
"""Call all substitution functions on Waf folders"""
|
||||
for k in all_modifs:
|
||||
for v in all_modifs[k]:
|
||||
modif(os.path.join(dir, 'waflib'), k, v)
|
||||
for y in '. Tools extras'.split():
|
||||
for x in os.listdir(os.path.join(dir, 'waflib', y)):
|
||||
if x.endswith('.py'):
|
||||
filename = os.path.join(dir, 'waflib', y, x)
|
||||
update(filename)
|
||||
|
||||
def modif(dir, name, fun):
|
||||
"""Call a substitution function"""
|
||||
if name == '*':
|
||||
lst = []
|
||||
for y in '. Tools extras'.split():
|
||||
for x in os.listdir(os.path.join(dir, y)):
|
||||
if x.endswith('.py'):
|
||||
lst.append(y + os.sep + x)
|
||||
for x in lst:
|
||||
modif(dir, x, fun)
|
||||
return
|
||||
|
||||
filename = os.path.join(dir, name)
|
||||
def update(filename):
|
||||
with open(filename, 'r') as f:
|
||||
txt = f.read()
|
||||
|
||||
txt = fun(txt)
|
||||
txt = txt.replace(".decode(sys.stdout.encoding or'latin-1',errors='replace')", '')
|
||||
txt = txt.replace('.encode()', '')
|
||||
txt = txt.replace('class Task(metaclass=store_task_type):', "class Task(object):%s\t__metaclass__=store_task_type" % os.linesep)
|
||||
|
||||
with open(filename, 'w') as f:
|
||||
f.write(txt)
|
||||
|
||||
def subst(*k):
|
||||
"""register a substitution function"""
|
||||
def do_subst(fun):
|
||||
for x in k:
|
||||
try:
|
||||
all_modifs[x].append(fun)
|
||||
except KeyError:
|
||||
all_modifs[x] = [fun]
|
||||
return fun
|
||||
return do_subst
|
||||
|
||||
@subst('*')
|
||||
def r1(code):
|
||||
"utf-8 fixes for python < 2.6"
|
||||
code = code.replace('as e:', ',e:')
|
||||
code = code.replace(".decode(sys.stdout.encoding or'latin-1',errors='replace')", '')
|
||||
return code.replace('.encode()', '')
|
||||
|
||||
@subst('Runner.py')
|
||||
def r4(code):
|
||||
"generator syntax"
|
||||
return code.replace('next(self.biter)', 'self.biter.next()').replace('self.daemon = True', 'self.setDaemon(1)')
|
||||
|
||||
@subst('Context.py')
|
||||
def r5(code):
|
||||
return code.replace("('Execution failure: %s'%str(e),ex=e)", "('Execution failure: %s'%str(e),ex=e),None,sys.exc_info()[2]")
|
||||
|
||||
@subst('Task.py')
|
||||
def r6(code):
|
||||
return code.replace('class Task(metaclass=store_task_type):', "class Task(object):%s\t__metaclass__=store_task_type" % os.linesep)
|
||||
for k in all_modifs:
|
||||
for v in all_modifs[k]:
|
||||
modif(os.path.join(dir, 'waflib'), k, v)
|
||||
|
Loading…
Reference in New Issue
Block a user