summaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
Commit message (Collapse)AuthorAgeFilesLines
* mesonlib: Annotate Popen_safe functionsDylan Baker2019-07-231-4/+11
| | | | | These are used in linkers.py and need to be annotated to make linkers.py 100% clean
* Add optional progress bar when generating build.ninjaNirbheek Chauhan2019-07-201-0/+55
|
* type hints @dcbakerMichael Hirsch, Ph.D2019-07-081-6/+5
|
* add clang c_std=c18 aliasMichael Hirsch, Ph.D2019-07-081-3/+3
| | | | | | | | | | fix unit test skips for clang c18 correct unittests clang minimum version cleanup unittest clang skip c_std finesse unittest vs. clang version
* remove `for_XXX` functions from mesonlibJohn Ericson2019-06-091-70/+0
| | | | All uses now use `env.machines.YYY.is_XXX` instead.
* Use `env.machines.*` to avoid some `is_cross`John Ericson2019-06-091-39/+21
| | | | | This is a small example of the `is_cross` removal the that abstraction enables.
* Per machine do 'build.' and '' option prefixesJohn Ericson2019-06-051-5/+7
| | | | See the docs/ changes for details.
* BUGFIX variable name #5285Michael Hirsch, Ph.D2019-05-281-2/+4
| | | | handle x86 correctly
* Merge pull request #5395 from dcbaker/mtest-annotationsJussi Pakkanen2019-05-161-1/+1
|\ | | | | Mtest annotations and bug fixes
| * mesonlib: Annotate substring_in_listDylan Baker2019-05-141-1/+1
| | | | | | | | for mtest
* | Make `PerMachine` and `MachineChoice` have just `build` and `host`John Ericson2019-05-161-7/+90
|/ | | | | | | | | | | | | | | | | | Meson itself *almost* only cares about the build and host platforms. The exception is it takes a `target_machine` in the cross file and exposes it to the user; but it doesn't do anything else with it. It's therefore overkill to put target in `PerMachine` and `MachineChoice`. Instead, we make a `PerThreeMachine` only for the machine infos. Additionally fix a few other things that were bugging me in the process: - Get rid of `MachineInfos` class. Since `envconfig.py` was created, it has no methods that couldn't just got on `PerMachine` - Make `default_missing` and `miss_defaulting` work functionally. That means we can just locally bind rather than bind as class vars the "unfrozen" configuration. This helps prevent bugs where one forgets to freeze a configuration.
* This is the fork "sneyx1234/meson" of the current git "mesonbuild/meson" ↵Simon Ney2019-05-131-0/+3
| | | | | | head to converge it to the solaris 11.4 platform based on the sparcv9 and i386 processor architecture. The purpose is to complete the porting related to the fork "sneyx1234/ast" of "att/ast" the "AT&T kornshell".
* mesonlib: Make a few type annotations stringsDylan Baker2019-05-021-1/+2
| | | | | | | | Mypy know what to do with these and isn't confused, but some versions of python 3.5 (at least 3.5.2) can't handle these annotations. By making them strings the python interpreter wont try to evaluate them. Fixes #5326
* Merge pull request #5311 from mensinda/flake8PluginsJussi Pakkanen2019-05-021-8/+8
|\ | | | | Added flake8 plugins and some code fixes
| * Fix builtin variable namesDaniel Mensinger2019-04-291-8/+8
| |
* | Add some type annotations and fix lintsJohn Ericson2019-05-021-5/+3
| | | | | | | | | | | | Some things, like `method[...](...)` or `x: ... = ...` python 3.5 doesn't support, so I made a comment instead with the intention that it can someday be made into a real annotation.
* | Don't close fds when executing programsMichael Olbrich2019-05-011-1/+1
|/ | | | This is basically the same as #1612 just for new new Popen_safe_legacy().
* Merge pull request #5265 from dcbaker/more-annotationsJussi Pakkanen2019-04-281-9/+21
|\ | | | | Fully annotate the envconfig and mlog modules
| * mesonlib: Add some type annotationsDylan Baker2019-04-221-9/+21
| | | | | | | | Just enough to make mlog and envconfig happy
* | mesonlib: Reimplement version comparison for speedDylan Baker2019-04-251-14/+25
| |
* | mesonlib: Remove useless repetition of the same checkDylan Baker2019-04-251-10/+1
| | | | | | | | due to refactoring this is now useless.
* | mesonlib: specialize the implementation of == and !=Dylan Baker2019-04-251-1/+8
| | | | | | | | | | | | Instead of using the ___cmp__ method just straight up compare the two values, since we've already converted numbers to ints and split non-numeric seperators this is sufficient, and 4x faster
* | mesonlib: use ints instead of strings for numbersDylan Baker2019-04-251-6/+7
| | | | | | | | makes version comparisons even faster
* | mesonlib: use zip() in VersionDylan Baker2019-04-251-6/+6
|/ | | | | Instead of range. This makes version comparison 25-50% faster depending on the operator and how different the values are.
* replace library type strings with an enumDylan Baker2019-03-201-0/+10
| | | | | | | This patch creates an enum for selecting libtype as static, shared, prefer-static, or prefer-shared. This also renames 'static-shared' with 'prefer_static' and 'shared-static' with 'prefer_shared'. This is just a refactor with no behavioral changes or user facing changes.
* Fix get_library_dirs() on FreeBSDNiclas Zeising2019-02-201-0/+2
| | | | | | | | Fix get_library_dirs() on FreeBSD to only return /usr/local/lib, /usr/lib and /lib as the default location to look for libraries. FreeBSD does not use lib/${platform} or lib64 by default. In general, those directories should not exist, but in case they do, ensure they're not picked up.
* Fix default_libdir() on FreeBSDNiclas Zeising2019-02-201-0/+2
| | | | | | | | Fix defaul_libdir() on FreeBSD. The current behaviour of using usr/lib64 if that exists is wrong on FreeBSD. The default should be to always use usr/lib, even if usr/lib64 exists as a folder in the file system. Fix this by checking if we're running on FreeBSD and then always return 'lib' in default_libdir().
* add type hintingMichael Hirsch, Ph.D2019-02-131-44/+45
| | | | | | | | | | more type hints syntax modernization / robustify syntax typo more effective directory collection
* mesonlib: Use class syntax for defining MachineChoiceDylan Baker2019-02-111-1/+9
| | | | | | Mypy struggles with the imperative form of Enum declaration, and upstream doesn't consider it a bug, they recomend using the class form for enums that are going to be externally exposed.
* macos: lipo outputs aarch64 as arm64, fix itNirbheek Chauhan2019-02-011-0/+1
| | | | Or we'll reject arm64 objects as invalid when building for aarch64
* macos: lipo from older xcode does not support -archsNirbheek Chauhan2019-01-311-1/+2
|
* find_library: Check arch of libraries on DarwinNirbheek Chauhan2019-01-311-0/+18
| | | | | | | | | | | macOS provides the tool `lipo` to check the archs supported by an object (executable, static library, dylib, etc). This is especially useful for fat archives, but it also helps with thin archives. Without this, the linker will fail to link to the library we mistakenly 'found' like so: ld: warning: ignoring file /path/to/libfoo.a, missing required architecture armv7 in file /path/to/libfoo.a
* Rewrite appleframework and extraframework dependency classesNirbheek Chauhan2019-02-011-0/+3
| | | | | | | | | | | | | Instead of only doing a naive filesystem search, also run the linker so that it can tell us whether the -F path specified actually contains the framework we're looking for. Unfortunately, `extraframework` searching is still not 100% correct in the case when since we want to search in either /Library/Frameworks or in /System/Library/Frameworks but not in both. The -Z flag disables searching in those prefixes and would in theory allow this, but then you cannot force the linker to look in those by manually adding -F args, so that doesn't work.
* pep8 py37Michael Hirsch, Ph.D2019-01-291-1/+1
|
* configure_file: preserve newlines of the input file. Fixes #4817Christoph Reiter2019-01-241-2/+2
| | | | | | | | | | | In some cases (see #4817) it's helpful if the output file uses the same newlines as the input file without translating them to the platform defaults. open() by default recognizes all newline styles and translates them to "\n" and then to the platform default when writing. Passing "" to "newline" disables the translation and lets us pass through the original newline characters.
* msetup: Fix callig meson --wipe inside a build directoryDylan Baker2018-12-201-0/+16
| | | | | | | | | | This seems to be related to deleting the current working directory. Simply deleting all of the trees inside the build directory instead seems to fix it. This only appears with some combination of generated targets, running the test case against say "1 trivial" doesn't show the bug. See this mesa bug: https://bugs.freedesktop.org/show_bug.cgi?id=109071
* meson: performance optimizethe file objectMarcel Hollerbach2018-11-021-0/+5
| | | | | reduce the amount of access calls to the os. This safes ~1 sec. build time
* Fix bug in PerMachine constructorJohn Ericson2018-10-281-1/+1
| | | | Don't make single element tuple
* Merge pull request #4326 from Ericson2314/per-machineJussi Pakkanen2018-10-251-23/+88
|\ | | | | Start leveraging MachineInfo with for_* methods
| * Rewrite `for_*` machine checks in terms of MachineInfo and phase outJohn Ericson2018-10-051-23/+39
| | | | | | | | | | | | It's much better to directly query the machine in question rather than do some roundabout "is_cross" thing. This is the first step for much natve- and cross- code path deduplication.
| * Pull out essence total map essence of MachineInfos into PerMachineJohn Ericson2018-10-051-0/+49
| | | | | | | | | | | | We'll eventually have many other data structure duplicated for each build, host, and target machines. This sets up the infrastructure for that.
* | os.path.relpath() can fail on WindowsJon Turney2018-10-101-0/+9
|/ | | | | | | | | If builddir and sourcedir have different drive letters, a relative path doesn't exist, and os.path.relpath fails with a ValueError exception. This just fixes the places which are hit by test cases in a simple-minded way. There are several other uses of os.path.relpath(), which might be suspect.
* Move set_meson_command() to mesonlibXavier Claessens2018-10-041-0/+17
|
* mesonlib: use collections.abc for abc typesDylan Baker2018-09-201-1/+1
| | | | | | | The use of ABC classes (like MutableSet) is deprecated currently, in python 3.8 the aliases in collections will be dropped and only the ones in collections.abc will remain. collections.abc has existed since python 3.3, so there is no backwards compatibility risk.
* Fix incorrect feature check warningJon Turney2018-09-161-0/+1
| | | | | Fix the special handling of '>=0.nn' constraints in project(meson_version:) for feature checks when the constraint version contains spaces
* Correct version_compare_condition_with_min()Jon Turney2018-09-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Correct version_compare_condition_with_min() for the case where no minimum version is established by the version constraint. Add a simple test. Also fix test_feature_check_usage_subprojects by escaping regex metacharacters. if |condition| is '<', '<=' or '!=', the minimum version satisfying the condition is 0, so the minimum version for a feature is never met. if |condition| is '>=' or '==', the minimum version satisfying the condition is the version compared with, so the minimum version for a feature must be less than or equal to that. if |condition| is '>', the minimum version satisfying the condition is greater than the version compared with, so the minimum version for a feature must be less than that (it's this last condition that makes this function necessary, as in all other cases we could establish a definite minimum version which we could compare to see if it's less than or equal to the current version)
* Allow features added in 0.nn.0 to be used when version constraint is '>=0.nn'Jon Turney2018-09-121-0/+14
|
* Use the exact current version in obtainMesonOutputJon Turney2018-09-121-13/+0
| | | | | | | | | | | | Currently this trims '0.48.0.dev1' to '0.48.0', and then requires exactly that version in the generated meson.build for the test. Just use the exact version. Also only use a 'project(meson_version:)' constraint in the generated project if a version is specified Also remove unused grab_leading_numbers
* Re-implement version_compare_condition_with_min likewiseJon Turney2018-09-111-54/+3
| | | | | Also remove unused version_compare_with_max Also remove now unused make_same_len
* Re-implement version_compare using RPM-style version comparisonJon Turney2018-09-111-12/+60
|