2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 01:46:15 +01:00

no more file() in python 3.3

This commit is contained in:
Thomas Nagy 2012-10-31 02:00:01 +01:00
parent 90157ca97d
commit b022f8a314
4 changed files with 28 additions and 20 deletions

View File

@ -1,3 +1,12 @@
NEW IN WAF 1.7.6
----------------
* Better encapsulation of conf.check_cfg(uselib_store=...) defines #1212
* Support for python modules in fortran
* Extension files of D binaries on Mac
* Raise an error when a tex manually-provided dependency is not found #1209
* Enforce a stable name in bld(rule=..., name=undefined) to prevent rebuilds
* Enhanced support for flex on win32 and msys #1207 #1211
NEW IN WAF 1.7.5 NEW IN WAF 1.7.5
---------------- ----------------
* Fixed the kde4 library detection on Fedora * Fixed the kde4 library detection on Fedora

View File

@ -33,7 +33,7 @@ def lib_name(i):
def createHeader(name): def createHeader(name):
filename = name + ".h" filename = name + ".h"
handle = file(filename, "w" ) handle = open(filename, "w" )
guard = name + '_h_' guard = name + '_h_'
handle.write ('#ifndef ' + guard + '\n'); handle.write ('#ifndef ' + guard + '\n');
@ -50,7 +50,7 @@ def createHeader(name):
def createCPP(name, lib_number, classes_per_lib, internal_includes, external_includes): def createCPP(name, lib_number, classes_per_lib, internal_includes, external_includes):
filename = name + ".cpp" filename = name + ".cpp"
handle = file(filename, "w" ) handle = open(filename, "w" )
header= name + ".h" header= name + ".h"
handle.write ('#include "' + header + '"\n'); handle.write ('#include "' + header + '"\n');
@ -72,7 +72,7 @@ def createCPP(name, lib_number, classes_per_lib, internal_includes, external_inc
def createSConscript(lib_number, classes): def createSConscript(lib_number, classes):
handle = file("SConscript", "w"); handle = open("SConscript", "w");
handle.write("Import('env')\n") handle.write("Import('env')\n")
handle.write('list = Split("""\n'); handle.write('list = Split("""\n');
for i in range(classes): for i in range(classes):
@ -81,11 +81,11 @@ def createSConscript(lib_number, classes):
handle.write('env.StaticLibrary("lib_' + str(lib_number) + '", list)\n\n') handle.write('env.StaticLibrary("lib_' + str(lib_number) + '", list)\n\n')
def createLibCMakeLists(lib_number, classes): def createLibCMakeLists(lib_number, classes):
handle = file("CMakeLists.txt", "w") handle = open("CMakeLists.txt", "w")
handle.write("""add_library(lib_%s STATIC %s)\n""" % (str(lib_number), ' '.join(('class_%s' % str(i) for i in range(classes))))) handle.write("""add_library(lib_%s STATIC %s)\n""" % (str(lib_number), ' '.join(('class_%s' % str(i) for i in range(classes)))))
def createLibMakefile(lib_number, classes): def createLibMakefile(lib_number, classes):
handle = file("Makefile", "w"); handle = open("Makefile", "w");
handle.write ("""COMPILER = g++ handle.write ("""COMPILER = g++
INC = -I.. INC = -I..
CCFLAGS = -g -Wall $(INC) CCFLAGS = -g -Wall $(INC)
@ -120,7 +120,7 @@ depend:
""") """)
def createLibJamFile(lib_number, classes): def createLibJamFile(lib_number, classes):
handle = file("Jamfile", "w") handle = open("Jamfile", "w")
handle.write ("SubDir TOP lib_" + str(lib_number) + " ;\n\n") handle.write ("SubDir TOP lib_" + str(lib_number) + " ;\n\n")
handle.write ("SubDirHdrs $(INCLUDES) ;\n\n") handle.write ("SubDirHdrs $(INCLUDES) ;\n\n")
handle.write ("Library lib_" + str(lib_number) + " :\n") handle.write ("Library lib_" + str(lib_number) + " :\n")
@ -129,7 +129,7 @@ def createLibJamFile(lib_number, classes):
handle.write (' ;\n') handle.write (' ;\n')
def createVCProjFile(lib_number, classes): def createVCProjFile(lib_number, classes):
handle = file("lib_" + str(lib_number) + ".vcproj", "w") handle = open("lib_" + str(lib_number) + ".vcproj", "w")
handle.write("""<?xml version="1.0" encoding="Windows-1252"?> handle.write("""<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
@ -197,7 +197,7 @@ def createLibrary(lib_number, classes, internal_includes, external_includes):
os.chdir("..") os.chdir("..")
def createCMakeLists(libs): def createCMakeLists(libs):
handle = file("CMakeLists.txt", "w") handle = open("CMakeLists.txt", "w")
handle.write("""project('profiling-test') handle.write("""project('profiling-test')
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
@ -208,7 +208,7 @@ include_directories(${CMAKE_SOURCE_DIR})
handle.write("""add_subdirectory(lib_%s)\n""" % str(i)) handle.write("""add_subdirectory(lib_%s)\n""" % str(i))
def createSConstruct(libs): def createSConstruct(libs):
handle = file("SConstruct", "w"); handle = open("SConstruct", "w");
handle.write("""env = Environment(CPPFLAGS=['-Wall'], CPPDEFINES=['LINUX'], CPPPATH=[Dir('#')])\n""") handle.write("""env = Environment(CPPFLAGS=['-Wall'], CPPDEFINES=['LINUX'], CPPPATH=[Dir('#')])\n""")
handle.write("""env.Decider('timestamp-newer')\n""") handle.write("""env.Decider('timestamp-newer')\n""")
handle.write("""env.SetOption('implicit_cache', True)\n""") handle.write("""env.SetOption('implicit_cache', True)\n""")
@ -218,7 +218,7 @@ def createSConstruct(libs):
handle.write("""env.SConscript("lib_%s/SConscript", exports=['env'])\n""" % str(i)) handle.write("""env.SConscript("lib_%s/SConscript", exports=['env'])\n""" % str(i))
def createFullMakefile(libs): def createFullMakefile(libs):
handle = file("Makefile", "w") handle = open("Makefile", "w")
handle.write('subdirs = \\\n') handle.write('subdirs = \\\n')
for i in range(libs): for i in range(libs):
@ -239,13 +239,13 @@ depend:
""") """)
def createFullJamfile(libs): def createFullJamfile(libs):
handle = file("Jamfile", "w") handle = open("Jamfile", "w")
handle.write ("SubDir TOP ;\n\n") handle.write ("SubDir TOP ;\n\n")
for i in range(libs): for i in range(libs):
handle.write('SubInclude TOP ' + lib_name(i) + ' ;\n') handle.write('SubInclude TOP ' + lib_name(i) + ' ;\n')
handle = file("Jamrules", "w") handle = open("Jamrules", "w")
handle.write('INCLUDES = $(TOP) ;\n') handle.write('INCLUDES = $(TOP) ;\n')
WT = """#! /usr/bin/env python WT = """#! /usr/bin/env python
@ -275,7 +275,7 @@ def createWtop(libs, classes):
f.close() f.close()
def createFullSolution(libs): def createFullSolution(libs):
handle = file("solution.sln", "w") handle = open("solution.sln", "w")
handle.write("Microsoft Visual Studio Solution File, Format Version 8.00\n") handle.write("Microsoft Visual Studio Solution File, Format Version 8.00\n")
for i in range(libs): for i in range(libs):
@ -285,7 +285,7 @@ def createFullSolution(libs):
handle.write('EndProject\n') handle.write('EndProject\n')
def createAutotoolsTop(libs): def createAutotoolsTop(libs):
handle = file("configure.ac", "w") handle = open("configure.ac", "w")
handle.write('''\ handle.write('''\
AC_INIT([bench], [1.0.0]) AC_INIT([bench], [1.0.0])
AC_CONFIG_AUX_DIR([autotools-aux]) AC_CONFIG_AUX_DIR([autotools-aux])
@ -296,7 +296,7 @@ AC_CONFIG_FILES([Makefile])
AC_OUTPUT AC_OUTPUT
''') ''')
handle = file("Makefile.am", "w") handle = open("Makefile.am", "w")
handle.write('''\ handle.write('''\
AM_CPPFLAGS = -I$(srcdir) AM_CPPFLAGS = -I$(srcdir)
lib_LTLIBRARIES = lib_LTLIBRARIES =
@ -305,7 +305,7 @@ lib_LTLIBRARIES =
def createAutotools(lib_number, classes): def createAutotools(lib_number, classes):
handle = file("Makefile.am", "w") handle = open("Makefile.am", "w")
handle.write('''\ handle.write('''\
lib_LTLIBRARIES += lib%s.la lib_LTLIBRARIES += lib%s.la
lib%s_la_SOURCES =''' % (str(lib_number), str(lib_number))) lib%s_la_SOURCES =''' % (str(lib_number), str(lib_number)))

View File

@ -17,7 +17,7 @@ HEXVERSION=0x1070500
WAFVERSION="1.7.5" WAFVERSION="1.7.5"
"""Constant updated on new releases""" """Constant updated on new releases"""
WAFREVISION="a7e69d6b81b04729804754c4d5214da063779a65" WAFREVISION="90157ca97deb241023d15a16bab6f36e718191fd"
"""Constant updated on new releases""" """Constant updated on new releases"""
ABI = 98 ABI = 98

View File

@ -70,8 +70,7 @@ def init(ctx):
pats.append(('^HEXVERSION(.*)', 'HEXVERSION=%s' % hexver)) pats.append(('^HEXVERSION(.*)', 'HEXVERSION=%s' % hexver))
try: try:
#rev = k[0].cmd_and_log('git log | grep "^commit" | wc -l', quiet=0).strip() rev = ctx.cmd_and_log("git rev-parse HEAD").strip()
rev = k[0].cmd_and_log("git rev-parse HEAD").strip()
pats.append(('^WAFREVISION(.*)', 'WAFREVISION="%s"' % rev)) pats.append(('^WAFREVISION(.*)', 'WAFREVISION="%s"' % rev))
except Exception: except Exception:
pass pass
@ -129,7 +128,7 @@ def compute_revision():
sources.sort() sources.sort()
m = md5() m = md5()
for source in sources: for source in sources:
f = file(source,'rb') f = open(source,'rb')
readBytes = 100000 readBytes = 100000
while (readBytes): while (readBytes):
readString = f.read(readBytes) readString = f.read(readBytes)