Make build scripts python2/3 agnostic.
git-svn-id: svn://localhost/ardour2/branches/3.0@7931 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
04585abae3
commit
9f7f0f79a3
18
autowaf.py
18
autowaf.py
@ -212,7 +212,7 @@ def configure(conf):
|
||||
display_msg(conf, "Debuggable build", str(conf.env['DEBUG']))
|
||||
display_msg(conf, "Strict compiler flags", str(conf.env['STRICT']))
|
||||
display_msg(conf, "Build documentation", str(conf.env['DOCS']))
|
||||
print
|
||||
print()
|
||||
|
||||
g_step = 2
|
||||
|
||||
@ -340,11 +340,11 @@ def build_version_files(header_path, source_path, domain, major, minor, micro):
|
||||
text += "int " + domain + "_minor_version = " + str(minor) + ";\n"
|
||||
text += "int " + domain + "_micro_version = " + str(micro) + ";\n"
|
||||
try:
|
||||
o = file(source_path, 'w')
|
||||
o = open(source_path, 'w')
|
||||
o.write(text)
|
||||
o.close()
|
||||
except IOError:
|
||||
print "Could not open", source_path, " for writing\n"
|
||||
print("Could not open %s for writing\n", source_path)
|
||||
sys.exit(-1)
|
||||
|
||||
text = "#ifndef __" + domain + "_version_h__\n"
|
||||
@ -355,11 +355,11 @@ def build_version_files(header_path, source_path, domain, major, minor, micro):
|
||||
text += "extern int " + domain + "_micro_version;\n"
|
||||
text += "#endif /* __" + domain + "_version_h__ */\n"
|
||||
try:
|
||||
o = file(header_path, 'w')
|
||||
o = open(header_path, 'w')
|
||||
o.write(text)
|
||||
o.close()
|
||||
except IOError:
|
||||
print "Could not open", header_path, " for writing\n"
|
||||
print("Could not open %s for writing\n", header_path)
|
||||
sys.exit(-1)
|
||||
|
||||
return None
|
||||
@ -384,12 +384,12 @@ def run_tests(ctx, appname, tests):
|
||||
stdout=lcov_log, stderr=lcov_log)
|
||||
except:
|
||||
lcov = False
|
||||
print "Failed to run lcov, no coverage report will be generated"
|
||||
print("Failed to run lcov, no coverage report will be generated")
|
||||
|
||||
|
||||
# Run all tests
|
||||
for i in tests:
|
||||
print
|
||||
print()
|
||||
Utils.pprint('BOLD', 'Running %s test %s' % (appname, i))
|
||||
if subprocess.call(i) == 0:
|
||||
Utils.pprint('GREEN', 'Passed %s %s' % (appname, i))
|
||||
@ -418,7 +418,7 @@ def run_tests(ctx, appname, tests):
|
||||
|
||||
lcov_log.close()
|
||||
|
||||
print
|
||||
print()
|
||||
Utils.pprint('BOLD', 'Summary:', sep=''),
|
||||
if failures == 0:
|
||||
Utils.pprint('GREEN', 'All ' + appname + ' tests passed')
|
||||
@ -426,7 +426,7 @@ def run_tests(ctx, appname, tests):
|
||||
Utils.pprint('RED', str(failures) + ' ' + appname + ' test(s) failed')
|
||||
|
||||
Utils.pprint('BOLD', 'Coverage:', sep='')
|
||||
print os.path.abspath('coverage/index.html')
|
||||
print(os.path.abspath('coverage/index.html'))
|
||||
|
||||
os.chdir(orig_dir)
|
||||
|
||||
|
@ -344,13 +344,13 @@ def build(bld):
|
||||
obj = bld.new_task_gen('subst')
|
||||
obj.source = 'ardev_common.sh.in'
|
||||
obj.target = 'ardev_common_waf.sh'
|
||||
obj.chmod = 0755
|
||||
obj.chmod = 0o755
|
||||
obj.dict = wrapper_subst_dict
|
||||
|
||||
obj = bld.new_task_gen('subst')
|
||||
obj.source = 'ardour.sh.in'
|
||||
obj.target = 'ardour3'
|
||||
obj.chmod = 0755
|
||||
obj.chmod = 0o755
|
||||
obj.dict = wrapper_subst_dict
|
||||
obj.install_path = bld.env['BINDIR']
|
||||
|
||||
@ -392,7 +392,7 @@ def build(bld):
|
||||
|
||||
# Set up font substitution dictionary
|
||||
for style in ['', 'BOLD', 'ITALIC']:
|
||||
for sizename,points in font_sizes.iteritems():
|
||||
for sizename,points in iter(font_sizes.items()):
|
||||
if (len (style)):
|
||||
key = "_".join (['FONT',style,sizename])
|
||||
fontstyle = " ".join ([basefont,style.lower(),points])
|
||||
|
@ -208,14 +208,14 @@ def flac_supported():
|
||||
cmd = subprocess.Popen ("sndfile-info testfile.flac",
|
||||
stdout = subprocess.PIPE,
|
||||
stderr = subprocess.STDOUT, shell = True)
|
||||
out = cmd.communicate()[0];
|
||||
out = cmd.communicate()[0].decode('utf-8');
|
||||
return re.search ('unknown format', out) == None
|
||||
|
||||
def ogg_supported():
|
||||
cmd = subprocess.Popen ("sndfile-info testfile.ogg",
|
||||
stdout = subprocess.PIPE,
|
||||
stderr = subprocess.STDOUT, shell = True)
|
||||
out = cmd.communicate()[0];
|
||||
out = cmd.communicate()[0].decode('utf-8');
|
||||
return re.search ('unknown format', out) == None
|
||||
|
||||
def set_options(opt):
|
||||
|
@ -51,11 +51,11 @@ def configure(conf):
|
||||
if Options.options.wiimote:
|
||||
conf.check_cc (header_name='cwiid.h',define_name='HAVE_CWIID_H')
|
||||
if not conf.env['HAVE_CWIID_H']:
|
||||
print 'WIIMOTE configured but you are missing libcwiid!'
|
||||
print('WIIMOTE configured but you are missing libcwiid!')
|
||||
sys.exit(1)
|
||||
conf.check_cc (header_name='bluetooth/bluetooth.h',define_name='HAVE_BLUETOOTH_H')
|
||||
if not conf.env['HAVE_BLUETOOTH_H']:
|
||||
print 'WIIMOTE configured but you are missing the libbluetooth headers needed to compile wiimote support!'
|
||||
print('WIIMOTE configured but you are missing the libbluetooth headers needed to compile wiimote support!')
|
||||
sys.exit(1)
|
||||
conf.define ('BUILD_WIIMOTE', 1)
|
||||
|
||||
|
41
wscript
41
wscript
@ -2,7 +2,6 @@
|
||||
import autowaf
|
||||
import Options
|
||||
import os
|
||||
import commands
|
||||
import re
|
||||
import string
|
||||
import subprocess
|
||||
@ -42,18 +41,20 @@ i18n_children = [
|
||||
|
||||
def fetch_svn_revision (path):
|
||||
cmd = "LANG= svn info " + path + " | awk '/^Revision:/ { print $2}'"
|
||||
return commands.getoutput(cmd)
|
||||
return subprocess.Popen(cmd, shell=True, stderr=sub.STDOUT, stdout=sub.PIPE).communicate()[0]
|
||||
|
||||
def fetch_gcc_version ():
|
||||
cmd = "LANG= gcc --version"
|
||||
output = commands.getoutput(cmd).splitlines()
|
||||
version = output[0].split(' ')[2].split('.')
|
||||
output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
|
||||
o = output[0].decode('utf-8')
|
||||
version = o.split(' ')[2].split('.')
|
||||
return version
|
||||
|
||||
def fetch_git_revision (path):
|
||||
cmd = "LANG= git log --abbrev HEAD^..HEAD " + path
|
||||
output = commands.getoutput(cmd).splitlines()
|
||||
rev = output[0].replace ("commit", "git")[0:10]
|
||||
output = subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT, stdout=subprocess.PIPE).communicate()[0].splitlines()
|
||||
o = output[0].decode('utf-8')
|
||||
rev = o.replace ("commit", "git")[0:10]
|
||||
for line in output:
|
||||
try:
|
||||
if "git-svn-id" in line:
|
||||
@ -79,23 +80,23 @@ def create_stored_revision():
|
||||
rev = fetch_git_revision('.');
|
||||
elif os.path.exists('.bzr'):
|
||||
rev = fetch_bzr_revision('.');
|
||||
print "Revision: " + rev;
|
||||
print("Revision: %s", rev)
|
||||
elif os.path.exists('libs/ardour/svn_revision.cc'):
|
||||
print "Using packaged svn revision"
|
||||
print("Using packaged svn revision")
|
||||
return
|
||||
else:
|
||||
print "Missing libs/ardour/svn_revision.cc. Blame the packager."
|
||||
print("Missing libs/ardour/svn_revision.cc. Blame the packager.")
|
||||
sys.exit(-1)
|
||||
|
||||
try:
|
||||
text = '#include "ardour/svn_revision.h"\n'
|
||||
text += 'namespace ARDOUR { const char* svn_revision = \"' + rev + '\"; }\n'
|
||||
print 'Writing svn revision info to libs/ardour/svn_revision.cc'
|
||||
o = file('libs/ardour/svn_revision.cc', 'w')
|
||||
print('Writing svn revision info to libs/ardour/svn_revision.cc')
|
||||
o = open('libs/ardour/svn_revision.cc', 'w')
|
||||
o.write(text)
|
||||
o.close()
|
||||
except IOError:
|
||||
print 'Could not open libs/ardour/svn_revision.cc for writing\n'
|
||||
print('Could not open libs/ardour/svn_revision.cc for writing\n')
|
||||
sys.exit(-1)
|
||||
|
||||
def set_compiler_flags (conf,opt):
|
||||
@ -216,7 +217,7 @@ def set_compiler_flags (conf,opt):
|
||||
optimization_flags.append ("-DUSE_X86_64_ASM")
|
||||
debug_flags.append ("-DUSE_X86_64_ASM")
|
||||
if not build_host_supports_sse:
|
||||
print "\nWarning: you are building Ardour with SSE support even though your system does not support these instructions. (This may not be an error, especially if you are a package maintainer)"
|
||||
print("\nWarning: you are building Ardour with SSE support even though your system does not support these instructions. (This may not be an error, especially if you are a package maintainer)")
|
||||
|
||||
# check this even if we aren't using FPU optimization
|
||||
if not conf.env['HAVE_POSIX_MEMALIGN']:
|
||||
@ -229,10 +230,10 @@ def set_compiler_flags (conf,opt):
|
||||
#
|
||||
|
||||
if conf.env['build_target'] == 'x86_64' and opt.vst:
|
||||
print "\n\n=================================================="
|
||||
print "You cannot use VST plugins with a 64 bit host. Please run waf with --vst=0"
|
||||
print "\nIt is theoretically possible to build a 32 bit host on a 64 bit system."
|
||||
print "However, this is tricky and not recommended for beginners."
|
||||
print("\n\n==================================================")
|
||||
print("You cannot use VST plugins with a 64 bit host. Please run waf with --vst=0")
|
||||
print("\nIt is theoretically possible to build a 32 bit host on a 64 bit system.")
|
||||
print("However, this is tricky and not recommended for beginners.")
|
||||
sys.exit (-1)
|
||||
|
||||
#
|
||||
@ -391,8 +392,8 @@ def configure(conf):
|
||||
|
||||
gcc_versions = fetch_gcc_version()
|
||||
if not Options.options.debug and gcc_versions[0] == '4' and gcc_versions[1] > '4':
|
||||
print 'Version 4.5 of gcc is not ready for use when compiling Ardour with optimization.'
|
||||
print 'Please use a different version or re-configure with --debug'
|
||||
print('Version 4.5 of gcc is not ready for use when compiling Ardour with optimization.')
|
||||
print('Please use a different version or re-configure with --debug')
|
||||
exit (1)
|
||||
|
||||
if sys.platform == 'darwin':
|
||||
@ -577,7 +578,7 @@ def configure(conf):
|
||||
|
||||
autowaf.display_msg(conf, 'C Compiler flags', conf.env['CCFLAGS'])
|
||||
autowaf.display_msg(conf, 'C++ Compiler flags', conf.env['CXXFLAGS'])
|
||||
print
|
||||
print()
|
||||
|
||||
# and dump the same stuff to a file for use in the build
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user