Commit Graph

91 Commits

Author SHA1 Message Date
Jussi Pakkanen 4ef495c596 Do not warn about non-utf8 locales on Windows. 2016-12-10 00:57:09 +02:00
Nirbheek Chauhan 34394afce6 meson.py: Warn if the encoding is not UTF-8 compatible 2016-11-23 16:00:33 +05:30
Nirbheek Chauhan 69ca8f5b54 meson.py: Always resolve full path to meson.py
There is no reason to not always do this. Without this, we end up with
a relative path to meson.py in build.ninja files when meson.py is
launched using subprocess.Popen and friends from the meson source root.

This was causing the unittests to intermittently fail when regen was
getting invoked by the pic test. Funnily enough, this only happened when
run via ./run_tests.py because __file__ was 'run_unittests.py' in that
(as opposed to './run_unittests.py') case which made
os.path.dirname(__file__) be '', and the os.path.split test in meson.py
thought that meson.py was invoked via PATH.
2016-10-12 20:25:03 +05:30
Franz Zapata 4b5a0e5de7 Reintroduce Python Zipapp support
* Added `main` function as an entry point.
 * Created `__main__.py` to allow the creation of Zipapps without explicitly
   calling `meson:main`.
2016-10-10 23:41:40 +03:00
Emanuele Aina 6c50253645 Use argv[0] to internally relaunch meson.py
When installing Meson, distutils may choose to put shim scripts in the
`PATH` that only set up the egg requirements before launching the real
`meson.py` contained in the egg.

This means that `__file__` points to the real `meson.py` file, but
launching it directly is doomed to fail as it's missing the metadata
contained in the shim to set up the path egg, resulting in errors when
trying to import the `mesonbuild` module.

A similar issue affects Meson when installed as a zipapp, with the
current code going great lengths to figure out how to relaunch itself.

Using `argv[0]` avoids these issues as it gives us the way the current
executable has been launched, so we are pretty much guaranteed that
using it will create another instance of the same executable. We only
need to resolve relative paths as the current working directory may
get changed before re-launching the script, and using `realpath()` for
that saves us the trouble of manually resolving links and getting caught
in endless loops.

This also mean that `meson_script_file` no longer necessarily point to a
absolute file, so rename it to `_launcher` which hopefully would be less
prone to inducing false assumptions.
2016-10-08 15:41:31 +02:00
Jussi Pakkanen c69c15ee16 Revert #823, see also #830. 2016-10-02 09:35:02 -04:00
Jussi Pakkanen 08e43e8bfd Revert #830 because it broke the case when the main script is not in path. 2016-10-01 22:06:54 +03:00
Emanuele Aina 338dbc964c User argv[0] to internally relaunch meson.py
When installing Meson distutils may choose to put shim scripts in the
PATH that only set up the egg requirements before launching the real
`meson.py` contained in the egg.

This means that __file__ points to the real `meson.py` file, but
launching it directly is doomed to fail as it's missing the metadata
contained in the shim to set up the path egg, resulting in errors when
trying to import the `mesonbuild` module.

A similar issue affects Meson when installed as a zipapp, with the
current code going great lengths to figure out how to relaunch itself.

