On some distros, running this causes Python to find the file itself as
the implementation of the `copy` module:
$ python3 copy.py
Traceback (most recent call last):
File "copy.py", line 4, in <module>
import shutil
File "/usr/lib/python3.4/shutil.py", line 14, in <module>
import tarfile
File "/usr/lib/python3.4/tarfile.py", line 48, in <module>
import copy
File "/c/Users/nirbheek/projects/meson.git/test cases/common/134 generated llvm ir/copy.py", line 6, in <module>
shutil.copyfile(sys.argv[1], sys.argv[2])
AttributeError: 'module' object has no attribute 'copyfile'
because down the import dependency chain of copy.py the 'tarfile' module
was trying to import the 'copy' standard library module but was finding
the copy.py file first because it was in the current directory.
Closes https://github.com/mesonbuild/meson/issues/1359
At the same time, also fix the order in which compile arguments are
added. Detailed comments have been added concerning the priority and
order of the arguments.
Also adds a unit test and an integration test for the same.
Also add a test() that can be run on all platforms.
Currently unit tests are only run on Linux, so this was only testing the
Ninja backend. This change reveals that build-by-default was broken with
the Visual Studio backend.
Use a single check for both cases when we have includes and when we
don't. This way we ensure three things:
1. Built-in checks are 100% reliable with clang and on macOS since clang
implements __has_builtin
2. When the #include is present, this ensures that __builtin_func is not
checked for (because of MSYS, and because it is faster)
3. We fallback to checking __builtin_func when all else fails
Our "43 has function" test should also work with clang and icc on Linux,
so enable them. Also detect builtins with __has_builtin if available,
which is much faster on clang.
There is a feature request for the same with GCC too:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66970
With the 'install_mode' kwarg, you can now specify the file and
directory permissions and the owner and the group to be used while
installing. You can pass either:
* A single string specifying just the permissions
* A list of strings with:
- The first argument a string of permissions
- The second argument a string specifying the owner or
an int specifying the uid
- The third argument a string specifying the group or
an int specifying the gid
Specifying `false` as any of the arguments skips setting that one.
The format of the permissions kwarg is the same as the symbolic
notation used by ls -l with the first character that specifies 'd',
'-', 'c', etc for the file type omitted since that is always obvious
from the context.
Includes unit tests for the same. Sadly these only run on Linux right
now, but we want them to run on all platforms. We do set the mode in the
integration tests for all platforms but we don't check if they were
actually set correctly.
With the exception of things like sysconfdir (/etc), every other
installation directory option must be inside the prefix.
Also move the prefix checks to coredata.py since prefix can also be set
from inside project() with default_options and via mesonconf. Earlier
you could set prefix to a relative path that way.
This also allows us to return consistent values for get_option('xxxdir')
regardless of whether relative paths are passed or absolute paths are
passed while setting options on the command-line, via mesonconf, or via
default_options in project(). Now the returned path will *always* be
relative to the prefix.
Includes a unit test for this, and a failing test.
Closes#1299
And fix the list of supported file suffixes, and use .f90 for all
fortran tests since ifort, the Intel Fortran compiler ignores files
ending with .f95, .f03, and .f08
Compiler versions 15.0 and later actually ignore invalid values for the
-std= option unless `-diag-error 10159` is passed, so we need to put
that in the unit test.
I have tested this with versions 14.0.3, 15.0.6, 16.0.4, and 17.0.1.
Would be great if someone could test with 13.x.y
Ignore warning 2282 about GCC pragmas since they are emitted in system
headers and are extremely spammy. They are emitted because ICC pretends
to be GCC via C macros but doesn't implement some pragmas.
https://bugzilla.gnome.org/show_bug.cgi?id=776562
Also, append to LD_LIBRARY_PATH because ICC uses that for some internal
libraries such as libintlc.so.
Explicitly warn with the `#warning` macro to ensure that ICC emits
a warning since ICC does not emit a warning for unused variables.
Also makes the test more reliable with other compilers.