diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-01-18 23:19:47 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-01-23 21:02:04 +0200 |
commit | 0a2daf84eb68526f0d689488230a8d63cf47836d (patch) | |
tree | 6ed79e14925883007aaa04459c49fc45c57d0ce7 /test cases | |
parent | fa0382f1f9d5677c1cbfb2dcec45c6d68702a261 (diff) | |
download | meson-0a2daf84eb68526f0d689488230a8d63cf47836d.zip meson-0a2daf84eb68526f0d689488230a8d63cf47836d.tar.gz meson-0a2daf84eb68526f0d689488230a8d63cf47836d.tar.bz2 |
No longer require a binary called python3 on Windows. The default name is "python".
Diffstat (limited to 'test cases')
34 files changed, 69 insertions, 37 deletions
diff --git a/test cases/common/103 manygen/subdir/manygen.py b/test cases/common/103 manygen/subdir/manygen.py index 8e74bcd..7ffd435 100755 --- a/test cases/common/103 manygen/subdir/manygen.py +++ b/test cases/common/103 manygen/subdir/manygen.py @@ -1,4 +1,6 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python + +from __future__ import print_function # Generates a static library, object file, source # file and a header file. diff --git a/test cases/common/105 find program path/meson.build b/test cases/common/105 find program path/meson.build index 2ece2bc..ba6030b 100644 --- a/test cases/common/105 find program path/meson.build +++ b/test cases/common/105 find program path/meson.build @@ -2,8 +2,9 @@ project('find program', 'c') prog = find_program('program.py') -# Python 3 is guaranteed to be available because Meson -# is implemented in it. -python = find_program('python3') +python = find_program('python3', required : false) +if not python.found() + python = find_program('python') +endif run_command(python, prog.path()) diff --git a/test cases/common/105 find program path/program.py b/test cases/common/105 find program path/program.py index 2ebc564..b910718 100644 --- a/test cases/common/105 find program path/program.py +++ b/test cases/common/105 find program path/program.py @@ -1,3 +1,3 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python print("Found") diff --git a/test cases/common/107 postconf/postconf.py b/test cases/common/107 postconf/postconf.py index 950c706..9a23cfa 100644 --- a/test cases/common/107 postconf/postconf.py +++ b/test cases/common/107 postconf/postconf.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import os diff --git a/test cases/common/108 postconf with args/postconf.py b/test cases/common/108 postconf with args/postconf.py index cef7f79..3ed0450 100644 --- a/test cases/common/108 postconf with args/postconf.py +++ b/test cases/common/108 postconf with args/postconf.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys, os diff --git a/test cases/common/113 generatorcustom/catter.py b/test cases/common/113 generatorcustom/catter.py index 198fa98..a79b739 100755 --- a/test cases/common/113 generatorcustom/catter.py +++ b/test cases/common/113 generatorcustom/catter.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys diff --git a/test cases/common/113 generatorcustom/gen.py b/test cases/common/113 generatorcustom/gen.py index c1e34ed..f9efb47 100755 --- a/test cases/common/113 generatorcustom/gen.py +++ b/test cases/common/113 generatorcustom/gen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys diff --git a/test cases/common/117 custom target capture/meson.build b/test cases/common/117 custom target capture/meson.build index fa59d51..d3214e8 100644 --- a/test cases/common/117 custom target capture/meson.build +++ b/test cases/common/117 custom target capture/meson.build @@ -1,6 +1,9 @@ project('custom target', 'c') -python = find_program('python3') +python3 = find_program('python3', required : false) +if not python3.found() + python3 = find_program('python') +endif # Note that this will not add a dependency to the compiler executable. # Code will not be rebuilt if it changes. @@ -10,7 +13,7 @@ mytarget = custom_target('bindat', output : 'data.dat', input : 'data_source.txt', capture : true, - command : [python, comp, '@INPUT@'], + command : [python3, comp, '@INPUT@'], install : true, install_dir : 'subdir' ) diff --git a/test cases/common/118 allgenerate/converter.py b/test cases/common/118 allgenerate/converter.py index f8e2ca0..cc2c574 100755 --- a/test cases/common/118 allgenerate/converter.py +++ b/test cases/common/118 allgenerate/converter.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys diff --git a/test cases/common/131 custom target directory install/docgen.py b/test cases/common/131 custom target directory install/docgen.py index 245f370..4d80124 100644 --- a/test cases/common/131 custom target directory install/docgen.py +++ b/test cases/common/131 custom target directory install/docgen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import os import sys diff --git a/test cases/common/133 configure file in generator/src/gen.py b/test cases/common/133 configure file in generator/src/gen.py index 99b7cdd..5bccece 100755 --- a/test cases/common/133 configure file in generator/src/gen.py +++ b/test cases/common/133 configure file in generator/src/gen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys diff --git a/test cases/common/16 configure file/generator.py b/test cases/common/16 configure file/generator.py index 31a6944..2c7f2f8 100755 --- a/test cases/common/16 configure file/generator.py +++ b/test cases/common/16 configure file/generator.py @@ -1,5 +1,9 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python +# On some platforms "python" points to Python 2 +# on others to Python 3. Work with both. + +from __future__ import print_function import sys, os if len(sys.argv) != 3: diff --git a/test cases/common/16 configure file/meson.build b/test cases/common/16 configure file/meson.build index 0c5b981..b764c5a 100644 --- a/test cases/common/16 configure file/meson.build +++ b/test cases/common/16 configure file/meson.build @@ -23,7 +23,10 @@ cfile) test('inctest', e) # Now generate a header file with an external script. -genprog = find_program('python3') +genprog = find_program('python3', required : false) +if not genprog.found() + genprog = find_program('python') +endif scriptfile = '@0@/generator.py'.format(meson.current_source_dir()) ifile = '@0@/dummy.dat'.format(meson.current_source_dir()) ofile = '@0@/config2.h'.format(meson.current_build_dir()) diff --git a/test cases/common/48 test args/tester.py b/test cases/common/48 test args/tester.py index 0b4010a..c3c1edc 100755 --- a/test cases/common/48 test args/tester.py +++ b/test cases/common/48 test args/tester.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys diff --git a/test cases/common/56 custom target/depfile/dep.py b/test cases/common/56 custom target/depfile/dep.py index 585e192..aff325b 100755 --- a/test cases/common/56 custom target/depfile/dep.py +++ b/test cases/common/56 custom target/depfile/dep.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys, os from glob import glob diff --git a/test cases/common/56 custom target/meson.build b/test cases/common/56 custom target/meson.build index feaa762..fd59fbd 100644 --- a/test cases/common/56 custom target/meson.build +++ b/test cases/common/56 custom target/meson.build @@ -1,6 +1,9 @@ project('custom target', 'c') -python = find_program('python3') +python = find_program('python3', required : false) +if not python.found() + python = find_program('python') +endif # Note that this will not add a dependency to the compiler executable. # Code will not be rebuilt if it changes. diff --git a/test cases/common/57 custom target chain/meson.build b/test cases/common/57 custom target chain/meson.build index 1af0425..138f795 100644 --- a/test cases/common/57 custom target chain/meson.build +++ b/test cases/common/57 custom target chain/meson.build @@ -1,7 +1,12 @@ project('custom target', 'c') -python = find_program('python3') +python = find_program('python3', required : false) +if not python.found() + python = find_program('python') +endif +# files() is the correct way to do this, but some people +# do this so test that it works. comp = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler.py') comp2 = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler2.py') infile = files('data_source.txt')[0] diff --git a/test cases/common/57 custom target chain/my_compiler.py b/test cases/common/57 custom target chain/my_compiler.py index d99029b..9cf4425 100755 --- a/test cases/common/57 custom target chain/my_compiler.py +++ b/test cases/common/57 custom target chain/my_compiler.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys diff --git a/test cases/common/57 custom target chain/my_compiler2.py b/test cases/common/57 custom target chain/my_compiler2.py index 22ec789..0191f3f 100755 --- a/test cases/common/57 custom target chain/my_compiler2.py +++ b/test cases/common/57 custom target chain/my_compiler2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys diff --git a/test cases/common/57 custom target chain/usetarget/subcomp.py b/test cases/common/57 custom target chain/usetarget/subcomp.py index 52dc0bb..b5f6eb0 100755 --- a/test cases/common/57 custom target chain/usetarget/subcomp.py +++ b/test cases/common/57 custom target chain/usetarget/subcomp.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys diff --git a/test cases/common/58 run target/converter.py b/test cases/common/58 run target/converter.py index 8dd31fe..9f47ba5 100644 --- a/test cases/common/58 run target/converter.py +++ b/test cases/common/58 run target/converter.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys diff --git a/test cases/common/58 run target/fakeburner.py b/test cases/common/58 run target/fakeburner.py index 5728002..7f505d6 100755 --- a/test cases/common/58 run target/fakeburner.py +++ b/test cases/common/58 run target/fakeburner.py @@ -1,4 +1,6 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python + +from __future__ import print_function import sys diff --git a/test cases/common/58 run target/meson.build b/test cases/common/58 run target/meson.build index 0540b80..8a06490 100644 --- a/test cases/common/58 run target/meson.build +++ b/test cases/common/58 run target/meson.build @@ -31,7 +31,11 @@ run_target('upload2', depends : hex, ) -python3 = find_program('python3') +python3 = find_program('python3', required : false) +if not python3.found() + python3 = find_program('python') +endif + run_target('py3hi', command : [python3, '-c', 'print("I am Python3.")']) diff --git a/test cases/common/59 object generator/meson.build b/test cases/common/59 object generator/meson.build index 0bdefb8..e20da6f 100644 --- a/test cases/common/59 object generator/meson.build +++ b/test cases/common/59 object generator/meson.build @@ -1,6 +1,9 @@ project('object generator', 'c') -python = find_program('python3') +python = find_program('python3', required : false) +if not python.found() + python = find_program('python') +endif # Note that this will not add a dependency to the compiler executable. # Code will not be rebuilt if it changes. diff --git a/test cases/common/61 custom target source output/generator.py b/test cases/common/61 custom target source output/generator.py index 3464b0a..42532ca 100755 --- a/test cases/common/61 custom target source output/generator.py +++ b/test cases/common/61 custom target source output/generator.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys, os diff --git a/test cases/common/64 custom header generator/makeheader.py b/test cases/common/64 custom header generator/makeheader.py index f156834..0c5a228 100644 --- a/test cases/common/64 custom header generator/makeheader.py +++ b/test cases/common/64 custom header generator/makeheader.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python # NOTE: this file does not have the executable bit set. This tests that # Meson can automatically parse shebang lines. diff --git a/test cases/common/65 multiple generators/mygen.py b/test cases/common/65 multiple generators/mygen.py index 99dc331..020a389 100755 --- a/test cases/common/65 multiple generators/mygen.py +++ b/test cases/common/65 multiple generators/mygen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys, os diff --git a/test cases/common/72 build always/version_gen.py b/test cases/common/72 build always/version_gen.py index d7b01ca..3973e61 100755 --- a/test cases/common/72 build always/version_gen.py +++ b/test cases/common/72 build always/version_gen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys, os, subprocess diff --git a/test cases/common/76 configure file in custom target/src/mycompiler.py b/test cases/common/76 configure file in custom target/src/mycompiler.py index b00c862..e1750f8 100644 --- a/test cases/common/76 configure file in custom target/src/mycompiler.py +++ b/test cases/common/76 configure file in custom target/src/mycompiler.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys diff --git a/test cases/common/77 external test program/mytest.py b/test cases/common/77 external test program/mytest.py index 03d88b8..7cdaf09 100755 --- a/test cases/common/77 external test program/mytest.py +++ b/test cases/common/77 external test program/mytest.py @@ -1,4 +1,6 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python + +from __future__ import print_function import sys diff --git a/test cases/common/78 ctarget dependency/gen1.py b/test cases/common/78 ctarget dependency/gen1.py index 0fa6ea1..f920e53 100755 --- a/test cases/common/78 ctarget dependency/gen1.py +++ b/test cases/common/78 ctarget dependency/gen1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import time, sys diff --git a/test cases/common/78 ctarget dependency/gen2.py b/test cases/common/78 ctarget dependency/gen2.py index b087b02..fc60e1e 100755 --- a/test cases/common/78 ctarget dependency/gen2.py +++ b/test cases/common/78 ctarget dependency/gen2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys, os from glob import glob diff --git a/test cases/common/93 private include/stlib/compiler.py b/test cases/common/93 private include/stlib/compiler.py index 98dbe46..0555c16 100755 --- a/test cases/common/93 private include/stlib/compiler.py +++ b/test cases/common/93 private include/stlib/compiler.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys, os diff --git a/test cases/common/98 gen extra/srcgen.py b/test cases/common/98 gen extra/srcgen.py index 8988cd9..86fd698 100755 --- a/test cases/common/98 gen extra/srcgen.py +++ b/test cases/common/98 gen extra/srcgen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python import sys import argparse |