Using argv[0] avoids these issues as it gives us the way the current
executable has been launched, so we are pretty much guaranteed that
using it will create another instance of the same executable.
2016-09-30 15:30:27 -04:00
Franz Zapata ac41a45669 Support running Meson as a Python zip application 2016-09-28 12:40:54 -04:00
Jussi Pakkanen 455e55f8e5 Back to .py suffix in files. Closes #394. 2016-03-02 21:49:29 +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
Jussi Pakkanen 66c01401de Moved scripts in the module and started work to run them via the main meson command. 2016-01-15 23:37:22 +02:00
Jussi Pakkanen 8b1039fa30 Organise files into a module structure. 2016-01-15 21:22:09 +02:00
Thibault Saunier 33b2a414e9 Make it working on python 3.3 2015-12-04 10:17:49 +01:00
Yoav Alon a4809cf632 Added support for extended command line to overcome OS command line length limitation 2015-11-28 21:26:56 +02:00
Jussi Pakkanen 1caf7e6f4a Yet another step in the neverending saga of -Wpedantic. 2015-11-23 00:57:01 +02:00
Wink Saville 60896c0f04 Add --version to command line arguments. 2015-11-17 09:13:52 -08:00
Jussi Pakkanen 63e803ae0f Made shared the default libtype as it is faster for daily development. 2015-11-04 00:36:07 +02:00
Jussi Pakkanen 8495075cee Turned builtin options into proper objects. 2015-11-03 03:31:56 +02:00
Jussi Pakkanen e2313b85d7 Refactored builtin options to a dictionary and created a new default library target type. 2015-11-03 03:03:54 +02:00
Jussi Pakkanen c0070aadae Now that projects can easily override defaults, return warning level to 2. 2015-10-26 20:18:05 +02:00
Jussi Pakkanen 572ce0f451 Added cpu family property to system information. 2015-10-18 01:08:04 +03:00
Thibault Saunier c24573483d Do not use intr before it exists 2015-09-19 16:24:33 +02:00
Jussi Pakkanen 5c5f8c7813 Merged trunk changes. 2015-09-17 20:07:40 +03:00
Jussi Pakkanen 067935ce76 Added conf option for build tree layout. 2015-09-17 19:21:26 +03:00
Jussi Pakkanen 384365c843 Added outdir() method to build targets so we can make output dirs togglable. 2015-09-17 18:48:26 +03:00
Jussi Pakkanen c7e367ac16 Can set default warning with an envvar. 2015-09-04 23:31:32 +03:00
Jussi Pakkanen 6cca79b052 Added multiple selectable warning levels. 2015-08-27 01:07:29 +03:00
Jussi Pakkanen 9d559b2b39 More robust windows detection and more logs. 2015-08-25 23:09:54 +03:00
Jussi Pakkanen bd5b4deeda Better sanity testing. 2015-08-25 01:19:58 +03:00
Jussi Pakkanen 30d0c2292f Support target-only cross compilation properly. 2015-07-27 00:55:28 +03:00
Jussi Pakkanen 37b2a195bd Get build machine's CPU info too. 2015-07-27 00:55:27 +03:00
Jussi Pakkanen 463d08d545 Now host_machine, build_machine and target_machine are properly separated and return correct values. 2015-07-27 00:55:27 +03:00
Igor Gnatenko 174e72413f style: fix indenting in meson.py
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2015-06-18 22:06:01 +03:00
Igor Gnatenko 79417eac80 meson: fix undefined-variable in backends chooser
E:146,57: Undefined variable 'options' (undefined-variable)

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2015-06-18 19:25:29 +03:00
Igor Gnatenko 9616bed9fc introduce check python version in meson.py
To ensure that people will not confused that something won't work.

Related: https://github.com/miit-pm/RWD/pull/1#issuecomment-102607931
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2015-05-16 14:16:20 +03:00
Jussi Pakkanen b5cec55835 Moved functionality from __main__ to a function to make it callable. 2015-04-23 16:50:29 +03:00
Jussi Pakkanen ef180676c2 Add command line switch to print version number. 2015-03-13 22:42:47 +02:00
Jussi Pakkanen 3f46cd7fb3 Added gobject-introspection to gnome module. 2015-03-08 19:39:03 +02:00
Jussi Pakkanen c0f097c0c7 Fix argparse to make rebuild work again. 2015-03-06 17:44:03 +02:00
Jussi Pakkanen baa0782a22 Use argparse in introspector. 2015-03-02 17:05:34 +02:00
Jussi Pakkanen b82584641a Use argparse instead of optparse in meson.py. 2015-03-02 16:50:42 +02:00
Jussi Pakkanen 22c23ee1fb Added Debian multilib support. 2015-02-16 01:22:43 +02:00
Jussi Pakkanen 08ef881c86 Extracted compiler definitions to their own file. 2014-12-03 22:37:06 +02:00
Jussi Pakkanen 525f0ae6d2 Harmonised copyright declarations. 2014-11-16 20:19:12 +02:00
Jussi Pakkanen a5863477f8 Kill end of line whitespace dead. 2014-08-07 12:34:35 +03:00
Jussi Pakkanen 55759e4aa9 Can specify project options on the command line and the override defaults. 2014-08-06 21:40:23 +03:00
Jussi Pakkanen 83237f2b38 Added option for werror. 2014-07-18 20:51:26 +03:00
Jussi Pakkanen ac871dd6e2 OCD 2014-06-02 01:18:58 +03:00
Jussi Pakkanen b626d017a2 Specify build flags per build type. 2014-04-16 20:51:31 +03:00