diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-02-23 11:46:30 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-02-26 07:52:49 -0500 |
commit | 0e6045864cdae4ec8f05ee28e12573533ad38c0f (patch) | |
tree | 0532d3cd9efd391f0f11cfb9920ba45101c258fb | |
parent | 438f219864df10b6143725acbf574abcd38f9d8f (diff) | |
download | meson-0e6045864cdae4ec8f05ee28e12573533ad38c0f.zip meson-0e6045864cdae4ec8f05ee28e12573533ad38c0f.tar.gz meson-0e6045864cdae4ec8f05ee28e12573533ad38c0f.tar.bz2 |
tests: Use #!/usr/bin/env python3 for all scripts
We automatically convert that to use sys.executable now which is
always available on all platforms (because we're running with it).
On some platforms like NetBSD, `python` doesn't exist, and you must
use a specific python version. On most other distros, `python` is
Python 2, and we don't want to depend on that.
Closes https://github.com/mesonbuild/meson/issues/695
All these scripts were being used as `find_program()`, so we do not
lose any test coverage by doing this.
31 files changed, 36 insertions, 32 deletions
diff --git a/test cases/common/105 find program path/program.py b/test cases/common/105 find program path/program.py index b910718..2ebc564 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 python +#!/usr/bin/env python3 print("Found") diff --git a/test cases/common/107 postconf/postconf.py b/test cases/common/107 postconf/postconf.py index 9a23cfa..950c706 100644 --- a/test cases/common/107 postconf/postconf.py +++ b/test cases/common/107 postconf/postconf.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 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 3ed0450..cef7f79 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 python +#!/usr/bin/env python3 import sys, os diff --git a/test cases/common/113 generatorcustom/catter.py b/test cases/common/113 generatorcustom/catter.py index a79b739..198fa98 100755 --- a/test cases/common/113 generatorcustom/catter.py +++ b/test cases/common/113 generatorcustom/catter.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys diff --git a/test cases/common/113 generatorcustom/gen.py b/test cases/common/113 generatorcustom/gen.py index f9efb47..c1e34ed 100755 --- a/test cases/common/113 generatorcustom/gen.py +++ b/test cases/common/113 generatorcustom/gen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys diff --git a/test cases/common/118 allgenerate/converter.py b/test cases/common/118 allgenerate/converter.py index cc2c574..f8e2ca0 100755 --- a/test cases/common/118 allgenerate/converter.py +++ b/test cases/common/118 allgenerate/converter.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys diff --git a/test cases/common/129 object only target/obj_generator.py b/test cases/common/129 object only target/obj_generator.py index f0239b4..a33872a 100755 --- a/test cases/common/129 object only target/obj_generator.py +++ b/test cases/common/129 object only target/obj_generator.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Mimic a binary that generates an object file (e.g. windres). 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 4d80124..245f370 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 python +#!/usr/bin/env python3 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 5bccece..99b7cdd 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 python +#!/usr/bin/env python3 import sys diff --git a/test cases/common/134 generated llvm ir/copyfile.py b/test cases/common/134 generated llvm ir/copyfile.py index da503e2..ff42ac3 100644 --- a/test cases/common/134 generated llvm ir/copyfile.py +++ b/test cases/common/134 generated llvm ir/copyfile.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys import shutil diff --git a/test cases/common/135 generated assembly/copyfile.py b/test cases/common/135 generated assembly/copyfile.py index da503e2..ff42ac3 100644 --- a/test cases/common/135 generated assembly/copyfile.py +++ b/test cases/common/135 generated assembly/copyfile.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys import shutil diff --git a/test cases/common/48 test args/tester.py b/test cases/common/48 test args/tester.py index c3c1edc..0b4010a 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 python +#!/usr/bin/env python3 import sys diff --git a/test cases/common/58 run target/check_exists.py b/test cases/common/58 run target/check_exists.py index 62cbe23..b6fc967 100755 --- a/test cases/common/58 run target/check_exists.py +++ b/test cases/common/58 run target/check_exists.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import sys diff --git a/test cases/common/58 run target/converter.py b/test cases/common/58 run target/converter.py index 9f47ba5..8dd31fe 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 python +#!/usr/bin/env python3 import sys diff --git a/test cases/common/58 run target/fakeburner.py b/test cases/common/58 run target/fakeburner.py index 7f505d6..da3d0ac 100755 --- a/test cases/common/58 run target/fakeburner.py +++ b/test cases/common/58 run target/fakeburner.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function diff --git a/test cases/common/58 run target/meson.build b/test cases/common/58 run target/meson.build index 8a06490..a1c5ad8 100644 --- a/test cases/common/58 run target/meson.build +++ b/test cases/common/58 run target/meson.build @@ -19,15 +19,17 @@ hex = custom_target('exe.hex', ], ) +fakeburner = find_program('fakeburner.py') + # These emulates the Arduino flasher application. It sandwiches the filename inside # a packed argument. Thus we need to declare it manually. run_target('upload', - command : ['fakeburner.py', 'x:@0@:y'.format(exe.full_path())], + command : [fakeburner, 'x:@0@:y'.format(exe.full_path())], depends : exe, ) run_target('upload2', - command : ['fakeburner.py', 'x:@0@:y'.format(hex.full_path())], + command : [fakeburner, 'x:@0@:y'.format(hex.full_path())], depends : hex, ) diff --git a/test cases/common/60 install script/myinstall.py b/test cases/common/60 install script/myinstall.py index 969aba5..812561e 100644 --- a/test cases/common/60 install script/myinstall.py +++ b/test cases/common/60 install script/myinstall.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import sys diff --git a/test cases/common/60 install script/src/myinstall.py b/test cases/common/60 install script/src/myinstall.py index d8a5714..3b7ce37 100644 --- a/test cases/common/60 install script/src/myinstall.py +++ b/test cases/common/60 install script/src/myinstall.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import sys 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 42532ca..3464b0a 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 python +#!/usr/bin/env python3 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 0c5a228..f156834 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 python +#!/usr/bin/env python3 # 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 020a389..99dc331 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 python +#!/usr/bin/env python3 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 3973e61..d7b01ca 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 python +#!/usr/bin/env python3 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 e1750f8..b00c862 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 python +#!/usr/bin/env python3 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 7cdaf09..9947773 100755 --- a/test cases/common/77 external test program/mytest.py +++ b/test cases/common/77 external test program/mytest.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from __future__ import print_function diff --git a/test cases/common/78 ctarget dependency/gen1.py b/test cases/common/78 ctarget dependency/gen1.py index f920e53..0fa6ea1 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 python +#!/usr/bin/env python3 import time, sys diff --git a/test cases/common/78 ctarget dependency/gen2.py b/test cases/common/78 ctarget dependency/gen2.py index fc60e1e..b087b02 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 python +#!/usr/bin/env python3 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 0555c16..98dbe46 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 python +#!/usr/bin/env python3 import sys, os diff --git a/test cases/common/95 dep fallback/gensrc.py b/test cases/common/95 dep fallback/gensrc.py index da503e2..ff42ac3 100644 --- a/test cases/common/95 dep fallback/gensrc.py +++ b/test cases/common/95 dep fallback/gensrc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys import shutil diff --git a/test cases/common/95 dep fallback/subprojects/boblib/genbob.py b/test cases/common/95 dep fallback/subprojects/boblib/genbob.py index 7da3233..34af779 100644 --- a/test cases/common/95 dep fallback/subprojects/boblib/genbob.py +++ b/test cases/common/95 dep fallback/subprojects/boblib/genbob.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys diff --git a/test cases/common/98 gen extra/srcgen.py b/test cases/common/98 gen extra/srcgen.py index 86fd698..8988cd9 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 python +#!/usr/bin/env python3 import sys import argparse diff --git a/test cases/frameworks/7 gnome/resources-data/meson.build b/test cases/frameworks/7 gnome/resources-data/meson.build index fd8cb0a..9458c2d 100644 --- a/test cases/frameworks/7 gnome/resources-data/meson.build +++ b/test cases/frameworks/7 gnome/resources-data/meson.build @@ -1,5 +1,7 @@ subdir('subdir') +python3 = import('python3').find_python() + fake_generator_script = ''' import os, sys assert os.path.exists(sys.argv[1]), "File %s not found" % sys.argv[1] @@ -11,6 +13,6 @@ print("This is a generated resource.") res3_txt = custom_target('res3.txt', input: 'res3.txt.in', output: 'res3.txt', - command: ['python3', '-c', fake_generator_script, '@INPUT@'], + command: [python3, '-c', fake_generator_script, '@INPUT@'], capture: true, ) |