Nirbheek Chauhan
73b2ee08a8
Rewrite custom_target template string substitution
...
Factor it out into a function in mesonlib.py. This will allow us to
reuse it for generators and for configure_file(). The latter doesn't
implement this at all right now.
Also includes unit tests.
2017-02-20 23:32:03 +05:30
Nirbheek Chauhan
bb491735a9
coredata: Use our own implementation of commonpath
...
os.path.commonpath was added in Python 3.5, so just write our own for
now. pathlib was added in Python 3.4, so this should be ok. We need to
use that instead of doing str.split() etc because Windows path handling
has a lot of exceptions and pathlib handles all that for us.
Also adds a unit test for this.
2017-01-30 03:19:31 +05:30
Nirbheek Chauhan
7d6f628ed4
Support file perms for install_data and install_subdir
...
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.
2017-01-24 00:20:51 +05:30
Jussi Pakkanen
577a9b40d5
Merge pull request #1312 from centricular/print-pkgdep-error-osx
...
Fix pkg-config error handling on OS X
2017-01-18 21:27:52 +02:00
Mike Sinkovsky
969be1f679
cleanup: Remove redundant parentheses
2017-01-18 21:22:47 +02:00
Nirbheek Chauhan
e441a74282
Derive all exceptions correctly from base exceptions
...
Don't need to define __init__ and manually call the parent init. Doing
so messes up the error message you get by doing str(exception) because
it includes the current class name in it repeatedly.
2017-01-17 15:39:01 +05:30
Kseniia Vasilchuk
69e2ef099c
configure_file: Use utf-8 to write configured file
...
as a second part of
https://github.com/mesonbuild/meson/issues/1085
2016-12-22 02:04:36 +02:00
Jussi Pakkanen
a2528a8816
Merge pull request #1233 from mesonbuild/wip/ignatenko/code-style
...
Trivial cleanups in code
2016-12-21 00:09:44 +02:00
Nirbheek Chauhan
9bc07a0941
Fix several more lint errors
...
Found by Igor Gnatenko
************* Module mesonbuild.interpreter
E:1232,33: No value for argument 'interp' in constructor call (no-value-for-parameter)
************* Module mesonbuild.dependencies
E: 68, 4: An attribute defined in mesonbuild.dependencies line 39 hides this method (method-hidden)
************* Module mesonbuild.environment
E: 26, 0: class already defined line 19 (function-redefined)
E: 68,18: Undefined variable 'InterpreterException' (undefined-variable)
E:641,39: Undefined variable 'want_cross' (undefined-variable)
E:850,94: Undefined variable 'varname' (undefined-variable)
E:854,94: Undefined variable 'varname' (undefined-variable)
E:860,102: Undefined variable 'varname' (undefined-variable)
E:863,94: Undefined variable 'varname' (undefined-variable)
************* Module mesonbuild.modules.gnome
E:438,26: Undefined variable 'compilers' (undefined-variable)
2016-12-20 00:07:00 +02:00
Igor Gnatenko
8268eb4959
tree-wide: remove unused imports
...
./setup.py:17:1: F401 'os' imported but unused
import os
^
./setup.py:37:1: F401 'stat.ST_MODE' imported but unused
from stat import ST_MODE
^
./run_tests.py:17:1: F401 'os' imported but unused
import subprocess, sys, os
^
./run_tests.py:18:1: F401 'shutil' imported but unused
import shutil
^
./run_unittests.py:23:1: F401 'mesonbuild.dependencies.Qt5Dependency' imported but unused
from mesonbuild.dependencies import PkgConfigDependency, Qt5Dependency
^
./mesonbuild/build.py:15:1: F401 '.coredata' imported but unused
from . import coredata
^
./mesonbuild/interpreter.py:32:1: F401 'subprocess' imported but unused
import os, sys, subprocess, shutil, uuid, re
^
./mesonbuild/interpreter.py:32:1: F401 're' imported but unused
import os, sys, subprocess, shutil, uuid, re
^
./mesonbuild/dependencies.py:23:1: F401 'subprocess' imported but unused
import os, stat, glob, subprocess, shutil
^
./mesonbuild/mesonlib.py:17:1: F401 'sys' imported but unused
import platform, subprocess, operator, os, shutil, re, sys
^
./mesonbuild/modules/qt5.py:15:1: F401 'subprocess' imported but unused
import os, subprocess
^
./mesonbuild/modules/pkgconfig.py:15:1: F401 '..coredata' imported but unused
from .. import coredata, build
^
./mesonbuild/scripts/scanbuild.py:15:1: F401 'sys' imported but unused
import sys, os
^
./mesonbuild/scripts/meson_exe.py:20:1: F401 'subprocess' imported but unused
import subprocess
^
./mesonbuild/scripts/meson_exe.py:22:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException, Popen_safe
^
./mesonbuild/scripts/symbolextractor.py:23:1: F401 'subprocess' imported but unused
import os, sys, subprocess
^
./mesonbuild/scripts/symbolextractor.py:25:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException, Popen_safe
^
./mesonbuild/scripts/meson_install.py:19:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException, Popen_safe
^
./mesonbuild/scripts/yelphelper.py:15:1: F401 'sys' imported but unused
import sys, os
^
./mesonbuild/scripts/yelphelper.py:20:1: F401 '..mesonlib.MesonException' imported but unused
from ..mesonlib import MesonException
^
./mesonbuild/backend/vs2010backend.py:17:1: F401 're' imported but unused
import re
^
./test cases/vala/8 generated sources/src/copy_file.py:3:1: F401 'os' imported but unused
import os
^
./test cases/common/107 postconf/postconf.py:3:1: F401 'sys' imported but unused
import sys, os
^
./test cases/common/129 object only target/obj_generator.py:5:1: F401 'shutil' imported but unused
import sys, shutil, subprocess
^
./test cases/common/57 custom target chain/usetarget/subcomp.py:3:1: F401 'os' imported but unused
import sys, os
^
./test cases/common/95 dep fallback/subprojects/boblib/genbob.py:3:1: F401 'os' imported but unused
import os
^
./test cases/common/98 gen extra/srcgen.py:4:1: F401 'os' imported but unused
import os
^
./test cases/common/113 generatorcustom/gen.py:3:1: F401 'os' imported but unused
import sys, os
^
./test cases/common/113 generatorcustom/catter.py:3:1: F401 'os' imported but unused
import sys, os
^
./test cases/common/59 object generator/obj_generator.py:5:1: F401 'shutil' imported but unused
import sys, shutil, subprocess
^
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-19 18:19:35 +01:00
Nirbheek Chauhan
60716fcd6d
Use universal_newlines=True for all Popen calls
...
Instead of adding it everywhere manually, create a wrapper called
mesonlib.Popen_safe and use that everywhere that we call an executable
and extract its output.
This will also allow us to tweak it to do more/different things if
needed for some locales and/or systems.
Closes #1079
2016-12-11 01:59:58 +02:00
Nirbheek Chauhan
e1c9d94708
Allow many version conditions for pkg-config deps
...
Sometimes we want to restrict the acceptable versions to a list of
versions, or a smallest-version + largest-version, or both. For
instance, GStreamer's opencv plugin is only compatible with
3.1.0 >= opencv >= 2.3.0
2016-12-03 21:46:20 +02:00
Nirbheek Chauhan
03cc991f4f
configure_file: Use utf-8 to write configured file
...
Closes #1085
2016-11-23 15:33:40 +05:30
Jussi Pakkanen
a01919976e
Always specify installed data with a File object. Closes #858 .
2016-11-18 17:37:35 -05:00
Scott D Phillips
ba578db031
mesonlib: close file before (re)moving
...
On windows, attempting to unlink an open file results in a
PermissionError, so close the file and then remove it.
2016-10-27 10:52:00 -07:00
Jussi Pakkanen
5f20b38d44
Force configure input files to be utf-8. Closes #927 .
2016-10-23 04:38:54 -07:00
Jussi Pakkanen
885a3c706f
Merged dpkg-architecture fix for Gentoo.
2016-10-23 01:01:21 +03:00
Jussi Pakkanen
1e3e22c66e
Merge pull request #938 from centricular/fix-unity-builds
...
Several commits that fix unity builds
2016-10-22 14:38:06 -07:00
Patrick Griffis
8b27a48d56
Don't default to lib64 if symlink
...
Some distros, such as Arch, symlink lib64 to lib for compat reasons
and programs shouldn't actually install there.
2016-10-22 14:37:46 -07:00
Jouni Kosonen
1ed3317a8b
Only default to dpkg-architecture output in Debian derivatives
2016-10-22 14:00:46 +03:00
Nirbheek Chauhan
57ce7d4618
Add support for extracting objects in unity builds
...
Not only does extract_all_objects() now work properly again,
extract_objects() also works if you specify a subset of sources all of
which have been compiled into a single unified object.
So, for instance, this allows you to extract all the objects
corresponding to the C sources compiled into a target consisting of
C and C++ sources.
2016-10-21 08:00:39 +05:30
Nirbheek Chauhan
a0551d7d6e
dependencies/boost: Fix 32-bit vs 64-bit on Windows
...
Fixes https://github.com/mesonbuild/meson/issues/526
Also removes useless and incorrect mesonlib.is_32bit() function. We
cannot trust that the architecture that Python is built for is the same
as the one we're targetting.
2016-09-27 00:27:38 +05:30
Tim-Philipp Müller
3aebdb717a
configuration_data: can pass descriptions to setters ( #783 )
...
Add support for passing a description to configuration data
setter methods via a 'description' kwarg. The description
string will be used when meson generates the entire configure
file without a template, autoconf-style.
2016-09-25 18:56:49 +03:00
Jussi Pakkanen
c8213aaf1e
Better file existance checks.
2016-09-01 23:15:48 +03:00
Elliott Sales de Andrade
4c71695e41
Use context manager for file I/O.
...
There are a few cases where a context manager cannot be used, such as
the logger.
2016-08-27 18:29:55 -04:00
Elliott Sales de Andrade
ae12656555
Use global id instead of local for hg tag. ( #710 )
2016-08-27 13:42:35 +03:00
Jussi Pakkanen
e3783f0f59
Check input file for existance. Closes #697 .
2016-08-21 13:50:48 +03:00
Nirbheek Chauhan
4516e8a49f
Add repr() implementations for build targets and File
...
This aids debugging
2016-07-01 20:50:47 +05:30
Jussi Pakkanen
bcec44b93b
Merge pull request #573 from centricular/dependency-versions
...
Several fixes to how versioned dependencies are handled + tests
2016-06-05 13:51:03 +03:00
Jussi Pakkanen
177e286b3c
Can generate config headers without an input file. Closes #549 .
2016-06-01 20:25:14 +03:00
Nirbheek Chauhan
d3e1fe6e1a
mesonlib: Fix typo in version_compare error
2016-05-30 03:35:02 +05:30
Nirbheek Chauhan
8cd359acbb
Regex used for configuration data substitution was too broad ( #520 )
2016-04-17 22:51:25 +03:00
Hemmo Nieminen
af6f4c9b9c
coredata: Centralize builtin option descriptions and definitions.
2016-04-04 02:52:30 +03:00
Hemmo Nieminen
336904b553
Move MesonException from coredata to mesonlib.
2016-04-01 00:52:45 +03:00
Nirbheek Chauhan
11f63105d0
New builtin option: libexecdir for installation of helper executables
2016-03-17 16:17:06 +05:30
Tim-Philipp Müller
48a2b201ea
config file: write commented undef lines same as autoconf
...
For easier diffing to see if anything is missing when porting.
2016-03-12 09:34:35 +00:00
Jussi Pakkanen
f74d6201eb
Guard against ALL THE THINGS!
2016-02-21 13:04:31 +02:00
Jussi Pakkanen
9463c5965e
Swallow stderr of helper process invocation because nobody needs to see it and it causes problems in Debian testing framework.
2016-02-21 12:58:59 +02:00
Jussi Pakkanen
84456537da
Fix some issues that break pypi installs and bump version to upload new version.
2016-01-16 20:59:34 +02:00
Jussi Pakkanen
23b98cd6e6
Renamed meson package to mesonbuild so that we can have a script named meson in the same toplevel dir.
2016-01-16 17:35:29 +02:00