repo
stringclasses
32 values
instance_id
stringlengths
13
37
base_commit
stringlengths
40
40
patch
stringlengths
1
1.89M
test_patch
stringclasses
1 value
problem_statement
stringlengths
304
69k
hints_text
stringlengths
0
246k
created_at
stringlengths
20
20
version
stringclasses
1 value
FAIL_TO_PASS
stringclasses
1 value
PASS_TO_PASS
stringclasses
1 value
environment_setup_commit
stringclasses
1 value
traceback
stringlengths
64
23.4k
__index_level_0__
int64
29
19k
mesonbuild/meson
mesonbuild__meson-5259
eaed4aecbe218018feed73192e6fc25e54034d53
diff --git a/mesonbuild/ast/interpreter.py b/mesonbuild/ast/interpreter.py --- a/mesonbuild/ast/interpreter.py +++ b/mesonbuild/ast/interpreter.py @@ -171,6 +171,7 @@ def evaluate_plusassign(self, node): assert(isinstance(node, mparser.PlusAssignmentNode)) if node.var_name not in self.assignments: self.assignments[node.var_name] = [] + self.assign_vals[node.var_name] = [] self.assignments[node.var_name] += [node.value] # Save a reference to the value node if hasattr(node.value, 'ast_id'): self.reverse_assignment[node.value.ast_id] = node
Running "meson configure" in source directory raises an exception (again) Sorry for the lack of an isolated test-case. Apparently [the Taisei repo](https://github.com/taisei-project/taisei/) can serve as a decent integration test for this feature in general. Ping @mensinda ``` [0] [akari@navi] [?master ← /home/akari/git/taisei] % meson configure Unable to evaluate subdir([]) in AstInterpreter --> Skipping Unable to evaluate subdir([]) in AstInterpreter --> Skipping Traceback (most recent call last): File "/data/git/meson/mesonbuild/mesonmain.py", line 122, in run return options.run_func(options) File "/data/git/meson/mesonbuild/mconf.py", line 200, in run c = Conf(builddir) File "/data/git/meson/mesonbuild/mconf.py", line 56, in __init__ intr.analyze() File "/data/git/meson/mesonbuild/ast/introspection.py", line 274, in analyze self.run() File "/data/git/meson/mesonbuild/interpreterbase.py", line 407, in run self.evaluate_codeblock(self.ast, start=1) File "/data/git/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/data/git/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/data/git/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/data/git/meson/mesonbuild/interpreterbase.py", line 773, in function_call return func(node, posargs, kwargs) File "/data/git/meson/mesonbuild/ast/interpreter.py", line 149, in func_subdir self.evaluate_codeblock(codeblock) File "/data/git/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/data/git/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/data/git/meson/mesonbuild/interpreterbase.py", line 446, in evaluate_statement return self.evaluate_if(cur) File "/data/git/meson/mesonbuild/ast/interpreter.py", line 216, in evaluate_if self.evaluate_codeblock(i.block) File "/data/git/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/data/git/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/data/git/meson/mesonbuild/interpreterbase.py", line 470, in evaluate_statement return self.evaluate_plusassign(cur) File "/data/git/meson/mesonbuild/ast/interpreter.py", line 177, in evaluate_plusassign self.assign_vals[node.var_name] += [self.evaluate_statement(node.value)] KeyError: 'em_bundle_misc_packer_args' [2] [akari@navi] [?master ← /home/akari/git/taisei] % git describe v1.2-366-g387d16d6 ```
I think the cause for this is access to the `em_bundle_misc_packer_args` variable, [which is declared dynamically via a call to `set_variable`, and never statically](https://github.com/taisei-project/taisei/blob/master/resources/meson.build). Assuming the introspection interpreter doesn't evaluate any function calls, this seems like a difficult problem. If there's no feasible solution, this limitation should be documented, and perhaps setting of undefined variables via `set_variable` should be deprecated.
2019-04-13T07:22:21Z
[]
[]
Traceback (most recent call last): File "/data/git/meson/mesonbuild/mesonmain.py", line 122, in run return options.run_func(options) File "/data/git/meson/mesonbuild/mconf.py", line 200, in run c = Conf(builddir) File "/data/git/meson/mesonbuild/mconf.py", line 56, in __init__ intr.analyze() File "/data/git/meson/mesonbuild/ast/introspection.py", line 274, in analyze self.run() File "/data/git/meson/mesonbuild/interpreterbase.py", line 407, in run self.evaluate_codeblock(self.ast, start=1) File "/data/git/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/data/git/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/data/git/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/data/git/meson/mesonbuild/interpreterbase.py", line 773, in function_call return func(node, posargs, kwargs) File "/data/git/meson/mesonbuild/ast/interpreter.py", line 149, in func_subdir self.evaluate_codeblock(codeblock) File "/data/git/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/data/git/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/data/git/meson/mesonbuild/interpreterbase.py", line 446, in evaluate_statement return self.evaluate_if(cur) File "/data/git/meson/mesonbuild/ast/interpreter.py", line 216, in evaluate_if self.evaluate_codeblock(i.block) File "/data/git/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/data/git/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/data/git/meson/mesonbuild/interpreterbase.py", line 470, in evaluate_statement return self.evaluate_plusassign(cur) File "/data/git/meson/mesonbuild/ast/interpreter.py", line 177, in evaluate_plusassign self.assign_vals[node.var_name] += [self.evaluate_statement(node.value)] KeyError: 'em_bundle_misc_packer_args'
9,253
mesonbuild/meson
mesonbuild__meson-5344
a15a8b7e246be448e79ba20742e713e39807bd00
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -873,7 +873,7 @@ def get_wrapper(options): return wrap def get_pretty_suite(self, test): - if len(self.suites) > 1: + if len(self.suites) > 1 and test.suite: rv = TestHarness.split_suite_string(test.suite[0])[0] s = "+".join(TestHarness.split_suite_string(s)[1] for s in test.suite) if len(s): diff --git a/run_unittests.py b/run_unittests.py --- a/run_unittests.py +++ b/run_unittests.py @@ -1813,48 +1813,48 @@ def test_suite_selection(self): self.init(testdir) self.build() - self.assertFailedTestCount(3, self.mtest_command) + self.assertFailedTestCount(4, self.mtest_command) self.assertFailedTestCount(0, self.mtest_command + ['--suite', ':success']) self.assertFailedTestCount(3, self.mtest_command + ['--suite', ':fail']) - self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', ':success']) - self.assertFailedTestCount(0, self.mtest_command + ['--no-suite', ':fail']) + self.assertFailedTestCount(4, self.mtest_command + ['--no-suite', ':success']) + self.assertFailedTestCount(1, self.mtest_command + ['--no-suite', ':fail']) self.assertFailedTestCount(1, self.mtest_command + ['--suite', 'mainprj']) self.assertFailedTestCount(0, self.mtest_command + ['--suite', 'subprjsucc']) self.assertFailedTestCount(1, self.mtest_command + ['--suite', 'subprjfail']) self.assertFailedTestCount(1, self.mtest_command + ['--suite', 'subprjmix']) - self.assertFailedTestCount(2, self.mtest_command + ['--no-suite', 'mainprj']) - self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'subprjsucc']) - self.assertFailedTestCount(2, self.mtest_command + ['--no-suite', 'subprjfail']) - self.assertFailedTestCount(2, self.mtest_command + ['--no-suite', 'subprjmix']) + self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'mainprj']) + self.assertFailedTestCount(4, self.mtest_command + ['--no-suite', 'subprjsucc']) + self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'subprjfail']) + self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'subprjmix']) self.assertFailedTestCount(1, self.mtest_command + ['--suite', 'mainprj:fail']) self.assertFailedTestCount(0, self.mtest_command + ['--suite', 'mainprj:success']) - self.assertFailedTestCount(2, self.mtest_command + ['--no-suite', 'mainprj:fail']) - self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'mainprj:success']) + self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'mainprj:fail']) + self.assertFailedTestCount(4, self.mtest_command + ['--no-suite', 'mainprj:success']) self.assertFailedTestCount(1, self.mtest_command + ['--suite', 'subprjfail:fail']) self.assertFailedTestCount(0, self.mtest_command + ['--suite', 'subprjfail:success']) - self.assertFailedTestCount(2, self.mtest_command + ['--no-suite', 'subprjfail:fail']) - self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'subprjfail:success']) + self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'subprjfail:fail']) + self.assertFailedTestCount(4, self.mtest_command + ['--no-suite', 'subprjfail:success']) self.assertFailedTestCount(0, self.mtest_command + ['--suite', 'subprjsucc:fail']) self.assertFailedTestCount(0, self.mtest_command + ['--suite', 'subprjsucc:success']) - self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'subprjsucc:fail']) - self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'subprjsucc:success']) + self.assertFailedTestCount(4, self.mtest_command + ['--no-suite', 'subprjsucc:fail']) + self.assertFailedTestCount(4, self.mtest_command + ['--no-suite', 'subprjsucc:success']) self.assertFailedTestCount(1, self.mtest_command + ['--suite', 'subprjmix:fail']) self.assertFailedTestCount(0, self.mtest_command + ['--suite', 'subprjmix:success']) - self.assertFailedTestCount(2, self.mtest_command + ['--no-suite', 'subprjmix:fail']) - self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'subprjmix:success']) + self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'subprjmix:fail']) + self.assertFailedTestCount(4, self.mtest_command + ['--no-suite', 'subprjmix:success']) self.assertFailedTestCount(2, self.mtest_command + ['--suite', 'subprjfail', '--suite', 'subprjmix:fail']) self.assertFailedTestCount(3, self.mtest_command + ['--suite', 'subprjfail', '--suite', 'subprjmix', '--suite', 'mainprj']) self.assertFailedTestCount(2, self.mtest_command + ['--suite', 'subprjfail', '--suite', 'subprjmix', '--suite', 'mainprj', '--no-suite', 'subprjmix:fail']) self.assertFailedTestCount(1, self.mtest_command + ['--suite', 'subprjfail', '--suite', 'subprjmix', '--suite', 'mainprj', '--no-suite', 'subprjmix:fail', 'mainprj-failing_test']) - self.assertFailedTestCount(1, self.mtest_command + ['--no-suite', 'subprjfail:fail', '--no-suite', 'subprjmix:fail']) + self.assertFailedTestCount(2, self.mtest_command + ['--no-suite', 'subprjfail:fail', '--no-suite', 'subprjmix:fail']) def test_build_by_default(self): testdir = os.path.join(self.common_test_dir, '134 build by default')
Empty test suite list causes backtrace Specifying a test with an empty list of test suite names causes a backtrace: ``` test('name', executable, suite: []) ``` This is useful for consistency. Where a project has lots of tests and many (but not all) need suite names for filtering, it's more explicit to add a `suite: []` argument than just leaving it out. Example: 5 out of 10 tests need root permissions, so those tests have `suite: ['root']` while the others have `suite: []`. This currently triggers a backtrace: ``` $ meson test ... Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 122, in run return options.run_func(options) File "/usr/lib/python3.7/site-packages/mesonbuild/mtest.py", line 1005, in run return th.doit() File "/usr/lib/python3.7/site-packages/mesonbuild/mtest.py", line 756, in doit self.run_tests(tests) File "/usr/lib/python3.7/site-packages/mesonbuild/mtest.py", line 896, in run_tests visible_name = self.get_pretty_suite(test) File "/usr/lib/python3.7/site-packages/mesonbuild/mtest.py", line 875, in get_pretty_suite rv = TestHarness.split_suite_string(test.suite[0])[0] IndexError: list index out of range ```
2019-05-02T00:28:25Z
[]
[]
Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 122, in run return options.run_func(options) File "/usr/lib/python3.7/site-packages/mesonbuild/mtest.py", line 1005, in run return th.doit() File "/usr/lib/python3.7/site-packages/mesonbuild/mtest.py", line 756, in doit self.run_tests(tests) File "/usr/lib/python3.7/site-packages/mesonbuild/mtest.py", line 896, in run_tests visible_name = self.get_pretty_suite(test) File "/usr/lib/python3.7/site-packages/mesonbuild/mtest.py", line 875, in get_pretty_suite rv = TestHarness.split_suite_string(test.suite[0])[0] IndexError: list index out of range
9,264
mesonbuild/meson
mesonbuild__meson-5387
5ede0f5ef0ce5ec13e100e737be4ccbc66c3dc41
diff --git a/mesonbuild/ast/interpreter.py b/mesonbuild/ast/interpreter.py --- a/mesonbuild/ast/interpreter.py +++ b/mesonbuild/ast/interpreter.py @@ -260,6 +260,12 @@ def quick_resolve(n: BaseNode, loop_detect: Optional[List[str]] = None) -> Any: id_loop_detect = [] flattend_args = [] + if isinstance(args, BaseNode): + assert(hasattr(args, 'ast_id')) + if args.ast_id in id_loop_detect: + return [] # Loop detected + id_loop_detect += [args.ast_id] + if isinstance(args, ArrayNode): args = [x for x in args.args.arguments] @@ -301,8 +307,8 @@ def quick_resolve(n: BaseNode, loop_detect: Optional[List[str]] = None) -> Any: # Resolve the contents of args for i in args: - if isinstance(i, IdNode) and i.value not in id_loop_detect: - flattend_args += self.flatten_args(quick_resolve(i), include_unknown_args, id_loop_detect + [i.value]) + if isinstance(i, IdNode): + flattend_args += self.flatten_args(quick_resolve(i), include_unknown_args, id_loop_detect) elif isinstance(i, (ArrayNode, ArgumentNode, ArithmeticNode, MethodNode)): flattend_args += self.flatten_args(i, include_unknown_args, id_loop_detect) elif isinstance(i, mparser.ElementaryNode): diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py --- a/mesonbuild/ast/introspection.py +++ b/mesonbuild/ast/introspection.py @@ -118,7 +118,7 @@ def do_subproject(self, dirname): subproject_dir_abs = os.path.join(self.environment.get_source_dir(), self.subproject_dir) subpr = os.path.join(subproject_dir_abs, dirname) try: - subi = IntrospectionInterpreter(subpr, '', self.backend, cross_file=self.cross_file, subproject=dirname, subproject_dir=self.subproject_dir, env=self.environment) + subi = IntrospectionInterpreter(subpr, '', self.backend, cross_file=self.cross_file, subproject=dirname, subproject_dir=self.subproject_dir, env=self.environment, visitors=self.visitors) subi.analyze() subi.project_data['name'] = dirname self.project_data['subprojects'] += [subi.project_data] diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -14,6 +14,7 @@ import os from . import coredata, environment, mesonlib, build, mintro, mlog +from .ast import AstIDGenerator def add_arguments(parser): coredata.register_builtin_arguments(parser) @@ -52,7 +53,7 @@ def __init__(self, build_dir): # Make sure that log entries in other parts of meson don't interfere with the JSON output mlog.disable() self.source_dir = os.path.abspath(os.path.realpath(self.build_dir)) - intr = mintro.IntrospectionInterpreter(self.source_dir, '', 'ninja') + intr = mintro.IntrospectionInterpreter(self.source_dir, '', 'ninja', visitors = [AstIDGenerator()]) intr.analyze() # Reenable logging just in case mlog.enable()
RecursionError when running `meson configure` in source directory (on today's meson master; commit d31db565e1405b303390) Running `meson configure` in [Mesa's source directory](https://gitlab.freedesktop.org/mesa/mesa) (at Mesa commit 8b3baa274406e9bcde42 in case the issue disappears later) crashes: ``` Traceback (most recent call last): File "/home/eric/dev/scm/meson/mesonbuild/mesonmain.py", line 127, in run return options.run_func(options) File "/home/eric/dev/scm/meson/mesonbuild/mconf.py", line 200, in run c = Conf(builddir) File "/home/eric/dev/scm/meson/mesonbuild/mconf.py", line 56, in __init__ intr.analyze() File "/home/eric/dev/scm/meson/mesonbuild/ast/introspection.py", line 276, in analyze self.run() File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 407, in run self.evaluate_codeblock(self.ast, start=1) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 773, in function_call return func(node, posargs, kwargs) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 162, in func_subdir self.evaluate_codeblock(codeblock) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 773, in function_call return func(node, posargs, kwargs) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 162, in func_subdir self.evaluate_codeblock(codeblock) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 446, in evaluate_statement return self.evaluate_if(cur) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 232, in evaluate_if self.evaluate_codeblock(i.block) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 773, in function_call return func(node, posargs, kwargs) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 162, in func_subdir self.evaluate_codeblock(codeblock) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 438, in evaluate_statement return self.assignment(cur) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 244, in assignment self.assign_vals[node.var_name] = [self.evaluate_statement(node.value)] # Evaluate the value just in case File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 764, in function_call (posargs, kwargs) = self.reduce_arguments(node.args) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 203, in reduce_arguments return self.flatten_args(args.arguments), args.kwargs File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 305, in flatten_args flattend_args += self.flatten_args(quick_resolve(i), include_unknown_args, id_loop_detect + [i.value]) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 277, in flatten_args args = self.flatten_args(l, include_unknown_args, id_loop_detect) + self.flatten_args(r, include_unknown_args, id_loop_detect) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 277, in flatten_args args = self.flatten_args(l, include_unknown_args, id_loop_detect) + self.flatten_args(r, include_unknown_args, id_loop_detect) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 277, in flatten_args args = self.flatten_args(l, include_unknown_args, id_loop_detect) + self.flatten_args(r, include_unknown_args, id_loop_detect) [Previous line repeated 962 more times] File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 247, in flatten_args def quick_resolve(n: BaseNode, loop_detect: Optional[List[str]] = None) -> Any: File "/usr/lib/python3.7/typing.py", line 248, in inner return cached(*args, **kwds) File "/usr/lib/python3.7/typing.py", line 664, in __hash__ return hash((self.__origin__, self.__args__)) RecursionError: maximum recursion depth exceeded while calling a Python object ```
This is a bug in the ast interpreter. I will try to fix this. Also, #5375 might be related to #5286 but I will have to look into this.
2019-05-12T17:39:24Z
[]
[]
Traceback (most recent call last): File "/home/eric/dev/scm/meson/mesonbuild/mesonmain.py", line 127, in run return options.run_func(options) File "/home/eric/dev/scm/meson/mesonbuild/mconf.py", line 200, in run c = Conf(builddir) File "/home/eric/dev/scm/meson/mesonbuild/mconf.py", line 56, in __init__ intr.analyze() File "/home/eric/dev/scm/meson/mesonbuild/ast/introspection.py", line 276, in analyze self.run() File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 407, in run self.evaluate_codeblock(self.ast, start=1) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 773, in function_call return func(node, posargs, kwargs) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 162, in func_subdir self.evaluate_codeblock(codeblock) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 773, in function_call return func(node, posargs, kwargs) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 162, in func_subdir self.evaluate_codeblock(codeblock) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 446, in evaluate_statement return self.evaluate_if(cur) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 232, in evaluate_if self.evaluate_codeblock(i.block) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 773, in function_call return func(node, posargs, kwargs) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 162, in func_subdir self.evaluate_codeblock(codeblock) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 438, in evaluate_statement return self.assignment(cur) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 244, in assignment self.assign_vals[node.var_name] = [self.evaluate_statement(node.value)] # Evaluate the value just in case File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/home/eric/dev/scm/meson/mesonbuild/interpreterbase.py", line 764, in function_call (posargs, kwargs) = self.reduce_arguments(node.args) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 203, in reduce_arguments return self.flatten_args(args.arguments), args.kwargs File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 305, in flatten_args flattend_args += self.flatten_args(quick_resolve(i), include_unknown_args, id_loop_detect + [i.value]) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 277, in flatten_args args = self.flatten_args(l, include_unknown_args, id_loop_detect) + self.flatten_args(r, include_unknown_args, id_loop_detect) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 277, in flatten_args args = self.flatten_args(l, include_unknown_args, id_loop_detect) + self.flatten_args(r, include_unknown_args, id_loop_detect) File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 277, in flatten_args args = self.flatten_args(l, include_unknown_args, id_loop_detect) + self.flatten_args(r, include_unknown_args, id_loop_detect) [Previous line repeated 962 more times] File "/home/eric/dev/scm/meson/mesonbuild/ast/interpreter.py", line 247, in flatten_args def quick_resolve(n: BaseNode, loop_detect: Optional[List[str]] = None) -> Any: File "/usr/lib/python3.7/typing.py", line 248, in inner return cached(*args, **kwds) File "/usr/lib/python3.7/typing.py", line 664, in __hash__ return hash((self.__origin__, self.__args__)) RecursionError: maximum recursion depth exceeded while calling a Python object
9,268
mesonbuild/meson
mesonbuild__meson-5500
9933b33c553235b1ce95b8406a6660678cd3af26
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -388,8 +388,14 @@ def __init__(self, environment, kwargs): super().__init__('threads', environment, None, kwargs) self.name = 'threads' self.is_found = True - self.compile_args = self.clib_compiler.thread_flags(environment) - self.link_args = self.clib_compiler.thread_link_flags(environment) + # Happens if you are using a language with threads + # concept without C, such as plain Cuda. + if self.clib_compiler is None: + self.compile_args = [] + self.link_args = [] + else: + self.compile_args = self.clib_compiler.thread_flags(environment) + self.link_args = self.clib_compiler.thread_link_flags(environment) class Python3Dependency(ExternalDependency):
0.51.0 testsuite failure Updating from 0.50.1 to 0.51.0 adds a new testsuite failure: ``` Mesonlogs of failing tests Build started at 2019-06-17T14:15:45.999777 Main binary: /usr/bin/python3 Python system: Linux The Meson build system Version: 0.51.0 Source dir: /build/meson/src/meson-0.51.0/test cases/cuda/5 threads Build dir: /build/meson/src/meson-0.51.0/b f0de5ce3c0 Build type: native build Project name: simple Project version: 1.0.0 No CUFLAGS in the environment, not changing global flags. No LDFLAGS in the environment, not changing global flags. Sanity testing Cuda compiler: nvcc Is cross compiler: None. Sanity check compiler command line: nvcc -w -cudart static /build/meson/src/meson-0.51.0/b f0de5ce3c0/meson-private/sanitycheckcuda.cu -o /build/meson/src/meson-0.51.0/b f0de5ce3c0/meson-private/sanitycheckcuda.exe Sanity check compile stdout: ----- Sanity check compile stderr: ----- Sanity check run command line: nvcc --run "/build/meson/src/meson-0.51.0/b f0de5ce3c0/meson-private/sanitycheckcuda.exe" Sanity check run stdout: ----- Sanity check run stderr: 100 ----- cudaGetDeviceCount() returned 100 Cuda compiler for the build machine: nvcc (nvcc 10.1.168) No CUFLAGS in the environment, not changing global flags. No LDFLAGS in the environment, not changing global flags. Sanity testing Cuda compiler: nvcc Is cross compiler: None. Sanity check compiler command line: nvcc -w -cudart static /build/meson/src/meson-0.51.0/b f0de5ce3c0/meson-private/sanitycheckcuda.cu -o /build/meson/src/meson-0.51.0/b f0de5ce3c0/meson-private/sanitycheckcuda.exe Sanity check compile stdout: ----- Sanity check compile stderr: ----- Sanity check run command line: nvcc --run "/build/meson/src/meson-0.51.0/b f0de5ce3c0/meson-private/sanitycheckcuda.exe" Sanity check run stdout: ----- Sanity check run stderr: 100 ----- cudaGetDeviceCount() returned 100 Cuda compiler for the host machine: nvcc (nvcc 10.1.168) Build machine cpu family: x86_64 Build machine cpu: x86_64 Traceback (most recent call last): File "/build/meson/src/meson-0.51.0/mesonbuild/mesonmain.py", line 127, in run return options.run_func(options) File "/build/meson/src/meson-0.51.0/mesonbuild/msetup.py", line 240, in run app.generate() File "/build/meson/src/meson-0.51.0/mesonbuild/msetup.py", line 158, in generate self._generate(env) File "/build/meson/src/meson-0.51.0/mesonbuild/msetup.py", line 187, in _generate intr.run() File "/build/meson/src/meson-0.51.0/mesonbuild/interpreter.py", line 3917, in run super().run() File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 407, in run self.evaluate_codeblock(self.ast, start=1) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 438, in evaluate_statement return self.assignment(cur) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 1048, in assignment value = self.evaluate_statement(node.value) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 773, in function_call return func(node, posargs, kwargs) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) [Previous line repeated 1 more time] File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 155, in wrapped ret = f(*wrapped_args, **wrapped_kwargs) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreter.py", line 3028, in func_dependency d = self.dependency_impl(name, display_name, kwargs) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreter.py", line 3075, in dependency_impl dep = dependencies.find_external_dependency(name, self.environment, kwargs) File "/build/meson/src/meson-0.51.0/mesonbuild/dependencies/base.py", line 2516, in find_external_dependency d = c() File "/build/meson/src/meson-0.51.0/mesonbuild/dependencies/misc.py", line 391, in __init__ self.compile_args = self.clib_compiler.thread_flags(environment) AttributeError: 'NoneType' object has no attribute 'thread_flags' ``` Arch Linux
2019-06-17T18:49:57Z
[]
[]
Traceback (most recent call last): File "/build/meson/src/meson-0.51.0/mesonbuild/mesonmain.py", line 127, in run return options.run_func(options) File "/build/meson/src/meson-0.51.0/mesonbuild/msetup.py", line 240, in run app.generate() File "/build/meson/src/meson-0.51.0/mesonbuild/msetup.py", line 158, in generate self._generate(env) File "/build/meson/src/meson-0.51.0/mesonbuild/msetup.py", line 187, in _generate intr.run() File "/build/meson/src/meson-0.51.0/mesonbuild/interpreter.py", line 3917, in run super().run() File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 407, in run self.evaluate_codeblock(self.ast, start=1) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 438, in evaluate_statement return self.assignment(cur) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 1048, in assignment value = self.evaluate_statement(node.value) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 773, in function_call return func(node, posargs, kwargs) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) [Previous line repeated 1 more time] File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 155, in wrapped ret = f(*wrapped_args, **wrapped_kwargs) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreter.py", line 3028, in func_dependency d = self.dependency_impl(name, display_name, kwargs) File "/build/meson/src/meson-0.51.0/mesonbuild/interpreter.py", line 3075, in dependency_impl dep = dependencies.find_external_dependency(name, self.environment, kwargs) File "/build/meson/src/meson-0.51.0/mesonbuild/dependencies/base.py", line 2516, in find_external_dependency d = c() File "/build/meson/src/meson-0.51.0/mesonbuild/dependencies/misc.py", line 391, in __init__ self.compile_args = self.clib_compiler.thread_flags(environment) AttributeError: 'NoneType' object has no attribute 'thread_flags'
9,277
mesonbuild/meson
mesonbuild__meson-5553
59e5ad66f2017e17692d64e2aa7d745ea3fe849d
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1653,8 +1653,7 @@ def generate_compile_rule_for(self, langname, compiler): self.generate_cs_compile_rule(compiler) return if langname == 'vala': - if self.environment.machines.matches_build_machine(compiler.for_machine): - self.generate_vala_compile_rules(compiler) + self.generate_vala_compile_rules(compiler) return if langname == 'rust': self.generate_rust_compile_rules(compiler) diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1117,6 +1117,9 @@ def find_library(self, *args, **kwargs): def get_library_dirs(self, *args, **kwargs): return () + def get_program_dirs(self, *args, **kwargs): + return () + def has_multi_arguments(self, args, env) -> Tuple[bool, bool]: raise EnvironmentException( 'Language {} does not support has_multi_arguments.'.format(
AttributeError: 'ValaCompiler' object has no attribute 'get_program_dirs' when cross compiling I'm trying to cross compile my Vala program from a Fedora container to Windows. Here is the end of the log: ``` Native C compiler: cc (gcc 9.1.1 "cc (GCC) 9.1.1 20190503 (Red Hat 9.1.1-1)") Cross C compiler: /usr/bin/x86_64-w64-mingw32-gcc (gcc 8.3.0) Native Vala compiler: valac (valac 0.44.3) Cross Vala compiler: valac (valac 0.44.3) Host machine cpu family: x86 Host machine cpu: i686 Target machine cpu family: x86 Target machine cpu: i686 Build machine cpu family: x86_64 Build machine cpu: x86_64 Found pkg-config: /usr/bin/pkg-config (1.6.1) Found pkg-config: /usr/bin/x86_64-w64-mingw32-pkg-config (0.28) Cross dependency glib-2.0 found: YES 2.58.3 Cross dependency gio-2.0 found: YES 2.58.3 Cross dependency gobject-2.0 found: YES 2.58.3 Cross dependency gee-0.8 found: YES 0.20.1 Cross dependency json-glib-1.0 found: YES 1.4.2 Cross dependency cairo found: YES 1.14.10 Cross dependency gtk+-3.0 found: YES 3.22.30 Cross dependency gdk-pixbuf-2.0 found: YES 2.36.11 Cross dependency gstreamer-1.0 found: YES 1.14.1 Cross dependency gstreamer-app-1.0 found: YES 1.14.1 Library m found: YES Build targets in project: 8 Found ninja-1.9.0 at /usr/bin/ninja Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 122, in run return options.run_func(options) File "/usr/lib/python3.7/site-packages/mesonbuild/msetup.py", line 246, in run app.generate() File "/usr/lib/python3.7/site-packages/mesonbuild/msetup.py", line 163, in generate self._generate(env) File "/usr/lib/python3.7/site-packages/mesonbuild/msetup.py", line 216, in _generate intr.backend.generate(intr) File "/usr/lib/python3.7/site-packages/mesonbuild/backend/ninjabackend.py", line 228, in generate self.generate_tests(outfile) File "/usr/lib/python3.7/site-packages/mesonbuild/backend/ninjabackend.py", line 738, in generate_tests self.serialize_tests() File "/usr/lib/python3.7/site-packages/mesonbuild/backend/backends.py", line 376, in serialize_tests self.write_test_file(datafile) File "/usr/lib/python3.7/site-packages/mesonbuild/backend/backends.py", line 716, in write_test_file self.write_test_serialisation(self.build.get_tests(), datafile) File "/usr/lib/python3.7/site-packages/mesonbuild/backend/backends.py", line 768, in write_test_serialisation pickle.dump(self.create_test_serialisation(tests), datafile) File "/usr/lib/python3.7/site-packages/mesonbuild/backend/backends.py", line 743, in create_test_serialisation extra_paths = self.determine_windows_extra_paths(exe, extra_bdeps, is_cross) File "/usr/lib/python3.7/site-packages/mesonbuild/backend/backends.py", line 709, in determine_windows_extra_paths result.update(self.get_mingw_extra_paths(target)) File "/usr/lib/python3.7/site-packages/mesonbuild/backend/backends.py", line 684, in get_mingw_extra_paths paths.update(cc.get_program_dirs(self.environment)) AttributeError: 'ValaCompiler' object has no attribute 'get_program_dirs' ```
2019-06-24T17:34:20Z
[]
[]
Traceback (most recent call last): File "/usr/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 122, in run return options.run_func(options) File "/usr/lib/python3.7/site-packages/mesonbuild/msetup.py", line 246, in run app.generate() File "/usr/lib/python3.7/site-packages/mesonbuild/msetup.py", line 163, in generate self._generate(env) File "/usr/lib/python3.7/site-packages/mesonbuild/msetup.py", line 216, in _generate intr.backend.generate(intr) File "/usr/lib/python3.7/site-packages/mesonbuild/backend/ninjabackend.py", line 228, in generate self.generate_tests(outfile) File "/usr/lib/python3.7/site-packages/mesonbuild/backend/ninjabackend.py", line 738, in generate_tests self.serialize_tests() File "/usr/lib/python3.7/site-packages/mesonbuild/backend/backends.py", line 376, in serialize_tests self.write_test_file(datafile) File "/usr/lib/python3.7/site-packages/mesonbuild/backend/backends.py", line 716, in write_test_file self.write_test_serialisation(self.build.get_tests(), datafile) File "/usr/lib/python3.7/site-packages/mesonbuild/backend/backends.py", line 768, in write_test_serialisation pickle.dump(self.create_test_serialisation(tests), datafile) File "/usr/lib/python3.7/site-packages/mesonbuild/backend/backends.py", line 743, in create_test_serialisation extra_paths = self.determine_windows_extra_paths(exe, extra_bdeps, is_cross) File "/usr/lib/python3.7/site-packages/mesonbuild/backend/backends.py", line 709, in determine_windows_extra_paths result.update(self.get_mingw_extra_paths(target)) File "/usr/lib/python3.7/site-packages/mesonbuild/backend/backends.py", line 684, in get_mingw_extra_paths paths.update(cc.get_program_dirs(self.environment)) AttributeError: 'ValaCompiler' object has no attribute 'get_program_dirs'
9,283
mesonbuild/meson
mesonbuild__meson-5558
31e069e93f1ab73214a10c3928e9dba4e7c7bb6c
diff --git a/msi/createmsi.py b/msi/createmsi.py --- a/msi/createmsi.py +++ b/msi/createmsi.py @@ -56,7 +56,7 @@ def __init__(self): redist_glob = 'C:\\Program Files\\Microsoft Visual Studio\\2017\\Community\\VC\\Redist\\MSVC\\*\\MergeModules\\Microsoft_VC141_CRT_x86.msm' trials = glob(redist_glob) if len(trials) != 1: - sys.exit('There are more than one potential redist dirs.') + sys.exit('Could not find unique MSM setup.') self.redist_path = trials[0] self.component_num = 0 self.feature_properties = { @@ -114,20 +114,24 @@ def build_dist(self): modules = self.get_all_modules_from_dir('mesonbuild/modules') modules += self.get_all_modules_from_dir('mesonbuild/scripts') modules += self.get_more_modules() - modulestr = ','.join(modules) - python = shutil.which('python') - cxfreeze = os.path.join(os.path.dirname(python), "Scripts", "cxfreeze") - if not os.path.isfile(cxfreeze): - print("ERROR: This script requires cx_freeze module") + + pyinstaller = shutil.which('pyinstaller') + if not pyinstaller: + print("ERROR: This script requires pyinstaller.") sys.exit(1) - subprocess.check_call([python, - cxfreeze, - '--target-dir', - main_stage, - '--include-modules', - modulestr, - 'meson.py']) + pyinstaller_tmpdir = 'pyinst-tmp' + if os.path.exists(pyinstaller_tmpdir): + shutil.rmtree(pyinstaller_tmpdir) + pyinst_cmd = [pyinstaller, + '--clean', + '--distpath', + pyinstaller_tmpdir] + for m in modules: + pyinst_cmd += ['--hidden-import', m] + pyinst_cmd += ['meson.py'] + subprocess.check_call(pyinst_cmd) + shutil.move(pyinstaller_tmpdir + '/meson', main_stage) if not os.path.exists(os.path.join(main_stage, 'meson.exe')): sys.exit('Meson exe missing from staging dir.') os.mkdir(ninja_stage) @@ -288,7 +292,7 @@ def build_package(self): if __name__ == '__main__': if not os.path.exists('meson.py'): sys.exit(print('Run me in the top level source dir.')) - subprocess.check_call(['pip', 'install', '--upgrade', 'cx_freeze']) + subprocess.check_call(['pip', 'install', '--upgrade', 'pyinstaller']) p = PackageGenerator() p.build_dist()
running meson fails on latest release 0.51.0 i installed meson 0.51.0 64 using the msi installer and when running "meson" as a test i produces this stack trace: Traceback (most recent call last): ``` File "C:\python\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run File "C:\python\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run File "meson.py", line 22, in <module> File "C:\python\lib\pathlib.py", line 1109, in resolve File "C:\python\lib\pathlib.py", line 186, in resolve FileNotFoundError: [WinError 2] The system cannot find the file specified: 'meson' ``` i rolled back to version 0.50.1 which worked correctly
2019-06-25T18:12:34Z
[]
[]
Traceback (most recent call last): ``` File "C:\python\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run File "C:\python\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run File "meson.py", line 22, in <module> File "C:\python\lib\pathlib.py", line 1109, in resolve File "C:\python\lib\pathlib.py", line 186, in resolve FileNotFoundError: [WinError 2] The system cannot find the file specified: 'meson'
9,284
mesonbuild/meson
mesonbuild__meson-5564
e182dba61feb5b6872154e245014c58d99aa39d8
diff --git a/run_unittests.py b/run_unittests.py --- a/run_unittests.py +++ b/run_unittests.py @@ -4000,12 +4000,15 @@ def test_find_program(self): # Finding a script with an extension inside a directory works prog = ExternalProgram(os.path.join(testdir, 'test-script-ext.py')) self.assertTrue(prog.found(), msg='test-script-ext.py not found') - # Finding a script in PATH w/o extension works and adds the interpreter + # Finding a script in PATH os.environ['PATH'] += os.pathsep + testdir - prog = ExternalProgram('test-script-ext') - self.assertTrue(prog.found(), msg='test-script-ext not found in PATH') - self.assertPathEqual(prog.get_command()[0], python_command[0]) - self.assertPathBasenameEqual(prog.get_path(), 'test-script-ext.py') + # Finding a script in PATH w/o extension works and adds the interpreter + # (check only if `.PY` is in PATHEXT) + if '.PY' in [ext.upper() for ext in os.environ['PATHEXT'].split(';')]: + prog = ExternalProgram('test-script-ext') + self.assertTrue(prog.found(), msg='test-script-ext not found in PATH') + self.assertPathEqual(prog.get_command()[0], python_command[0]) + self.assertPathBasenameEqual(prog.get_path(), 'test-script-ext.py') # Finding a script in PATH with extension works and adds the interpreter prog = ExternalProgram('test-script-ext.py') self.assertTrue(prog.found(), msg='test-script-ext.py not found in PATH')
find_program('some-script') can't find some-script.py if .py isn't in PATHEXT `test_find_program()` (a windows-only test) fails if `.py` isn't in `PATHEXT` ``` C:\meson>py run_unittests.py WindowsTests.test_find_program F Stdout: Program cmd found: YES (C:\WINDOWS\system32\cmd.EXE) Program cmd.exe found: YES (C:\WINDOWS\system32\cmd.exe) Program C:\WINDOWS\system32\cmd found: YES (C:\WINDOWS\system32\cmd.exe) Program C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script found: YES (python C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script) Program C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script-ext.py found: YES (C:\Users\jon\AppData\Local\Programs\Python\Python36\python.exe C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script-ext.py) Program test-script-ext found: NO ====================================================================== FAIL: test_find_program (__main__.WindowsTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "run_unittests.py", line 3041, in test_find_program self.assertTrue(prog.found(), msg='test-script-ext not found in PATH') AssertionError: False is not true : test-script-ext not found in PATH Stdout: Program cmd found: YES (C:\WINDOWS\system32\cmd.EXE) Program cmd.exe found: YES (C:\WINDOWS\system32\cmd.exe) Program C:\WINDOWS\system32\cmd found: YES (C:\WINDOWS\system32\cmd.exe) Program C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script found: YES (python C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script) Program C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script-ext.py found: YES (C:\Users\jon\AppData\Local\Programs\Python\Python36\python.exe C:\cygwin64\wip\meson\test cases/windows\8 find program\test-script-ext.py) Program test-script-ext found: NO ---------------------------------------------------------------------- Ran 1 test in 0.059s FAILED (failures=1) C:\meson>echo %PATHEXT% .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC C:\meson>set PATHEXT=%PATHEXT%;.py C:\meson>py run_unittests.py WindowsTests.test_find_program . ---------------------------------------------------------------------- Ran 1 test in 0.025s OK ```
This test case seems a little odd. `find_program('foo')` will (sometimes) find `foo.py` on windows, but not on any other platform? Yes, that's how Windows `PATH` searching works. There's no executable bit, so executables are identified by their extension. The default value for `PATHEXT` is `.COM;.EXE;.BAT;.CMD` and if you want python scripts to be identified as executables, you have to append `;.PY` to that (the Python installer does this for you). Of course this is optional, and the reason why the test contains this is just to ensure that this edge-case works (I'm sure some windows-only meson projects will want to assume that `find_program('foo')` can find `foo.py` in the correct configuration). Nothing in Meson depends on it, since we expect people to look for scripts with `find_program('foo.py')` since that is the cross-platform way of doing it. We can just skip that line of the test if `.PY` is not in `PATHEXT`, but we should ensure that at least one of our CI jobs has `.PY` in `PATHEXT`. Also, Meson supports looking for scripts with a `#!.* python` named `foo` with `find_program('foo')` through manual listing of directories specified in `PATH` because a lot of Linux-origin projects tend to install scripts without extensions on all platforms (f.ex., glib).
2019-06-26T22:50:46Z
[]
[]
Traceback (most recent call last): File "run_unittests.py", line 3041, in test_find_program self.assertTrue(prog.found(), msg='test-script-ext not found in PATH') AssertionError: False is not true : test-script-ext not found in PATH
9,287
mesonbuild/meson
mesonbuild__meson-5601
968aee4f18caa0abe384f04c4dee07402d87ad40
diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py --- a/mesonbuild/envconfig.py +++ b/mesonbuild/envconfig.py @@ -340,6 +340,10 @@ def lookup_entry(self, name: str) -> typing.Optional[typing.List[str]]: command = os.environ.get(evar) if command is not None: command = shlex.split(command) + + # Do not return empty string entries + if command is not None and len(command) == 0: + return None return command class Directories:
Empty compiler env variables crash meson When meson is invoked with empty env variables for the compiler, it crashes meson. ``` cd dav1d && CC= CXX= LD= AR= CCAS= RANLIB= STRIP= PATH="/Users/epirat/Projects/VideoLAN/VLC/build-test/contrib/arm64-apple-iOS_9.0/bin:/Users/epirat/Projects/VideoLAN/VLC/extras/tools/build/bin:/Users/epirat/Projects/VideoLAN/VLC/contrib/x86_64-apple-darwin16/bin:/Users/epirat/Projects/VideoLAN/VLC/extras/tools/build/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" CPPFLAGS= CFLAGS= CXXFLAGS= LDFLAGS= meson --default-library static --prefix "/Users/epirat/Projects/VideoLAN/VLC/build-test/contrib/arm64-apple-iOS_9.0" --backend ninja -Dlibdir=lib --buildtype release --cross-file /Users/epirat/Projects/VideoLAN/VLC/contrib/contrib-arm64-apple-iOS_9.0/crossfile.meson -D build_tests=false -D build_tools=false build The Meson build system Version: 0.50.1 Source dir: /Users/epirat/Projects/VideoLAN/VLC/contrib/contrib-arm64-apple-iOS_9.0/dav1d Build dir: /Users/epirat/Projects/VideoLAN/VLC/contrib/contrib-arm64-apple-iOS_9.0/dav1d/build Build type: cross build Project name: dav1d Project version: 0.3.1 Traceback (most recent call last): File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/mesonmain.py", line 122, in run return options.run_func(options) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/msetup.py", line 246, in run app.generate() File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/msetup.py", line 163, in generate self._generate(env) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/msetup.py", line 180, in _generate intr = interpreter.Interpreter(b) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreter.py", line 2026, in __init__ self.parse_project() File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 392, in parse_project self.evaluate_codeblock(self.ast, end=1) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 762, in function_call return func(node, posargs, kwargs) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 143, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreter.py", line 2619, in func_project self.add_languages(proj_langs, True) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreter.py", line 2691, in add_languages (comp, cross_comp) = self.environment.detect_compilers(lang, need_cross_compiler) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 1125, in detect_compilers (comp, cross_comp) = self.compilers_from_language(lang, need_cross_compiler) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 1063, in compilers_from_language comp = self.detect_c_compiler(False) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 769, in detect_c_compiler return self._detect_c_or_cpp_compiler('c', want_cross) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 620, in _detect_c_or_cpp_compiler compilers, ccache, is_cross, exe_wrap = self._get_compilers(lang, want_cross) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 592, in _get_compilers compilers, ccache = BinaryTable.parse_entry(value) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/envconfig.py", line 363, in parse_entry if compiler[0] == 'ccache': IndexError: list index out of range make: *** [.dav1d] Error 2 ```
2019-07-04T20:07:00Z
[]
[]
Traceback (most recent call last): File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/mesonmain.py", line 122, in run return options.run_func(options) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/msetup.py", line 246, in run app.generate() File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/msetup.py", line 163, in generate self._generate(env) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/msetup.py", line 180, in _generate intr = interpreter.Interpreter(b) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreter.py", line 2026, in __init__ self.parse_project() File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 392, in parse_project self.evaluate_codeblock(self.ast, end=1) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 762, in function_call return func(node, posargs, kwargs) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 143, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreter.py", line 2619, in func_project self.add_languages(proj_langs, True) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreter.py", line 2691, in add_languages (comp, cross_comp) = self.environment.detect_compilers(lang, need_cross_compiler) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 1125, in detect_compilers (comp, cross_comp) = self.compilers_from_language(lang, need_cross_compiler) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 1063, in compilers_from_language comp = self.detect_c_compiler(False) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 769, in detect_c_compiler return self._detect_c_or_cpp_compiler('c', want_cross) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 620, in _detect_c_or_cpp_compiler compilers, ccache, is_cross, exe_wrap = self._get_compilers(lang, want_cross) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 592, in _get_compilers compilers, ccache = BinaryTable.parse_entry(value) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/envconfig.py", line 363, in parse_entry if compiler[0] == 'ccache': IndexError: list index out of range
9,298
mesonbuild/meson
mesonbuild__meson-5607
b347f00dc0a921f99ade780223a2fd3a18431cc6
diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py --- a/mesonbuild/envconfig.py +++ b/mesonbuild/envconfig.py @@ -341,8 +341,8 @@ def lookup_entry(self, name: str) -> typing.Optional[typing.List[str]]: if command is not None: command = shlex.split(command) - # Do not return empty string entries - if command is not None and len(command) == 0: + # Do not return empty or blank string entries + if command is not None and (len(command) == 0 or len(command[0].strip()) == 0): return None return command
Empty compiler env variables crash meson When meson is invoked with empty env variables for the compiler, it crashes meson. ``` cd dav1d && CC= CXX= LD= AR= CCAS= RANLIB= STRIP= PATH="/Users/epirat/Projects/VideoLAN/VLC/build-test/contrib/arm64-apple-iOS_9.0/bin:/Users/epirat/Projects/VideoLAN/VLC/extras/tools/build/bin:/Users/epirat/Projects/VideoLAN/VLC/contrib/x86_64-apple-darwin16/bin:/Users/epirat/Projects/VideoLAN/VLC/extras/tools/build/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" CPPFLAGS= CFLAGS= CXXFLAGS= LDFLAGS= meson --default-library static --prefix "/Users/epirat/Projects/VideoLAN/VLC/build-test/contrib/arm64-apple-iOS_9.0" --backend ninja -Dlibdir=lib --buildtype release --cross-file /Users/epirat/Projects/VideoLAN/VLC/contrib/contrib-arm64-apple-iOS_9.0/crossfile.meson -D build_tests=false -D build_tools=false build The Meson build system Version: 0.50.1 Source dir: /Users/epirat/Projects/VideoLAN/VLC/contrib/contrib-arm64-apple-iOS_9.0/dav1d Build dir: /Users/epirat/Projects/VideoLAN/VLC/contrib/contrib-arm64-apple-iOS_9.0/dav1d/build Build type: cross build Project name: dav1d Project version: 0.3.1 Traceback (most recent call last): File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/mesonmain.py", line 122, in run return options.run_func(options) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/msetup.py", line 246, in run app.generate() File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/msetup.py", line 163, in generate self._generate(env) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/msetup.py", line 180, in _generate intr = interpreter.Interpreter(b) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreter.py", line 2026, in __init__ self.parse_project() File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 392, in parse_project self.evaluate_codeblock(self.ast, end=1) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 762, in function_call return func(node, posargs, kwargs) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 143, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreter.py", line 2619, in func_project self.add_languages(proj_langs, True) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreter.py", line 2691, in add_languages (comp, cross_comp) = self.environment.detect_compilers(lang, need_cross_compiler) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 1125, in detect_compilers (comp, cross_comp) = self.compilers_from_language(lang, need_cross_compiler) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 1063, in compilers_from_language comp = self.detect_c_compiler(False) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 769, in detect_c_compiler return self._detect_c_or_cpp_compiler('c', want_cross) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 620, in _detect_c_or_cpp_compiler compilers, ccache, is_cross, exe_wrap = self._get_compilers(lang, want_cross) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 592, in _get_compilers compilers, ccache = BinaryTable.parse_entry(value) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/envconfig.py", line 363, in parse_entry if compiler[0] == 'ccache': IndexError: list index out of range make: *** [.dav1d] Error 2 ```
2019-07-05T20:09:17Z
[]
[]
Traceback (most recent call last): File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/mesonmain.py", line 122, in run return options.run_func(options) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/msetup.py", line 246, in run app.generate() File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/msetup.py", line 163, in generate self._generate(env) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/msetup.py", line 180, in _generate intr = interpreter.Interpreter(b) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreter.py", line 2026, in __init__ self.parse_project() File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 392, in parse_project self.evaluate_codeblock(self.ast, end=1) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 762, in function_call return func(node, posargs, kwargs) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 143, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreter.py", line 2619, in func_project self.add_languages(proj_langs, True) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/interpreter.py", line 2691, in add_languages (comp, cross_comp) = self.environment.detect_compilers(lang, need_cross_compiler) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 1125, in detect_compilers (comp, cross_comp) = self.compilers_from_language(lang, need_cross_compiler) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 1063, in compilers_from_language comp = self.detect_c_compiler(False) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 769, in detect_c_compiler return self._detect_c_or_cpp_compiler('c', want_cross) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 620, in _detect_c_or_cpp_compiler compilers, ccache, is_cross, exe_wrap = self._get_compilers(lang, want_cross) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/environment.py", line 592, in _get_compilers compilers, ccache = BinaryTable.parse_entry(value) File "/Users/epirat/Projects/VideoLAN/VLC/extras/tools/meson/mesonbuild/envconfig.py", line 363, in parse_entry if compiler[0] == 'ccache': IndexError: list index out of range
9,300
mesonbuild/meson
mesonbuild__meson-57
a084a8ec3ec12e91c3897dc6b805636be6d36527
diff --git a/install_meson.py b/install_meson.py --- a/install_meson.py +++ b/install_meson.py @@ -107,7 +107,7 @@ shutil.rmtree(module_dir) shutil.copytree('modules', module_dir) -if os.path.exists(os.path.join('/usr', rpmmacros_dir)): +if os.path.exists('/usr/bin/rpm'): print('Installing RPM macros to %s.' % rpmmacros_dir) outfilename = os.path.join(rpmmacros_dir, 'macros.meson') os.makedirs(rpmmacros_dir, exist_ok=True)
won't install rpm macros ``` Installing RPM macros to /home/brain/rpmbuild/BUILDROOT/meson-0.22.0-7.20150321gita5f30e7.fc23.x86_64/usr/lib/rpm/macros.d. Traceback (most recent call last): File "./install_meson.py", line 112, in <module> shutil.copyfile('macros.meson', outfilename) File "/usr/lib64/python3.4/shutil.py", line 108, in copyfile with open(dst, 'wb') as fdst: FileNotFoundError: [Errno 2] No such file or directory: '/home/brain/rpmbuild/BUILDROOT/meson-0.22.0-7.20150321gita5f30e7.fc23.x86_64/usr/lib/rpm/macros.d/macros.meson' ``` We need to do mkdir I think and have install option in `OptionParser` instead of check if path exists
Fixed the directory creation. I would prefer it if there was a reliable way to detect whether you should install the rpm macros or not so because less configuration options is always better. If there is no reliable way, though, then adding an option is ok. I think we need to check if `/usr/bin/rpm` is exists.
2015-03-21T14:11:37Z
[]
[]
Traceback (most recent call last): File "./install_meson.py", line 112, in <module> shutil.copyfile('macros.meson', outfilename) File "/usr/lib64/python3.4/shutil.py", line 108, in copyfile with open(dst, 'wb') as fdst: FileNotFoundError: [Errno 2] No such file or directory: '/home/brain/rpmbuild/BUILDROOT/meson-0.22.0-7.20150321gita5f30e7.fc23.x86_64/usr/lib/rpm/macros.d/macros.meson'
9,309
mesonbuild/meson
mesonbuild__meson-5744
148a3a83a647a21cc102cb01d82cbeeb0940adc8
diff --git a/mesonbuild/ast/interpreter.py b/mesonbuild/ast/interpreter.py --- a/mesonbuild/ast/interpreter.py +++ b/mesonbuild/ast/interpreter.py @@ -325,7 +325,7 @@ def flatten_kwargs(self, kwargs: object, include_unknown_args: bool = False): for key, val in kwargs.items(): if isinstance(val, ElementaryNode): flattend_kwargs[key] = val.value - elif isinstance(val, (ArrayNode, ArgumentNode)): + elif isinstance(val, (ArrayNode, ArgumentNode, ArithmeticNode, MethodNode)): flattend_kwargs[key] = self.flatten_args(val, include_unknown_args) elif isinstance(val, (str, bool, int, float)) or include_unknown_args: flattend_kwargs[key] = val diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py --- a/mesonbuild/ast/introspection.py +++ b/mesonbuild/ast/introspection.py @@ -158,16 +158,20 @@ def build_target(self, node, args, kwargs, targetclass): args = self.flatten_args(args) if not args or not isinstance(args[0], str): return - kwargs = self.flatten_kwargs(kwargs, True) name = args[0] srcqueue = [node] + + # Process the soruces BEFORE flattening the kwargs, to preserve the original nodes if 'sources' in kwargs: - srcqueue += kwargs['sources'] + srcqueue += mesonlib.listify(kwargs['sources']) + + kwargs = self.flatten_kwargs(kwargs, True) source_nodes = [] while srcqueue: curr = srcqueue.pop(0) arg_node = None + assert(isinstance(curr, BaseNode)) if isinstance(curr, FunctionNode): arg_node = curr.args elif isinstance(curr, ArrayNode):
meson configure crashes with TypeError ``` Traceback (most recent call last): File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/mesonmain.py", line 129, in run return options.run_func(options) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/mconf.py", line 208, in run c = Conf(builddir) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/mconf.py", line 57, in __init__ intr.analyze() File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/ast/introspection.py", line 277, in analyze self.run() File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 412, in run self.evaluate_codeblock(self.ast, start=1) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 436, in evaluate_codeblock raise e File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 430, in evaluate_codeblock self.evaluate_statement(cur) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 441, in evaluate_statement return self.function_call(cur) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 778, in function_call return func(node, posargs, kwargs) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/ast/interpreter.py", line 163, in func_subdir self.evaluate_codeblock(codeblock) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 436, in evaluate_codeblock raise e File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 430, in evaluate_codeblock self.evaluate_statement(cur) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 443, in evaluate_statement return self.assignment(cur) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/ast/interpreter.py", line 245, in assignment self.assign_vals[node.var_name] = [self.evaluate_statement(node.value)] # Evaluate the value just in case File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 441, in evaluate_statement return self.function_call(cur) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 778, in function_call return func(node, posargs, kwargs) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/ast/introspection.py", line 237, in func_shared_lib return self.build_target(node, args, kwargs, SharedLibrary) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/ast/introspection.py", line 165, in build_target srcqueue += kwargs['sources'] TypeError: 'ArithmeticNode' object is not iterable ``` Tested with c904d3eefe2a01ca60027e2a5192e1f1c7ca5d9d --- Example meson.build on which it fails: ``` common_inc = include_directories('.') common_cflags = ['-DG_LOG_DOMAIN="@0@"'.format(gvfs_name.to_upper())] sources = files( 'gmountoperationdbus.c', 'gmountsource.c', 'gmountspec.c', 'gmounttracker.c', 'gvfsdaemonprotocol.c', 'gvfsfileinfo.c', 'gvfsicon.c', 'gvfsmonitorimpl.c', 'gvfsutils.c', ) dbus_sources = gnome.gdbus_codegen( 'gvfsdbus', gvfs_namespace + '.xml', interface_prefix: gvfs_namespace + '.', namespace: 'GVfsDBus', autocleanup: 'objects', ) deps = [ gio_dep, glib_dep, gobject_dep, ] cflags = common_cflags + ['-DREMOTE_VOLUME_MONITORS_DIR="@0@"'.format(gvfs_prefix / gvfs_remote_volume_monitors_dir)] libgvfscommon = shared_library( 'gvfscommon', sources: sources + [dbus_sources], include_directories: top_inc, dependencies: deps + [gio_unix_dep], c_args: cflags, install: true, install_dir: gvfs_pkglibdir, ) libgvfscommon_dep = declare_dependency( sources: dbus_sources[1], include_directories: common_inc, dependencies: deps, link_with: libgvfscommon, ) ``` (truncated from https://gitlab.gnome.org/GNOME/gvfs/blob/master/common/meson.build)
2019-07-30T16:32:48Z
[]
[]
Traceback (most recent call last): File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/mesonmain.py", line 129, in run return options.run_func(options) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/mconf.py", line 208, in run c = Conf(builddir) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/mconf.py", line 57, in __init__ intr.analyze() File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/ast/introspection.py", line 277, in analyze self.run() File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 412, in run self.evaluate_codeblock(self.ast, start=1) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 436, in evaluate_codeblock raise e File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 430, in evaluate_codeblock self.evaluate_statement(cur) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 441, in evaluate_statement return self.function_call(cur) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 778, in function_call return func(node, posargs, kwargs) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/ast/interpreter.py", line 163, in func_subdir self.evaluate_codeblock(codeblock) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 436, in evaluate_codeblock raise e File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 430, in evaluate_codeblock self.evaluate_statement(cur) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 443, in evaluate_statement return self.assignment(cur) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/ast/interpreter.py", line 245, in assignment self.assign_vals[node.var_name] = [self.evaluate_statement(node.value)] # Evaluate the value just in case File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 441, in evaluate_statement return self.function_call(cur) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/interpreterbase.py", line 778, in function_call return func(node, posargs, kwargs) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/ast/introspection.py", line 237, in func_shared_lib return self.build_target(node, args, kwargs, SharedLibrary) File "/home/peterke/DEV/meson/venv/lib64/python3.7/site-packages/meson-0.51.999-py3.7.egg/mesonbuild/ast/introspection.py", line 165, in build_target srcqueue += kwargs['sources'] TypeError: 'ArithmeticNode' object is not iterable
9,312
mesonbuild/meson
mesonbuild__meson-5834
f097b96883a54868cf98600be23893268b5832f4
diff --git a/mesonbuild/cmake/executor.py b/mesonbuild/cmake/executor.py --- a/mesonbuild/cmake/executor.py +++ b/mesonbuild/cmake/executor.py @@ -43,11 +43,11 @@ def __init__(self, environment: Environment, version: str, for_machine: MachineC return if not version_compare(self.cmakevers, self.min_version): - self.cmakebin = None mlog.warning( 'The version of CMake', mlog.bold(self.cmakebin.get_path()), 'is', mlog.bold(self.cmakevers), 'but version', mlog.bold(self.min_version), 'is required') + self.cmakebin = None return def find_cmake_binary(self, environment: Environment, silent: bool = False) -> Tuple['ExternalProgram', str]:
CMake: dependency() crashes Meson with old CMake versions When on a system with an old CMake version, using any Meson `dependency()` statement crashes Meson. HPC systems typically default to old version of everything, including CMake. Maybe doing an internal version check on CMake in general would be helpful before assuming we can use CMake inside Meson? In this particular case, CMake 2.8.12.2 was present, and any `dependency()` statement results in ```sh Traceback (most recent call last): File "mesonbuild/mesonmain.py", line 129, in run return options.run_func(options) File "mesonbuild/msetup.py", line 244, in run app.generate() File "mesonbuild/msetup.py", line 159, in generate self._generate(env) File "mesonbuild/msetup.py", line 191, in _generate intr.run() File "mesonbuild/interpreter.py", line 3985, in run super().run() File "mesonbuild/interpreterbase.py", line 412, in run self.evaluate_codeblock(self.ast, start=1) File "mesonbuild/interpreterbase.py", line 436, in evaluate_codeblock raise e File "mesonbuild/interpreterbase.py", line 430, in evaluate_codeblock self.evaluate_statement(cur) File "mesonbuild/interpreterbase.py", line 443, in evaluate_statement return self.assignment(cur) File "mesonbuild/interpreterbase.py", line 1053, in assignment value = self.evaluate_statement(node.value) File "mesonbuild/interpreterbase.py", line 441, in evaluate_statement return self.function_call(cur) File "mesonbuild/interpreterbase.py", line 778, in function_call return func(node, posargs, kwargs) File "mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "mesonbuild/interpreterbase.py", line 155, in wrapped ret = f(*wrapped_args, **wrapped_kwargs) File "mesonbuild/interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "mesonbuild/interpreter.py", line 3079, in func_dependency d = self.dependency_impl(name, display_name, kwargs) File "mesonbuild/interpreter.py", line 3126, in dependency_impl dep = dependencies.find_external_dependency(name, self.environment, kwargs) File "mesonbuild/dependencies/base.py", line 2094, in find_external_dependency d = c() File "mesonbuild/dependencies/misc.py", line 55, in __init__ cmakedep = CMakeDependency('OpenCoarrays', environment, kwargs) File "mesonbuild/dependencies/base.py", line 1014, in __init__ self.cmakebin = CMakeExecutor(environment, CMakeDependency.class_cmake_version, self.for_machine, silent=self.silent) File "mesonbuild/cmake/executor.py", line 48, in __init__ 'The version of CMake', mlog.bold(self.cmakebin.get_path()), AttributeError: 'NoneType' object has no attribute 'get_path' ``` ``` $ cmake --version cmake version 2.8.12.2 ```
The version should already be checked. There should be at least a log entry. Is this the case?
2019-08-22T19:13:38Z
[]
[]
Traceback (most recent call last): File "mesonbuild/mesonmain.py", line 129, in run return options.run_func(options) File "mesonbuild/msetup.py", line 244, in run app.generate() File "mesonbuild/msetup.py", line 159, in generate self._generate(env) File "mesonbuild/msetup.py", line 191, in _generate intr.run() File "mesonbuild/interpreter.py", line 3985, in run super().run() File "mesonbuild/interpreterbase.py", line 412, in run self.evaluate_codeblock(self.ast, start=1) File "mesonbuild/interpreterbase.py", line 436, in evaluate_codeblock raise e File "mesonbuild/interpreterbase.py", line 430, in evaluate_codeblock self.evaluate_statement(cur) File "mesonbuild/interpreterbase.py", line 443, in evaluate_statement return self.assignment(cur) File "mesonbuild/interpreterbase.py", line 1053, in assignment value = self.evaluate_statement(node.value) File "mesonbuild/interpreterbase.py", line 441, in evaluate_statement return self.function_call(cur) File "mesonbuild/interpreterbase.py", line 778, in function_call return func(node, posargs, kwargs) File "mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "mesonbuild/interpreterbase.py", line 155, in wrapped ret = f(*wrapped_args, **wrapped_kwargs) File "mesonbuild/interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "mesonbuild/interpreter.py", line 3079, in func_dependency d = self.dependency_impl(name, display_name, kwargs) File "mesonbuild/interpreter.py", line 3126, in dependency_impl dep = dependencies.find_external_dependency(name, self.environment, kwargs) File "mesonbuild/dependencies/base.py", line 2094, in find_external_dependency d = c() File "mesonbuild/dependencies/misc.py", line 55, in __init__ cmakedep = CMakeDependency('OpenCoarrays', environment, kwargs) File "mesonbuild/dependencies/base.py", line 1014, in __init__ self.cmakebin = CMakeExecutor(environment, CMakeDependency.class_cmake_version, self.for_machine, silent=self.silent) File "mesonbuild/cmake/executor.py", line 48, in __init__ 'The version of CMake', mlog.bold(self.cmakebin.get_path()), AttributeError: 'NoneType' object has no attribute 'get_path'
9,321
mesonbuild/meson
mesonbuild__meson-5872
cf55cd5c922f519e30ca33b9c7d07115f6c1fa80
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -248,8 +248,8 @@ def detect_vs_dep_prefix(self, tempfilename): # and locale dependent. Any attempt at converting it to # Python strings leads to failure. We _must_ do this detection # in raw byte mode and write the result in raw bytes. - pc = subprocess.Popen([compiler.get_exelist(), - '/showIncludes', '/c', 'incdetect.c'], + pc = subprocess.Popen(compiler.get_exelist() + + ['/showIncludes', '/c', 'incdetect.c'], cwd=self.environment.get_scratch_dir(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = pc.communicate()
All Projects fail to configure on windows with python 3.8 beta This is strange since the CI for windows appears to be passing. I have tried to configure a project on windows (even the trivial testcase project) on both my machines, with vs 2019, vs 2019 preview and vs 2019 internal nightly builds and all fail with the error: ``` Traceback (most recent call last): File "c:\users\barch\source\repos\meson\mesonbuild\mesonmain.py", line 129, in run return options.run_func(options) File "c:\users\barch\source\repos\meson\mesonbuild\msetup.py", line 244, in run app.generate() File "c:\users\barch\source\repos\meson\mesonbuild\msetup.py", line 159, in generate self._generate(env) File "c:\users\barch\source\repos\meson\mesonbuild\msetup.py", line 214, in _generate intr.backend.generate(intr) File "c:\users\barch\source\repos\meson\mesonbuild\backend\ninjabackend.py", line 301, in generate with self.detect_vs_dep_prefix(tempfilename) as outfile: File "c:\users\barch\source\repos\meson\mesonbuild\backend\ninjabackend.py", line 251, in detect_vs_dep_prefix pc = subprocess.Popen([compiler.get_exelist(), File "c:\users\barch\appdata\local\programs\python\python38\lib\subprocess.py", line 829, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "c:\users\barch\appdata\local\programs\python\python38\lib\subprocess.py", line 1218, in _execute_child args = list2cmdline(args) File "c:\users\barch\appdata\local\programs\python\python38\lib\subprocess.py", line 524, in list2cmdline for arg in map(os.fsdecode, seq): File "c:\users\barch\appdata\local\programs\python\python38\lib\os.py", line 815, in fsdecode filename = fspath(filename) # Does type-checking of `filename`. TypeError: expected str, bytes or os.PathLike object, not list ``` this may be related to #5639 but the fact I get it everywhere indicates perhaps a more critical issue, or a problem with versions of visual studio that are not tested by CI.
Coincidentally I was working with VS2019 by itself, and separately with ICC over the past few days including today on some C / C++ projects with VS2019 and a couple different recent commits on meson master branch. I didn't see any issues. ``` C compiler for the host machine: cl (msvc 19.22.27905) C linker for the host machine: link 19.22.27905 ``` ``` C compiler for the host machine: icl (intel-cl 19.1.0.085) C linker for the host machine: xilink 19.1.0.085 ``` ``` C compiler for the host machine: cl (msvc 19.22.27905) C linker for the host machine: link 19.22.27905 ``` that's from the x64 native command prompt meson 0.51.999 (f097b96883a54868cf98600be23893268b5832f4) python 3.8.0b2 do you have multiple visual studio instances installed? Where is ninja coming from? I was also using x64 native command. I have vs2017 installed through the vs2019 installer also. Using Miniconda Python 3.7 installed standalone (not thru VS). Ninja 1.9 binary was downloaded from GitHub releases and manually put on Path. I also can't replicate, I'm using ninja from chocolatey. I have 2015, 2017, and 2019 installed. Is there a good reason you're using a beta release of Python? I was working on some python code using the new features of typing. Looks like this bug doesn't happen on python 3.7 It looks like 3.8 would prefer the list passed to `subprocess` be flattened. It may or may not be considered a regression, but it seems easy enough to fix on Meson side. Here's what I experience, so far still not seeing bug with a few tests tried: ```posh c:\python38\python --version Python 3.8.0b3 ``` then from vs2019 x64 native shell and f097b96 ```posh c:\python38\python run_project_tests --only common c : cl (msvc 19.22.27905) cpp : cl (msvc 19.22.27905) Total passed tests: 214 Total failed tests: 0 Total skipped tests: 9 ``` So maybe there is some other distinction we're missing > It may or may not be considered a regression It would *definitely* be a Python regression, because passing a list is almost always better than a string because in the latter case you get into quoting/escaping hell. It's not just a list, it's a nested list. > It's not just a list, it's a nested list. Ah, I missed that. Yeah, that's not necessarily a bug. We should fix it. Is there a specific test case or example that fails. In case it was fixed already in python 3.8 beta 3 `test cases/common/1 trivial` OK thanks--I am not able to reproduce the issue here, maybe someone more experienced can. I just tried again with: * Meson latest master: cf55cd5c9 * Python 3.8 beta 4 * msvc 19.22.27905 Should we do a proactive list flattening with itertools.chain() ? With Python 3.8 beta 4 and `intel-cl 19.1.0.085` that this error occurs for me as well. I get the same traceback as the original post. With Python 3.7 I don't get the error.
2019-09-01T17:42:26Z
[]
[]
Traceback (most recent call last): File "c:\users\barch\source\repos\meson\mesonbuild\mesonmain.py", line 129, in run return options.run_func(options) File "c:\users\barch\source\repos\meson\mesonbuild\msetup.py", line 244, in run app.generate() File "c:\users\barch\source\repos\meson\mesonbuild\msetup.py", line 159, in generate self._generate(env) File "c:\users\barch\source\repos\meson\mesonbuild\msetup.py", line 214, in _generate intr.backend.generate(intr) File "c:\users\barch\source\repos\meson\mesonbuild\backend\ninjabackend.py", line 301, in generate with self.detect_vs_dep_prefix(tempfilename) as outfile: File "c:\users\barch\source\repos\meson\mesonbuild\backend\ninjabackend.py", line 251, in detect_vs_dep_prefix pc = subprocess.Popen([compiler.get_exelist(), File "c:\users\barch\appdata\local\programs\python\python38\lib\subprocess.py", line 829, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "c:\users\barch\appdata\local\programs\python\python38\lib\subprocess.py", line 1218, in _execute_child args = list2cmdline(args) File "c:\users\barch\appdata\local\programs\python\python38\lib\subprocess.py", line 524, in list2cmdline for arg in map(os.fsdecode, seq): File "c:\users\barch\appdata\local\programs\python\python38\lib\os.py", line 815, in fsdecode filename = fspath(filename) # Does type-checking of `filename`. TypeError: expected str, bytes or os.PathLike object, not list
9,325
mesonbuild/meson
mesonbuild__meson-5921
ad368cfc07b1bac1aa00e51038e749040cc2dea0
diff --git a/mesonbuild/mconf.py b/mesonbuild/mconf.py --- a/mesonbuild/mconf.py +++ b/mesonbuild/mconf.py @@ -181,7 +181,7 @@ def print_default_values_warning(): core_options = {k: o for k, o in self.coredata.builtins.items() if k in core_option_names} self.print_options('Core options', core_options) - if self.build.environment.is_cross_build(): + if self.default_values_only or self.build.environment.is_cross_build(): self.print_options('Core options (for host machine)', self.coredata.builtins_per_machine.host) self.print_options( 'Core options (for build machine)', @@ -190,7 +190,7 @@ def print_default_values_warning(): self.print_options('Core options', self.coredata.builtins_per_machine.host) self.print_options('Backend options', self.coredata.backend_options) self.print_options('Base options', self.coredata.base_options) - if self.build.environment.is_cross_build(): + if self.default_values_only or self.build.environment.is_cross_build(): self.print_options('Compiler options (for host machine)', self.coredata.compiler_options.host) self.print_options( 'Compiler options (for build machine)', diff --git a/run_unittests.py b/run_unittests.py --- a/run_unittests.py +++ b/run_unittests.py @@ -3624,6 +3624,10 @@ def test_introspect_buildoptions_without_configured_build(self): self.maxDiff = None self.assertListEqual(res_nb, res_wb) + def test_meson_configure_from_source_does_not_crash(self): + testdir = os.path.join(self.unit_test_dir, '59 introspect buildoptions') + self._run(self.mconf_command + [testdir]) + def test_introspect_json_dump(self): testdir = os.path.join(self.unit_test_dir, '57 introspection') self.init(testdir)
Running "meson configure" in source directory raises an exception (yet again) Yes, it's Taisei again. Ping @mensinda. If it helps, the taisei commit is https://github.com/taisei-project/taisei/commit/e68bfdb2ea86470fd138044af83af610de0b9d68 ``` [0] [akari@navi] [master ← /data/git/taisei] % c Unable to evaluate subdir([]) in AstInterpreter --> Skipping Unable to evaluate subdir([]) in AstInterpreter --> Skipping Unable to evaluate subdir([]) in AstInterpreter --> Skipping WARNING: The source directory instead of the build directory was specified. WARNING: Only the default values for the project are printed, and all command line parameters are ignored. Core properties: Source dir /data/git/taisei Core options: Option Default Value Possible Values Description ------ ------------- --------------- ----------- auto_features auto [enabled, disabled, auto] Override value of all 'auto' features backend ninja [ninja, vs, vs2010, vs2015, vs2017, vs2019, xcode] Backend to use buildtype release [plain, debug, debugoptimized, release, minsize, custom] Build type to use debug false [true, false] Debug default_library static [shared, static, both] Default library type install_umask 0022 [preserve, 0000-0777] Default umask to apply on permissions of installed files layout mirror [mirror, flat] Build directory layout optimization 3 [0, g, 1, 2, 3, s] Optimization level strip true [true, false] Strip targets on install unity off [on, off, subprojects] Unity build warning_level 1 [0, 1, 2, 3] Compiler warning level to use werror false [true, false] Treat warnings as errors wrap_mode default [default, nofallback, nodownload, forcefallback] Wrap mode Traceback (most recent call last): File "/data/git/meson/mesonbuild/mesonmain.py", line 129, in run return options.run_func(options) File "/data/git/meson/mesonbuild/mconf.py", line 216, in run c.print_conf() File "/data/git/meson/mesonbuild/mconf.py", line 184, in print_conf if self.build.environment.is_cross_build(): AttributeError: 'NoneType' object has no attribute 'environment' ```
On a second look this isn't taisei-specific at all. Seems to happen on all projects. Probably should add a test that just attempts this on a dummy project.
2019-09-13T10:35:14Z
[]
[]
Traceback (most recent call last): File "/data/git/meson/mesonbuild/mesonmain.py", line 129, in run return options.run_func(options) File "/data/git/meson/mesonbuild/mconf.py", line 216, in run c.print_conf() File "/data/git/meson/mesonbuild/mconf.py", line 184, in print_conf if self.build.environment.is_cross_build(): AttributeError: 'NoneType' object has no attribute 'environment'
9,333
mesonbuild/meson
mesonbuild__meson-5942
f96a8cbdf5ff3c8905d0d12442d0f9d378aeec13
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2388,6 +2388,8 @@ def run_command_impl(self, node, args, kwargs, in_builddir=False): msg = 'Program {!r} was overridden with the compiled executable {!r}'\ ' and therefore cannot be used during configuration' raise InterpreterException(msg.format(progname, cmd.description())) + if not cmd.found(): + raise InterpreterException('command {!r} not found or not executable'.format(cmd)) elif isinstance(cmd, CompilerHolder): cmd = cmd.compiler.get_exelist()[0] prog = ExternalProgram(cmd, silent=True) diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -1389,13 +1389,13 @@ def __exit__(self, *args): msvcrt.locking(self.lockfile.fileno(), msvcrt.LK_UNLCK, 1) self.lockfile.close() -def relpath(path, start): +def relpath(path: str, start: str) -> str: # On Windows a relative path can't be evaluated for paths on two different # drives (i.e. c:\foo and f:\bar). The only thing left to do is to use the # original absolute path. try: return os.path.relpath(path, start) - except ValueError: + except (TypeError, ValueError): return path
AttributeError: 'NoneType' object has no attribute 'startswith' I wanted to try out the GIMP’s [ongoing port to Meson](https://gitlab.gnome.org/GNOME/gimp/merge_requests/1). But both with Meson 0.50.1 and 0.51.1 (our Meson improvement patches disabled too), the configuration fails: ``` meson flags: --buildtype=plain --libdir=/nix/store/ryk7rpy98pjj8p5nnpdg5wl6xczgndr4-gimp-2.10.12/lib --libexecdir=/nix/store/ryk7rpy98pjj8p5nnpdg5wl6xczgndr4-gimp-2.10.12/libexec --bindir=/nix/store/ryk7rpy98pjj8p5nnpdg5wl6xczgndr4-gimp-2.10.12/bin --sbindir=/nix/store/ryk7rpy98pjj8p5nnpdg5wl6xczgndr4-gimp-2.10.12/sbin --includedir=/nix/store/ryk7rpy98pjj8p5nnpdg5wl6xczgndr4-gimp-2.10.12/include --mandir=/nix/store/ryk7rpy98pjj8p5nnpdg5wl6xczgndr4-gimp-2.10.12/share/man --infodir=/nix/store/ryk7rpy98pjj8p5nnpdg5wl6xczgndr4-gimp-2.10.12/share/info --localedir=/nix/store/ryk7rpy98pjj8p5nnpdg5wl6xczgndr4-gimp-2.10.12/share/locale -Dauto_features=enabled -Dwrap_mode=nodownload --prefix=/nix/store/ryk7rpy98pjj8p5nnpdg5wl6xczgndr4-gimp-2.10.12 -Dwebkit=disabled -Dalsa=disabled -Dbug-report-url=https://github.com/NixOS/nixpkgs/issues/new -Dicc-directory=/run/current-system/sw/share/color/icc --libdir=lib --libexecdir=libexec --bindir=bin --sbindir=sbin --includedir=include --mandir=share/man --infodir=share/info --localedir=share/locale The Meson build system Version: 0.51.1 Source dir: /build/source Build dir: /build/source/build Build type: native build DEPRECATION: Duplicated values in array option is deprecated. This will become a hard error in the future. Project name: gimp Project version: 2.99.1 C compiler for the build machine: /nix/store/hpzj855nkgjvg58nrhq4910sb9q3kss1-gcc-wrapper-7.4.0/bin/cc (gcc 7.4.0 "gcc (GCC) 7.4.0") C++ compiler for the build machine: /nix/store/hpzj855nkgjvg58nrhq4910sb9q3kss1-gcc-wrapper-7.4.0/bin/c++ (gcc 7.4.0 "g++ (GCC) 7.4.0") C compiler for the host machine: /nix/store/hpzj855nkgjvg58nrhq4910sb9q3kss1-gcc-wrapper-7.4.0/bin/cc (gcc 7.4.0 "gcc (GCC) 7.4.0") C++ compiler for the host machine: /nix/store/hpzj855nkgjvg58nrhq4910sb9q3kss1-gcc-wrapper-7.4.0/bin/c++ (gcc 7.4.0 "g++ (GCC) 7.4.0") Build machine cpu family: x86_64 Build machine cpu: x86_64 Message: Host os: linux Compiler for C supports arguments -fdiagnostics-show-option: YES Compiler for C supports arguments -fno-common: YES Compiler for C supports arguments -Wformat-security: YES Compiler for C supports arguments -Winit-self: YES Compiler for C supports arguments -Wlogical-op: YES Compiler for C supports arguments -Wmissing-declarations: YES Compiler for C supports arguments -Wmissing-format-attribute: YES Compiler for C supports arguments -Wpointer-arith: YES Compiler for C supports arguments -Wreturn-type: YES Compiler for C supports arguments -Wtype-limits: YES Compiler for C supports arguments -Wno-deprecated-declarations -Wdeprecated-declarations: YES Compiler for C supports arguments -Werror=implicit-function-declaration: YES Compiler for C supports arguments -Wdeclaration-after-statement: YES Compiler for C supports arguments -Wold-style-definition: YES Compiler for C supports arguments -Wno-strict-prototypes -Wstrict-prototypes: YES Library m found: YES Library dl found: YES Found pkg-config: /nix/store/vjznmqrvwiawqy7g2ip6jsycyls0zlfz-pkg-config-0.29.2/bin/pkg-config (0.29.2) Run-time dependency atk found: YES 2.32.0 Run-time dependency babl found: YES 0.1.72 Run-time dependency cairo found: YES 1.16.0 Run-time dependency dbus-glib-1 found: YES 0.110 Run-time dependency fontconfig found: YES 2.12.6 Run-time dependency freetype2 found: YES 23.1.17 Run-time dependency gdk-pixbuf-2.0 found: YES 2.38.1 Run-time dependency gegl-0.4 found: YES 0.4.17 Run-time dependency gexiv2 found: YES 0.12.0 Run-time dependency gio-2.0 found: YES 2.60.4 Run-time dependency gio-unix-2.0 found: YES 2.60.4 Run-time dependency glib-2.0 found: YES 2.60.4 Run-time dependency gobject-2.0 found: YES 2.60.4 Run-time dependency gmodule-no-export-2.0 found: YES 2.60.4 Run-time dependency gtk+-3.0 found: YES 3.24.10 Run-time dependency harfbuzz found: YES 2.5.3 Run-time dependency lcms2 found: YES 2.9 Run-time dependency libmypaint found: YES 1.3.0 Run-time dependency mypaint-brushes-1.0 found: YES 1.3.0 Run-time dependency pangocairo found: YES 1.43.0 Run-time dependency pangoft2 found: YES 1.43.0 Run-time dependency librsvg-2.0 found: YES 2.44.14 Library socket found: NO Run-time dependency appstream-glib found: YES 0.7.15 Run-time dependency libarchive found: YES 3.4.0 Has header "backtrace.h" : NO Did not find CMake 'cmake' Found CMake: NO Run-time dependency libunwind found: NO (tried pkgconfig and cmake) Run-time dependency x11 found: YES 1.6.7 Run-time dependency xmu found: YES 1.1.3 Run-time dependency xext found: YES 1.3.4 Run-time dependency xfixes found: YES 5.0.3 Has header "X11/Xmu/WinUtil.h" with dependencies xext, xmu: YES Has header "X11/extensions/shape.h" with dependencies xext, xmu: YES Checking for function "XmuClientWindow" with dependencies xext, xmu: YES Checking for function "XShapeGetRectangles" with dependencies xext, xmu: YES Has header "X11/extensions/shape.h" : YES Has header "X11/Xmu/WinUtil.h" : YES Run-time dependency libtiff-4 found: YES 4.0.10 Run-time dependency libjpeg found: YES 2.0.2 Run-time dependency zlib found: YES 1.2.11 Library bz2 found: YES Run-time dependency liblzma found: YES 5.2.4 Library gs found: YES Run-time dependency libpng found: YES 1.6.37 Library mng found: YES Library aa found: YES Run-time dependency xpm found: YES 3.5.12 Run-time dependency openexr found: YES 2.3.0 Run-time dependency libwebp found: YES 1.0.3 Run-time dependency libwebpmux found: YES 1.0.3 Run-time dependency libwebpdemux found: YES 1.0.3 Run-time dependency libheif found: YES 1.4.0 Dependency webkit2gtk-4.0 skipped: feature webkit disabled Run-time dependency poppler-glib found: YES 0.74.0 Run-time dependency poppler-data found: YES 0.4.9 Run-time dependency cairo-pdf found: YES 1.16.0 Run-time dependency libwmf found: YES 0.2.12 Run-time dependency libopenjp2 found: YES 2.3.1 Run-time dependency xcursor found: YES 1.2.0 Dependency alsa skipped: feature alsa disabled Has header "linux/input.h" : YES Run-time dependency gudev-1.0 found: YES 232 Program xdg-email found: NO meson.build:726: WARNING: Xdg-email not found, but required at runtime for email sending. Run-time dependency iso-codes found: YES 3.79 Program perl5 found: NO Program perl found: YES (/nix/store/syg9s1b9r8gd97g9616zqhj7qqw178s2-perl-5.28.2/bin/perl) Program python found: YES (/nix/store/xw27ki6hwv00jvvi86j1b3bqaj7k2yhw-python-2.7.16/bin/python) Traceback (most recent call last): File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 127, in run return options.run_func(options) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/msetup.py", line 240, in run app.generate() File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/msetup.py", line 158, in generate self._generate(env) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/msetup.py", line 187, in _generate intr.run() File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 3917, in run super().run() File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 407, in run self.evaluate_codeblock(self.ast, start=1) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 446, in evaluate_statement return self.evaluate_if(cur) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 514, in evaluate_if self.evaluate_codeblock(node.elseblock) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 438, in evaluate_statement return self.assignment(cur) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 1048, in assignment value = self.evaluate_statement(node.value) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 450, in evaluate_statement return self.evaluate_comparison(cur) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 529, in evaluate_comparison val1 = self.evaluate_statement(node.left) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 440, in evaluate_statement return self.method_call(cur) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 783, in method_call obj = self.evaluate_statement(invokable) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 773, in function_call return func(node, posargs, kwargs) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 2326, in func_run_command return self.run_command_impl(node, args, kwargs) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 2371, in run_command_impl if not cmd_path.startswith('..'): AttributeError: 'NoneType' object has no attribute 'startswith' ``` Building from this commit: https://gitlab.gnome.org/GNOME/gimp/commit/b364ce989ee63ad14d1b2f9c8a1981f5fa3496f7
Here is a minimal reproducible example (Python not in the environment): ```meson project('test-npe') pythonmod = import('python') python = pythonmod.find_installation('python2', required: false) run_command(python, '-v') ``` Obviously, this is not a correct Meson code but it should still show nice error, not propagate the billion-dollar mistake.
2019-09-19T18:50:22Z
[]
[]
Traceback (most recent call last): File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 127, in run return options.run_func(options) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/msetup.py", line 240, in run app.generate() File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/msetup.py", line 158, in generate self._generate(env) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/msetup.py", line 187, in _generate intr.run() File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 3917, in run super().run() File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 407, in run self.evaluate_codeblock(self.ast, start=1) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 446, in evaluate_statement return self.evaluate_if(cur) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 514, in evaluate_if self.evaluate_codeblock(node.elseblock) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 431, in evaluate_codeblock raise e File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 425, in evaluate_codeblock self.evaluate_statement(cur) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 438, in evaluate_statement return self.assignment(cur) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 1048, in assignment value = self.evaluate_statement(node.value) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 450, in evaluate_statement return self.evaluate_comparison(cur) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 529, in evaluate_comparison val1 = self.evaluate_statement(node.left) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 440, in evaluate_statement return self.method_call(cur) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 783, in method_call obj = self.evaluate_statement(invokable) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 436, in evaluate_statement return self.function_call(cur) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 773, in function_call return func(node, posargs, kwargs) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 2326, in func_run_command return self.run_command_impl(node, args, kwargs) File "/nix/store/8g2q8c5c4227l3sp65z7qfpvi38b6cak-meson-0.51.1/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 2371, in run_command_impl if not cmd_path.startswith('..'): AttributeError: 'NoneType' object has no attribute 'startswith'
9,334
mesonbuild/meson
mesonbuild__meson-5997
cce172432be30233e9876264c259342d2a2006ad
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py --- a/mesonbuild/modules/pkgconfig.py +++ b/mesonbuild/modules/pkgconfig.py @@ -231,7 +231,7 @@ def _get_lname(self, l, msg, pcfile): return l.name[3:] # If the library is imported via an import library which is always # named after the target name, '-lfoo' is correct. - if l.import_filename: + if isinstance(l, build.SharedLibrary) and l.import_filename: return l.name # In other cases, we can't guarantee that the compiler will be able to # find the library via '-lfoo', so tell the user that.
'StaticLibrary' object has no attribute 'import_filename' This came up while attempting to build the harfbuzz meson port with `--default-library=static` and msvc on win10. As far as I can tell this is a meson bug, since it's not offering an error in their config and appears to be a mistaken assumption in the pkgconfig module, so I've reported it here. The full error is below: ``` Traceback (most recent call last): File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\mesonmain.py", line 112, in run return options.run_func(options) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\msetup.py", line 230, in run app.generate() File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\msetup.py", line 161, in generate self._generate(env) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\msetup.py", line 190, in _generate intr.run() File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreter.py", line 3874, in run super().run() File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 408, in run self.evaluate_codeblock(self.ast, start=1) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 432, in evaluate_codeblock raise e File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 426, in evaluate_codeblock self.evaluate_statement(cur) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 437, in evaluate_statement return self.function_call(cur) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 763, in function_call return func(node, posargs, kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 292, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 181, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreter.py", line 3447, in func_subdir self.evaluate_codeblock(codeblock) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 432, in evaluate_codeblock raise e File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 426, in evaluate_codeblock self.evaluate_statement(cur) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 441, in evaluate_statement return self.method_call(cur) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 799, in method_call return obj.method_call(method_name, args, kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreter.py", line 1621, in method_call value = fn(state, args, kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 292, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 292, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 181, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\modules\pkgconfig.py", line 428, in generate version, pcfile, conflicts, variables) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\modules\pkgconfig.py", line 321, in generate_pkgconfig_file ofile.write('Libs: {}\n'.format(' '.join(generate_libs_flags(deps.pub_libs)))) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\modules\pkgconfig.py", line 312, in generate_libs_flags lname = self._get_lname(l, msg, pcfile) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\modules\pkgconfig.py", line 225, in _get_lname if l.import_filename: AttributeError: 'StaticLibrary' object has no attribute 'import_filename' ```
2019-10-05T20:11:49Z
[]
[]
Traceback (most recent call last): File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\mesonmain.py", line 112, in run return options.run_func(options) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\msetup.py", line 230, in run app.generate() File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\msetup.py", line 161, in generate self._generate(env) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\msetup.py", line 190, in _generate intr.run() File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreter.py", line 3874, in run super().run() File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 408, in run self.evaluate_codeblock(self.ast, start=1) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 432, in evaluate_codeblock raise e File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 426, in evaluate_codeblock self.evaluate_statement(cur) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 437, in evaluate_statement return self.function_call(cur) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 763, in function_call return func(node, posargs, kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 292, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 181, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreter.py", line 3447, in func_subdir self.evaluate_codeblock(codeblock) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 432, in evaluate_codeblock raise e File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 426, in evaluate_codeblock self.evaluate_statement(cur) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 441, in evaluate_statement return self.method_call(cur) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 799, in method_call return obj.method_call(method_name, args, kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreter.py", line 1621, in method_call value = fn(state, args, kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 292, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 292, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\interpreterbase.py", line 181, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\modules\pkgconfig.py", line 428, in generate version, pcfile, conflicts, variables) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\modules\pkgconfig.py", line 321, in generate_pkgconfig_file ofile.write('Libs: {}\n'.format(' '.join(generate_libs_flags(deps.pub_libs)))) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\modules\pkgconfig.py", line 312, in generate_libs_flags lname = self._get_lname(l, msg, pcfile) File "c:\users\ryan\appdata\local\programs\python\python37\lib\site-packages\mesonbuild\modules\pkgconfig.py", line 225, in _get_lname if l.import_filename: AttributeError: 'StaticLibrary' object has no attribute 'import_filename'
9,343
mesonbuild/meson
mesonbuild__meson-6106
2b6c997e33e0864fd9bd462e913323b6711f644a
diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py --- a/mesonbuild/compilers/mixins/visualstudio.py +++ b/mesonbuild/compilers/mixins/visualstudio.py @@ -217,7 +217,9 @@ def unix_args_to_native(cls, args: typing.List[str]) -> typing.List[str]: # -pthread is only valid for GCC if i in ('-mms-bitfields', '-pthread'): continue - if i.startswith('-L'): + if i.startswith('-LIBPATH:'): + i = '/LIBPATH:' + i[9:] + elif i.startswith('-L'): i = '/LIBPATH:' + i[2:] # Translate GNU-style -lfoo library name to the import library elif i.startswith('-l'): @@ -250,7 +252,7 @@ def unix_args_to_native(cls, args: typing.List[str]) -> typing.List[str]: def native_args_to_unix(cls, args: typing.List[str]) -> typing.List[str]: result = [] for arg in args: - if arg.startswith('/LIBPATH:'): + if arg.startswith(('/LIBPATH:', '-LIBPATH:')): result.append('-L' + arg[9:]) elif arg.endswith(('.a', '.lib')) and not os.path.isabs(arg): result.append('-l' + arg) diff --git a/run_unittests.py b/run_unittests.py --- a/run_unittests.py +++ b/run_unittests.py @@ -3162,7 +3162,7 @@ def test_guessed_linker_dependencies(self): env = get_fake_env(testdirlib, self.builddir, self.prefix) if env.detect_c_compiler(MachineChoice.HOST).get_id() in {'msvc', 'clang-cl', 'intel-cl'}: # msvc-like compiler, also test it with msvc-specific flags - libdir_flags += ['/LIBPATH:'] + libdir_flags += ['/LIBPATH:', '-LIBPATH:'] else: # static libraries are not linkable with -l with msvc because meson installs them # as .a files which unix_args_to_native will not know as it expects libraries to use @@ -3176,6 +3176,7 @@ def test_guessed_linker_dependencies(self): for libdir_flag in libdir_flags: # build library + self.new_builddir() self.init(testdirlib, extra_args=extra_args) self.build() self.install()
meson does not support -libpath: in LDFLAGS environment variable meson seems to modify `LDFLAGS` environment varibable if it contains some `-LIBPATH:whatever`, and it makes the build fail: ``` Appending LDFLAGS from environment: ['-LIBPATH:C:\\Users\\appveyor\\.conan\\data\\libffi\\3.2.1\\_\\_\\package\\f27dcd2d5e453cb01f9324a959461903ce8116a0\\lib', '-LIBPATH:C:\\Users\\appveyor\\.conan\\data\\pcre\\8.41\\_\\_\\package\\799aa7257b99a1d9c85e265ab0b7ddc6342e7064\\lib', '-LIBPATH:C:\\Users\\appveyor\\.conan\\data\\libelf\\0.8.13\\_\\_\\package\\f27dcd2d5e453cb01f9324a959461903ce8116a0\\lib', '-LIBPATH:C:\\Users\\appveyor\\.conan\\data\\gettext\\0.20.1\\bincrafters\\stable\\package\\2b9b20f61d3ea15628d5e59640e45d270d4e1baa\\lib', '-LIBPATH:C:\\Users\\appveyor\\.conan\\data\\bzip2\\1.0.8\\_\\_\\package\\b553e9981f9078ff331b4fd4c3b7f9c44a5514ff\\lib', '-LIBPATH:C:\\Users\\appveyor\\.conan\\data\\libxml2\\2.9.9\\bincrafters\\stable\\package\\164a9ccb60ddea0ae0d23eacd120c5b18d4082e1\\lib', '-LIBPATH:C:\\Users\\appveyor\\.conan\\data\\zlib\\1.2.11\\_\\_\\package\\f27dcd2d5e453cb01f9324a959461903ce8116a0\\lib', '-LIBPATH:C:\\.conan\\c517c1\\1\\lib'] (...) Traceback (most recent call last): File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\mesonmain.py", line 129, in run return options.run_func(options) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\msetup.py", line 245, in run app.generate() File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\msetup.py", line 159, in generate self._generate(env) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\msetup.py", line 215, in _generate intr.backend.generate(intr) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 314, in generate self.generate_target(t) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 632, in generate_target elem = self.generate_link(target, outname, obj_list, linker, pch_objects, stdlib_args=stdlib_args) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 2534, in generate_link dep_targets.extend(self.guess_external_link_dependencies(linker, target, commands, internal)) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 2428, in guess_external_link_dependencies search_dirs, static_patterns) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 2369, in guess_library_absolute_path trial = CCompiler._get_file_from_list(self.environment, trial) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\compilers\mixins\clike.py", line 916, in _get_file_from_list if f.is_file(): File "C:\Python37\lib\pathlib.py", line 1372, in is_file return S_ISREG(self.stat().st_mode) File "C:\Python37\lib\pathlib.py", line 1168, in stat return self._accessor.stat(self) OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\.conan\\01ae82\\1\\build_subfolder\\IBPATH:C:\\Users\\appveyor\\.conan\\data\\libffi\\3.2.1\\_\\_\\package\\f27dcd2d5e453cb01f9324a959461903ce8116a0\\lib\\libglib\\libglib-2.0.a.a' ``` (more detail https://ci.appveyor.com/project/bincrafters/conan-glib/builds/28354777/job/nexbj5fnd0vx3yq9#L906) this issue is very similar to https://github.com/mesonbuild/meson/issues/5811 (with solution proposed in https://github.com/mesonbuild/meson/pull/5812), but it does not involve pkg-config
I'm sitting on a trivial patch that fixes this that I originally considered including in #5727, but decided to wait until we have a confirmed valid use case. Could you elaborate on why you are using the `-LIBPATH:` spelling instead of `/LIBPATH:`? it's how conan package manager generates compiler flags (https://github.com/conan-io/conan/blob/8a6df42e34f3e8b4b3c4e8d2e115ab87ab272072/conans/client/build/compiler_flags.py#L194) The reason is at the top of the file: ``` # Visual Studio cl options reference: # https://msdn.microsoft.com/en-us/library/610ecb4h.aspx # "Options are specified by either a forward slash (/) or a dash (–)." # Here we use "-" better than "/" that produces invalid escaped chars using AutoTools. # -LIBPATH, -D, -I, -ZI and so on. ``` Ha, I didn't realize MSVC actually allows both. I'll submit a PR with a fix later today. Thanks for clarifying!
2019-10-25T19:43:51Z
[]
[]
Traceback (most recent call last): File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\mesonmain.py", line 129, in run return options.run_func(options) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\msetup.py", line 245, in run app.generate() File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\msetup.py", line 159, in generate self._generate(env) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\msetup.py", line 215, in _generate intr.backend.generate(intr) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 314, in generate self.generate_target(t) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 632, in generate_target elem = self.generate_link(target, outname, obj_list, linker, pch_objects, stdlib_args=stdlib_args) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 2534, in generate_link dep_targets.extend(self.guess_external_link_dependencies(linker, target, commands, internal)) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 2428, in guess_external_link_dependencies search_dirs, static_patterns) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\backend\ninjabackend.py", line 2369, in guess_library_absolute_path trial = CCompiler._get_file_from_list(self.environment, trial) File "C:\Users\appveyor\.conan\data\meson\0.52.0\_\_\package\5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9\bin\mesonbuild\compilers\mixins\clike.py", line 916, in _get_file_from_list if f.is_file(): File "C:\Python37\lib\pathlib.py", line 1372, in is_file return S_ISREG(self.stat().st_mode) File "C:\Python37\lib\pathlib.py", line 1168, in stat return self._accessor.stat(self) OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\.conan\\01ae82\\1\\build_subfolder\\IBPATH:C:\\Users\\appveyor\\.conan\\data\\libffi\\3.2.1\\_\\_\\package\\f27dcd2d5e453cb01f9324a959461903ce8116a0\\lib\\libglib\\libglib-2.0.a.a'
9,354
mesonbuild/meson
mesonbuild__meson-6398
e9158b477f1cb1ed24d7b87e7efca1c2a293761f
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -466,7 +466,7 @@ def sanitize_prefix(self, prefix): prefix = prefix[:-1] return prefix - def sanitize_dir_option_value(self, prefix, option, value): + def sanitize_dir_option_value(self, prefix: str, option: str, value: Any) -> Any: ''' If the option is an installation directory option and the value is an absolute path, check that it resides within prefix and return the value @@ -474,22 +474,31 @@ def sanitize_dir_option_value(self, prefix, option, value): This way everyone can do f.ex, get_option('libdir') and be sure to get the library directory relative to prefix. + + .as_posix() keeps the posix-like file seperators Meson uses. ''' - if option.endswith('dir') and os.path.isabs(value) and \ + try: + value = PurePath(value) + except TypeError: + return value + if option.endswith('dir') and value.is_absolute() and \ option not in builtin_dir_noprefix_options: # Value must be a subdir of the prefix # commonpath will always return a path in the native format, so we # must use pathlib.PurePath to do the same conversion before # comparing. - if os.path.commonpath([value, prefix]) != str(PurePath(prefix)): - m = 'The value of the {!r} option is {!r} which must be a ' \ - 'subdir of the prefix {!r}.\nNote that if you pass a ' \ - 'relative path, it is assumed to be a subdir of prefix.' - raise MesonException(m.format(option, value, prefix)) - # Convert path to be relative to prefix - skip = len(prefix) + 1 - value = value[skip:] - return value + msg = ('The value of the {!r} option is {!r} which must be a ' + 'subdir of the prefix {!r}.\nNote that if you pass a ' + 'relative path, it is assumed to be a subdir of prefix.') + # os.path.commonpath doesn't understand case-insensitive filesystems, + # but PurePath().relative_to() does. + try: + value = value.relative_to(prefix) + except ValueError: + raise MesonException(msg.format(option, value, prefix)) + if '..' in str(value): + raise MesonException(msg.format(option, value, prefix)) + return value.as_posix() def init_builtins(self): # Create builtin options with default values diff --git a/run_unittests.py b/run_unittests.py --- a/run_unittests.py +++ b/run_unittests.py @@ -1750,7 +1750,8 @@ def test_absolute_prefix_libdir(self): https://github.com/mesonbuild/meson/issues/1345 ''' testdir = os.path.join(self.common_test_dir, '90 default options') - prefix = '/someabs' + # on Windows, /someabs is *not* an absolute path + prefix = 'x:/someabs' if is_windows() else '/someabs' libdir = 'libdir' extra_args = ['--prefix=' + prefix, # This can just be a relative path, but we want to test @@ -1771,16 +1772,25 @@ def test_libdir_must_be_inside_prefix(self): ''' testdir = os.path.join(self.common_test_dir, '1 trivial') # libdir being inside prefix is ok - args = ['--prefix', '/opt', '--libdir', '/opt/lib32'] + if is_windows(): + args = ['--prefix', 'x:/opt', '--libdir', 'x:/opt/lib32'] + else: + args = ['--prefix', '/opt', '--libdir', '/opt/lib32'] self.init(testdir, extra_args=args) self.wipe() # libdir not being inside prefix is not ok - args = ['--prefix', '/usr', '--libdir', '/opt/lib32'] + if is_windows(): + args = ['--prefix', 'x:/usr', '--libdir', 'x:/opt/lib32'] + else: + args = ['--prefix', '/usr', '--libdir', '/opt/lib32'] self.assertRaises(subprocess.CalledProcessError, self.init, testdir, extra_args=args) self.wipe() # libdir must be inside prefix even when set via mesonconf self.init(testdir) - self.assertRaises(subprocess.CalledProcessError, self.setconf, '-Dlibdir=/opt', False) + if is_windows(): + self.assertRaises(subprocess.CalledProcessError, self.setconf, '-Dlibdir=x:/opt', False) + else: + self.assertRaises(subprocess.CalledProcessError, self.setconf, '-Dlibdir=/opt', False) def test_prefix_dependent_defaults(self): ''' @@ -7155,14 +7165,11 @@ def main(): import pytest # noqa: F401 # Need pytest-xdist for `-n` arg import xdist # noqa: F401 - if sys.version_info.major <= 3 and sys.version_info.minor <= 5: - raise ImportError('pytest with python <= 3.5 is causing issues on the CI') pytest_args = ['-n', 'auto', './run_unittests.py'] pytest_args += convert_args(sys.argv[1:]) return subprocess.run(python_command + ['-m', 'pytest'] + pytest_args).returncode except ImportError: print('pytest-xdist not found, using unittest instead') - pass # All attempts at locating pytest failed, fall back to plain unittest. cases = ['InternalTests', 'DataTests', 'AllPlatformTests', 'FailureTests', 'PythonTests', 'NativeFileTests', 'RewriterTests', 'CrossFileTests',
`meson setup` fails on Windows with an absolute path for libdir on E:\ drive and is case sensitive for Windows drive **Describe the bug** I'm learning to use Meson following the tutorial (which for Windows requires quite a lot of additional research to get things to work - something to address another time) I have python and Meson on the C:\ drive, source and libraries on E:\. (E:\ is currently a USB drive if that's relevant.) When trying to add a dependency to a library, I tried to set the libdir to the library location on E:\ with `meson setup build --libdir=E:/Documents/Coding/C/lib` (after an `rm -rf build`) and got a python stack trace in response: ``` $ meson setup build --libdir=E:/Documents/Coding/C/lib The Meson build system Version: 0.52.1 Source dir: E:\Documents\Coding\C\meson_test Build dir: E:\Documents\Coding\C\meson_test\build Build type: native build Traceback (most recent call last): File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\mesonmain.py", line 129, in run return options.run_func(options) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\msetup.py", line 245, in run app.generate() File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\msetup.py", line 159, in generate self._generate(env) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\msetup.py", line 176, in _generate intr = interpreter.Interpreter(b) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreter.py", line 2110, in __init__ self.parse_project() File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 397, in parse_project self.evaluate_codeblock(self.ast, end=1) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 436, in evaluate_codeblock raise e File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 430, in evaluate_codeblock self.evaluate_statement(cur) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 441, in evaluate_statement return self.function_call(cur) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 776, in function_call return func(node, posargs, kwargs) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 143, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreter.py", line 2723, in func_project self.coredata.set_default_options(default_options, self.subproject, self.environment) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\coredata.py", line 742, in set_default_options self.set_options(options, subproject=subproject) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\coredata.py", line 674, in set_options if self._try_set_builtin_option(k, v): File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\coredata.py", line 531, in _try_set_builtin_option value = self.sanitize_dir_option_value(prefix, optname, value) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\coredata.py", line 479, in sanitize_dir_option_value if os.path.commonpath([value, prefix]) != str(PurePath(prefix)): File "c:\users\liz\appdata\local\programs\python\python38\lib\ntpath.py", line 763, in commonpath raise ValueError("Paths don't have the same drive") ValueError: Paths don't have the same drive ``` This is possibly related to #3239 If I try the same instruction but with the libraries copied to the C:\ drive, I get the following response: ``` $ meson setup build --libdir=C:/Documents/Coding/C/lib The Meson build system Version: 0.52.1 Source dir: E:\Documents\Coding\C\meson_test Build dir: E:\Documents\Coding\C\meson_test\build Build type: native build meson.build:1:0: ERROR: The value of the 'libdir' option is 'C:/Documents/Coding/C/lib' which must be a subdir of the prefix 'c:/'. Note that if you pass a relative path, it is assumed to be a subdir of prefix. A full log can be found at E:\Documents\Coding\C\meson_test\build\meson-logs\meson-log.txt ``` If I do the same again but with `$ meson setup build --libdir=c:/Documents/Coding/C/lib` (note the lowercase `c`) I get the same response as for `$ meson setup build` (i.e. it seems to work). (I'm aware that I should be setting the prefix argument to the "installation directory" but I'm not yet sure what that is) **Files To Reproduce** I don't think the contents of the files matters. These are as barebones as it gets. [main.c](https://github.com/mesonbuild/meson/files/4010104/main.c.txt) [meson.build](https://github.com/mesonbuild/meson/files/4010136/meson.build.txt) **Expected behavior** I would expect Meson to show me an error message and a way to fix things (rather than a stack trace). I would also expect Windows paths to be case insensitive or to be warned that they are case sensitive. **System Parameters** * Native build * Windows 10 * Python 3.8.1 * `meson --version` => `0.52.1` * `ninja --version` => `1.9.0.git.kitware.dyndep-1.jobserver-1` **Notes** Thanks for all your work on Meson, it looks it will be a useful tool once I've figured it out. If I can provide any more information, do let me know.
2019-12-31T04:14:27Z
[]
[]
Traceback (most recent call last): File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\mesonmain.py", line 129, in run return options.run_func(options) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\msetup.py", line 245, in run app.generate() File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\msetup.py", line 159, in generate self._generate(env) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\msetup.py", line 176, in _generate intr = interpreter.Interpreter(b) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreter.py", line 2110, in __init__ self.parse_project() File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 397, in parse_project self.evaluate_codeblock(self.ast, end=1) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 436, in evaluate_codeblock raise e File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 430, in evaluate_codeblock self.evaluate_statement(cur) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 441, in evaluate_statement return self.function_call(cur) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 776, in function_call return func(node, posargs, kwargs) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 143, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\interpreter.py", line 2723, in func_project self.coredata.set_default_options(default_options, self.subproject, self.environment) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\coredata.py", line 742, in set_default_options self.set_options(options, subproject=subproject) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\coredata.py", line 674, in set_options if self._try_set_builtin_option(k, v): File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\coredata.py", line 531, in _try_set_builtin_option value = self.sanitize_dir_option_value(prefix, optname, value) File "C:\Users\<user>\AppData\Roaming\Python\Python38\site-packages\mesonbuild\coredata.py", line 479, in sanitize_dir_option_value if os.path.commonpath([value, prefix]) != str(PurePath(prefix)): File "c:\users\liz\appdata\local\programs\python\python38\lib\ntpath.py", line 763, in commonpath raise ValueError("Paths don't have the same drive") ValueError: Paths don't have the same drive
9,375
mesonbuild/meson
mesonbuild__meson-6466
cfc2b92e92e8dfce22592b8101e0b399d00cb91d
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -946,6 +946,7 @@ def sanitize(p): if 'Emscripten' in out: cls = EmscriptenCCompiler if lang == 'c' else EmscriptenCPPCompiler + self.coredata.add_lang_args(cls.language, cls, for_machine, self) return cls( ccache + compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version) @@ -966,6 +967,7 @@ def sanitize(p): full_version = arm_ver_str cls = ArmclangCCompiler if lang == 'c' else ArmclangCPPCompiler linker = ArmClangDynamicLinker(for_machine, version=version) + self.coredata.add_lang_args(cls.language, cls, for_machine, self) return cls( ccache + compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=linker) @@ -1061,12 +1063,14 @@ def sanitize(p): exe_wrap, full_version=full_version, linker=l) if 'ARM' in out: cls = ArmCCompiler if lang == 'c' else ArmCPPCompiler + self.coredata.add_lang_args(cls.language, cls, for_machine, self) linker = ArmDynamicLinker(for_machine, version=version) return cls( ccache + compiler, version, for_machine, is_cross, info, exe_wrap, full_version=full_version, linker=linker) if 'RX Family' in out: cls = CcrxCCompiler if lang == 'c' else CcrxCPPCompiler + self.coredata.add_lang_args(cls.language, cls, for_machine, self) linker = CcrxDynamicLinker(for_machine, version=version) return cls( ccache + compiler, version, for_machine, is_cross, info, @@ -1405,6 +1409,7 @@ def detect_rust_compiler(self, for_machine): always_args=always_args, version=cc.linker.version, **extra_args) + self.coredata.add_lang_args(RustCompiler.language, RustCompiler, for_machine, self) return RustCompiler( compiler, version, for_machine, is_cross, info, exe_wrap, linker=linker)
KeyError: 'c_args' **Describe the bug** Simple Emscripten example can't build due to `KeyError: 'c_args'` **To Reproduce** ``` project('mint2d', 'c', default_options: ['c_std=c99']) executable( 'mint2d', [ 'main.c' ] ) ``` ```toml [host_machine] system = 'linux' cpu_family = 'x86' cpu = 'wasm32' endian = 'little' [binaries] c = 'emcc' ar = 'emar' ``` **Expected behavior** To not crash **Crashlog** ``` The Meson build system Version: 0.53.999 Source dir: /home/matanui159/vscode/mint2d-meson Build dir: /home/matanui159/vscode/mint2d-meson/bin Build type: cross build Project name: mint2d Project version: undefined C compiler for the build machine: cc (gcc 9.2.0 "cc (GCC) 9.2.0") C linker for the build machine: cc GNU ld.bfd 2.33.1 Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/mesonbuild/mesonmain.py", line 129, in run return options.run_func(options) File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 245, in run app.generate() File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 159, in generate self._generate(env) File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 176, in _generate intr = interpreter.Interpreter(b) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreter.py", line 2165, in __init__ self.parse_project() File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 397, in parse_project self.evaluate_codeblock(self.ast, end=1) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 436, in evaluate_codeblock raise e File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 430, in evaluate_codeblock self.evaluate_statement(cur) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 441, in evaluate_statement return self.function_call(cur) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 788, in function_call return func(node, posargs, kwargs) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 143, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreter.py", line 2846, in func_project self.add_languages(proj_langs, True) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreter.py", line 2949, in add_languages success &= self.add_languages_for(args, required, MachineChoice.HOST) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreter.py", line 2967, in add_languages_for comp.sanity_check(self.environment.get_scratch_dir(), self.environment) File "/usr/lib/python3.8/site-packages/mesonbuild/compilers/c.py", line 64, in sanity_check return self.sanity_check_impl(work_dir, environment, 'sanitycheckc.c', code) File "/usr/lib/python3.8/site-packages/mesonbuild/compilers/mixins/clike.py", line 220, in sanity_check_impl cargs, largs = self._get_basic_compiler_args(environment, mode) File "/usr/lib/python3.8/site-packages/mesonbuild/compilers/mixins/clike.py", line 304, in _get_basic_compiler_args sys_args = env.coredata.get_external_args(self.for_machine, self.language) File "/usr/lib/python3.8/site-packages/mesonbuild/coredata.py", line 626, in get_external_args return self.compiler_options[for_machine][lang + '_args'].value KeyError: 'c_args' ``` **system parameters** * Cross build with the above cross file * Manjaro 4.19.88 * Python 3.8.0 * Meson 0.53.999 from git
2020-01-14T21:46:10Z
[]
[]
Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/mesonbuild/mesonmain.py", line 129, in run return options.run_func(options) File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 245, in run app.generate() File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 159, in generate self._generate(env) File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 176, in _generate intr = interpreter.Interpreter(b) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreter.py", line 2165, in __init__ self.parse_project() File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 397, in parse_project self.evaluate_codeblock(self.ast, end=1) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 436, in evaluate_codeblock raise e File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 430, in evaluate_codeblock self.evaluate_statement(cur) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 441, in evaluate_statement return self.function_call(cur) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 788, in function_call return func(node, posargs, kwargs) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 143, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreter.py", line 2846, in func_project self.add_languages(proj_langs, True) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreter.py", line 2949, in add_languages success &= self.add_languages_for(args, required, MachineChoice.HOST) File "/usr/lib/python3.8/site-packages/mesonbuild/interpreter.py", line 2967, in add_languages_for comp.sanity_check(self.environment.get_scratch_dir(), self.environment) File "/usr/lib/python3.8/site-packages/mesonbuild/compilers/c.py", line 64, in sanity_check return self.sanity_check_impl(work_dir, environment, 'sanitycheckc.c', code) File "/usr/lib/python3.8/site-packages/mesonbuild/compilers/mixins/clike.py", line 220, in sanity_check_impl cargs, largs = self._get_basic_compiler_args(environment, mode) File "/usr/lib/python3.8/site-packages/mesonbuild/compilers/mixins/clike.py", line 304, in _get_basic_compiler_args sys_args = env.coredata.get_external_args(self.for_machine, self.language) File "/usr/lib/python3.8/site-packages/mesonbuild/coredata.py", line 626, in get_external_args return self.compiler_options[for_machine][lang + '_args'].value KeyError: 'c_args'
9,384
mesonbuild/meson
mesonbuild__meson-6688
63d67e20425b2da6668231fead3f86e16e163943
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -27,7 +27,7 @@ from .mixins.clang import ClangCompiler from .mixins.elbrus import ElbrusCompiler from .mixins.pgi import PGICompiler -from .mixins.islinker import BasicLinkerIsCompilerMixin, LinkerEnvVarsMixin +from .mixins.islinker import LinkerEnvVarsMixin from .mixins.emscripten import EmscriptenMixin from .compilers import ( gnu_winlibs, @@ -133,7 +133,7 @@ class AppleClangCCompiler(ClangCCompiler): _C18_VERSION = '>=11.0.0' -class EmscriptenCCompiler(LinkerEnvVarsMixin, EmscriptenMixin, BasicLinkerIsCompilerMixin, ClangCCompiler): +class EmscriptenCCompiler(EmscriptenMixin, LinkerEnvVarsMixin, ClangCCompiler): def __init__(self, exelist, version, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper=None, **kwargs): if not is_cross: diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -36,7 +36,7 @@ from .mixins.clang import ClangCompiler from .mixins.elbrus import ElbrusCompiler from .mixins.pgi import PGICompiler -from .mixins.islinker import BasicLinkerIsCompilerMixin, LinkerEnvVarsMixin +from .mixins.islinker import LinkerEnvVarsMixin from .mixins.emscripten import EmscriptenMixin if T.TYPE_CHECKING: @@ -201,7 +201,7 @@ class AppleClangCPPCompiler(ClangCPPCompiler): pass -class EmscriptenCPPCompiler(LinkerEnvVarsMixin, EmscriptenMixin, BasicLinkerIsCompilerMixin, ClangCPPCompiler): +class EmscriptenCPPCompiler(EmscriptenMixin, LinkerEnvVarsMixin, ClangCPPCompiler): def __init__(self, exelist, version, for_machine: MachineChoice, is_cross: bool, info: 'MachineInfo', exe_wrapper=None, **kwargs): if not is_cross: diff --git a/mesonbuild/compilers/mixins/emscripten.py b/mesonbuild/compilers/mixins/emscripten.py --- a/mesonbuild/compilers/mixins/emscripten.py +++ b/mesonbuild/compilers/mixins/emscripten.py @@ -17,20 +17,13 @@ import os.path import typing as T -from ...mesonlib import MesonException +from ... import coredata -class EmscriptenMixin: - def get_option_link_args(self, options): - return [] - - def get_soname_args(self, *args, **kwargs): - raise MesonException('Emscripten does not support shared libraries.') +if T.TYPE_CHECKING: + from ..environment import Environment - def get_allow_undefined_link_args(self) -> T.List[str]: - return ['-s', 'ERROR_ON_UNDEFINED_SYMBOLS=0'] - def get_linker_output_args(self, output: str) -> T.List[str]: - return ['-o', output] +class EmscriptenMixin: def _get_compile_output(self, dirname, mode): # In pre-processor mode, the output is sent to stdout and discarded @@ -44,3 +37,17 @@ def _get_compile_output(self, dirname, mode): else: suffix = 'wasm' return os.path.join(dirname, 'output.' + suffix) + + def thread_flags(self, env: 'Environment') -> T.List[str]: + return ['-s', 'USE_PTHREADS=1'] + + def get_options(self): + opts = super().get_options() + opts.update({ + '{}_thread_count'.format(self.language): coredata.UserIntegerOption( + 'Number of threads to use in web assembly, set to 0 to disable', + (0, None, 4), # Default was picked at random + ), + }) + + return opts diff --git a/mesonbuild/compilers/mixins/islinker.py b/mesonbuild/compilers/mixins/islinker.py --- a/mesonbuild/compilers/mixins/islinker.py +++ b/mesonbuild/compilers/mixins/islinker.py @@ -130,3 +130,12 @@ def get_asneeded_args(self) -> T.List[str]: def get_buildtype_linker_args(self, buildtype: str) -> T.List[str]: return [] + + def get_link_debugfile_name(self, target: str) -> str: + return '' + + def thread_flags(self, env: 'Environment') -> T.List[str]: + return [] + + def thread_link_flags(self, env: 'Environment') -> T.List[str]: + return [] diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -58,6 +58,7 @@ XilinkDynamicLinker, CudaLinker, VisualStudioLikeLinkerMixin, + WASMDynamicLinker, ) from functools import lru_cache from .compilers import ( @@ -957,9 +958,18 @@ def sanitize(p): if 'Emscripten' in out: cls = EmscriptenCCompiler if lang == 'c' else EmscriptenCPPCompiler self.coredata.add_lang_args(cls.language, cls, for_machine, self) + # emcc cannot be queried to get the version out of it (it + # ignores -Wl,--version and doesn't have an alternative). + # Further, wasm-id *is* lld and will return `LLD X.Y.Z` if you + # call `wasm-ld --version`, but a special version of lld that + # takes different options. + p, o, _ = Popen_safe(['wasm-ld', '--version']) + linker = WASMDynamicLinker( + compiler, for_machine, cls.LINKER_PREFIX, + [], version=search_version(o)) return cls( ccache + compiler, version, for_machine, is_cross, info, - exe_wrap, full_version=full_version) + exe_wrap, linker=linker, full_version=full_version) if 'armclang' in out: # The compiler version is not present in the first line of output, diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py --- a/mesonbuild/linkers.py +++ b/mesonbuild/linkers.py @@ -693,6 +693,35 @@ def get_allow_undefined_args(self) -> T.List[str]: return [] +class WASMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, DynamicLinker): + + """Emscripten's wasm-ld.""" + + def __init__(self, *args, **kwargs): + super().__init__('ld.wasm', *args, **kwargs) + + def thread_link_flags(self, env: 'Environment') -> T.List[str]: + args = ['-s', 'USE_PTHREADS=1'] + count = env.coredata.compiler_options[self.for_machine]['{}_thread_count'.format(self.language)].value # type: int + if count: + args.extend(['-s', 'PTHREAD_POOL_SIZE={}'.format(count)]) + return args + + def get_allow_undefined_args(self) -> T.List[str]: + return ['-s', 'ERROR_ON_UNDEFINED_SYMBOLS=0'] + + def no_undefined_args(self) -> T.List[str]: + return ['-s', 'ERROR_ON_UNDEFINED_SYMBOLS=1'] + + def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str, + suffix: str, soversion: str, darwin_versions: T.Tuple[str, str], + is_shared_module: bool) -> T.List[str]: + raise mesonlib.MesonException('{} does not support shared libraries.'.format(self.id)) + + def get_asneeded_args(self) -> T.List[str]: + return [] + + class CcrxDynamicLinker(DynamicLinker): """Linker for Renesis CCrx compiler."""
AttributeError: 'NoneType' object has no attribute 'thread_flags' when cross-compiling with v 0.53.1 Setup: -meson 0.53.1 with python 3.7 -debian 10 -emscripten 1.39.8 I'm trying to cross-compile a C library, dav1d. Here's the build script: ` CFLAGS=-pthread \ LDFLAGS=-pthread \ meson ../../../dav1d \ --cross-file=../../../build-dav1d-cross-compile.txt \ -Dbitdepths='["8"]' \ -Denable_asm=true \ -Denable_tools=false \ -Denable_examples=false \ -Denable_tests=false \ -Dlogging=false \ -Ddefault_library=static \ --buildtype release ` Here's the cross-compilation file: ` [binaries] c = 'emcc' ar = 'emar' install_name_tool = 'echo' exe_wrapper = 'echo' [properties] c_args = ['-s', 'WASM=1', '-s', 'SIMD=1', '-s', 'WASM_OBJECT_FILES=0', '-s', 'USE_PTHREADS=1'] c_link_args = ['-s', 'WASM=1', '-s', 'SIMD=1', '-s', 'WASM_OBJECT_FILES=0', '-s', 'USE_PTHREADS=1'] needs_exe_wrapper = true [host_machine] system = 'linux' cpu_family = 'wasm32' cpu = 'wasm32' endian = 'little' ` Here's the output: ` The Meson build system Version: 0.53.1 Source dir: /home/daemoohn/work/mercury/dav1d Build dir: /home/daemoohn/work/mercury/build/temp/dav1d Build type: cross build Project name: dav1d Project version: 0.5.2 Appending CFLAGS from environment: '-pthread' Appending LDFLAGS from environment: ['-pthread'] C compiler for the build machine: cc (gcc 8.3.0 "cc (Debian 8.3.0-6) 8.3.0") C linker for the build machine: cc GNU ld.bfd 2.31.1 /home/daemoohn/work/mercury/build/temp/dav1d/meson-private/sanitycheckc_cross.exe C compiler for the host machine: emcc (emscripten 1.39.8 "emcc (Emscripten gcc/clang-like replacement) 1.39.8 (commit 1458145cf4f3db0fb548343e6acab267eef8e4ef)") Build machine cpu family: x86_64 Build machine cpu: x86_64 Host machine cpu family: wasm32 Host machine cpu: wasm32 Target machine cpu family: wasm32 Target machine cpu: wasm32 Traceback (most recent call last): File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 129, in run return options.run_func(options) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/msetup.py", line 245, in run app.generate() File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/msetup.py", line 159, in generate self._generate(env) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/msetup.py", line 192, in _generate intr.run() File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 4165, in run super().run() File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 412, in run self.evaluate_codeblock(self.ast, start=1) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 436, in evaluate_codeblock raise e File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 430, in evaluate_codeblock self.evaluate_statement(cur) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 451, in evaluate_statement return self.evaluate_if(cur) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 533, in evaluate_if self.evaluate_codeblock(node.elseblock) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 436, in evaluate_codeblock raise e File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 430, in evaluate_codeblock self.evaluate_statement(cur) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 443, in evaluate_statement return self.assignment(cur) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 1064, in assignment value = self.evaluate_statement(node.value) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 441, in evaluate_statement return self.function_call(cur) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 788, in function_call return func(node, posargs, kwargs) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) [Previous line repeated 2 more times] File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 155, in wrapped ret = f(*wrapped_args, **wrapped_kwargs) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 3234, in func_dependency d = self.dependency_impl(name, display_name, kwargs) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 3281, in dependency_impl dep = dependencies.find_external_dependency(name, self.environment, kwargs) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/dependencies/base.py", line 2230, in find_external_dependency d = c() File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/dependencies/misc.py", line 141, in __init__ self.link_args = self.clib_compiler.thread_link_flags(environment) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/compilers/mixins/clike.py", line 1071, in thread_link_flags return self.linker.thread_flags(env) AttributeError: 'NoneType' object has no attribute 'thread_flags' `
2020-02-24T18:59:32Z
[]
[]
Traceback (most recent call last): File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 129, in run return options.run_func(options) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/msetup.py", line 245, in run app.generate() File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/msetup.py", line 159, in generate self._generate(env) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/msetup.py", line 192, in _generate intr.run() File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 4165, in run super().run() File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 412, in run self.evaluate_codeblock(self.ast, start=1) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 436, in evaluate_codeblock raise e File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 430, in evaluate_codeblock self.evaluate_statement(cur) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 451, in evaluate_statement return self.evaluate_if(cur) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 533, in evaluate_if self.evaluate_codeblock(node.elseblock) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 436, in evaluate_codeblock raise e File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 430, in evaluate_codeblock self.evaluate_statement(cur) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 443, in evaluate_statement return self.assignment(cur) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 1064, in assignment value = self.evaluate_statement(node.value) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 441, in evaluate_statement return self.function_call(cur) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 788, in function_call return func(node, posargs, kwargs) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 285, in wrapped return f(*wrapped_args, **wrapped_kwargs) [Previous line repeated 2 more times] File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 155, in wrapped ret = f(*wrapped_args, **wrapped_kwargs) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreterbase.py", line 174, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 3234, in func_dependency d = self.dependency_impl(name, display_name, kwargs) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/interpreter.py", line 3281, in dependency_impl dep = dependencies.find_external_dependency(name, self.environment, kwargs) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/dependencies/base.py", line 2230, in find_external_dependency d = c() File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/dependencies/misc.py", line 141, in __init__ self.link_args = self.clib_compiler.thread_link_flags(environment) File "/home/daemoohn/.local/lib/python3.7/site-packages/mesonbuild/compilers/mixins/clike.py", line 1071, in thread_link_flags return self.linker.thread_flags(env) AttributeError: 'NoneType' object has no attribute 'thread_flags'
9,399
mesonbuild/meson
mesonbuild__meson-6704
6ba034c37d8004a72d392f37f66e709c593d8983
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -269,7 +269,9 @@ def detect_vs_dep_prefix(self, tempfilename): # 'Note: including file: d:\MyDir\include\stdio.h', however # different locales have different messages with a different # number of colons. Match up to the the drive name 'd:\'. - matchre = re.compile(rb"^(.*\s)[a-zA-Z]:\\.*stdio.h$") + # When used in cross compilation, the path separator is a + # backslash rather than a forward slash so handle both. + matchre = re.compile(rb"^(.*\s)([a-zA-Z]:\\|\/).*stdio.h$") def detect_prefix(out): for line in re.split(rb'\r?\n', out):
ninjabackend: detect_vs_dep_prefix doesn't correctly handle clang-cl cross compilation. ``` Traceback (most recent call last): File "/d/code/meson/mesonbuild/mesonmain.py", line 127, in run return options.run_func(options) File "/d/code/meson/mesonbuild/msetup.py", line 240, in run app.generate() File "/d/code/meson/mesonbuild/msetup.py", line 158, in generate self._generate(env) File "/d/code/meson/mesonbuild/msetup.py", line 210, in _generate intr.backend.generate(intr) File "/d/code/meson/mesonbuild/backend/ninjabackend.py", line 292, in generate with self.detect_vs_dep_prefix(tempfilename) as outfile: File "/d/code/meson/mesonbuild/backend/ninjabackend.py", line 254, in detect_vs_dep_prefix stdout=subprocess.PIPE, stderr=subprocess.PIPE) File "/usr/lib/python3.6/subprocess.py", line 709, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.6/subprocess.py", line 1258, in _execute_child executable = os.fsencode(executable) File "/usr/lib/python3.6/os.py", line 800, in fsencode filename = fspath(filename) # Does type-checking of `filename`. TypeError: expected str, bytes or os.PathLike object, not list ``` Fixing this by changing: ` pc = subprocess.Popen([compiler.get_exelist(),` to: ` pc = subprocess.Popen([compiler.get_exelist()[0],` Resolves that issue, but then the regex used to figure out the prefix is wrong on Linux. I.e., it doesn't handle paths like: `b'Note: including file: /d/code/chrome/src/third_party/depot_tools/win_toolchain/vs_files/418b3076791776573a815eb298c8aa590307af63/win_sdk/Include/10.0.18362.0/ucrt/stdio.h'` > ERROR: Could not determine vs dep dependency prefix string. This can be resolved by changing the regex from: ` matchre = re.compile(rb"^(.*\s)[a-zA-Z]:\\.*stdio.h$")` to: ` matchre = re.compile(rb"^(.*\s)([a-zA-Z]:\\|\/).*stdio.h$")`
I'm new to meson, just started trying it, and immediately got stuck with the > ERROR: Could not determine vs dep dependency prefix string. issue, without doing any cross-compilation or anything nontrivial. Unfortunately, I can't tell if my case is related at all; Google sent me here, when looking for this error message, FWIW. I got this with just MSVC, and not clang-cl. This caused failure to compiler glib from source for me. In meson v0.53.1 The "Could not determine vs dep dependency prefix string." portion of the problem still exists, and can be resolved using the updated matchre in OP, above (https://github.com/mesonbuild/meson/issues/5639#issue-467104366)
2020-02-26T23:03:16Z
[]
[]
Traceback (most recent call last): File "/d/code/meson/mesonbuild/mesonmain.py", line 127, in run return options.run_func(options) File "/d/code/meson/mesonbuild/msetup.py", line 240, in run app.generate() File "/d/code/meson/mesonbuild/msetup.py", line 158, in generate self._generate(env) File "/d/code/meson/mesonbuild/msetup.py", line 210, in _generate intr.backend.generate(intr) File "/d/code/meson/mesonbuild/backend/ninjabackend.py", line 292, in generate with self.detect_vs_dep_prefix(tempfilename) as outfile: File "/d/code/meson/mesonbuild/backend/ninjabackend.py", line 254, in detect_vs_dep_prefix stdout=subprocess.PIPE, stderr=subprocess.PIPE) File "/usr/lib/python3.6/subprocess.py", line 709, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.6/subprocess.py", line 1258, in _execute_child executable = os.fsencode(executable) File "/usr/lib/python3.6/os.py", line 800, in fsencode filename = fspath(filename) # Does type-checking of `filename`. TypeError: expected str, bytes or os.PathLike object, not list
9,402
mesonbuild/meson
mesonbuild__meson-6829
7924e5f9c20017a0ad7df6ee1cdb540d8a98dff7
diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py --- a/mesonbuild/cmake/interpreter.py +++ b/mesonbuild/cmake/interpreter.py @@ -15,6 +15,8 @@ # This class contains the basic functionality needed to run any interpreter # or an interpreter-based tool. +import pkg_resources + from .common import CMakeException, CMakeTarget from .client import CMakeClient, RequestCMakeInputs, RequestConfigure, RequestCompute, RequestCodeModel from .fileapi import CMakeFileAPI @@ -779,7 +781,7 @@ def configure(self, extra_cmake_options: T.List[str]) -> None: raise CMakeException('Unable to find CMake') self.trace = CMakeTraceParser(cmake_exe.version(), self.build_dir, permissive=True) - preload_file = Path(__file__).resolve().parent / 'data' / 'preload.cmake' + preload_file = pkg_resources.resource_filename('mesonbuild', 'cmake/data/preload.cmake') # Prefere CMAKE_PROJECT_INCLUDE over CMAKE_TOOLCHAIN_FILE if possible, # since CMAKE_PROJECT_INCLUDE was actually designed for code injection. @@ -1024,7 +1026,7 @@ def assign(var_name: str, value: BaseNode) -> AssignmentNode: root_cb.lines += [function('project', [self.project_name] + self.languages)] # Add the run script for custom commands - run_script = '{}/data/run_ctgt.py'.format(os.path.dirname(os.path.realpath(__file__))) + run_script = pkg_resources.resource_filename('mesonbuild', 'cmake/data/run_ctgt.py') run_script_var = 'ctgt_run_script' root_cb.lines += [assign(run_script_var, function('find_program', [[run_script]], {'required': True}))] diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -28,6 +28,8 @@ from enum import Enum from pathlib import Path, PurePath +import pkg_resources + from .. import mlog from .. import mesonlib from ..compilers import clib_langs @@ -1508,8 +1510,8 @@ def _setup_cmake_dir(self, cmake_file: str) -> str: build_dir = self._get_build_dir() # Insert language parameters into the CMakeLists.txt and write new CMakeLists.txt - src_cmake = Path(__file__).parent / 'data' / cmake_file - cmake_txt = src_cmake.read_text() + # Per the warning in pkg_resources, this is *not* a path and os.path and Pathlib are *not* safe to use here. + cmake_txt = pkg_resources.resource_string('mesonbuild', 'dependencies/data/' + cmake_file).decode() # In general, some Fortran CMake find_package() also require C language enabled, # even if nothing from C is directly used. An easy Fortran example that fails
FileNotFoundError: [Errno 2] \\Meson\\mesonbuild\\dependencies\\data\\CMakePathInfo.txt I am trying to install the [BGP Scanner](https://gitlab.com/Isolario/bgpscanner) with meson, I got this failure. Could anyone provide an advice for this issue? Thanks! ``` C:\Users\icherepa\Desktop\bgpscanner> meson --buildtype=release .. The Meson build system Version: 0.53.2 Source dir: C:\Users\icherepa\Desktop\bgpscanner Build dir: C:\Users\icherepa\Desktop Build type: native build Project name: bgpscanner Project version: 2.31 C compiler for the host machine: gcc (gcc 6.3.0 "gcc (MinGW.org GCC-6.3.0-1) 6.3.0") C linker for the host machine: gcc ld.bfd 2.28 Host machine cpu family: x86 Host machine cpu: x86 Run-time dependency threads found: YES Found pkg-config: C:\MinGW\bin\pkg-config.EXE (0.23) Found CMake: C:\Program Files\CMake\bin\cmake.EXE (3.17.0-rc3) Traceback (most recent call last): File "mesonbuild\mesonmain.py", line 129, in run File "mesonbuild\msetup.py", line 245, in run File "mesonbuild\msetup.py", line 159, in generate File "mesonbuild\msetup.py", line 192, in _generate File "mesonbuild\interpreter.py", line 4167, in run File "mesonbuild\interpreterbase.py", line 412, in run File "mesonbuild\interpreterbase.py", line 436, in evaluate_codeblock File "mesonbuild\interpreterbase.py", line 430, in evaluate_codeblock File "mesonbuild\interpreterbase.py", line 443, in evaluate_statement File "mesonbuild\interpreterbase.py", line 1064, in assignment File "mesonbuild\interpreterbase.py", line 441, in evaluate_statement File "mesonbuild\interpreterbase.py", line 788, in function_call File "mesonbuild\interpreterbase.py", line 285, in wrapped File "mesonbuild\interpreterbase.py", line 285, in wrapped File "mesonbuild\interpreterbase.py", line 285, in wrapped [Previous line repeated 2 more times] File "mesonbuild\interpreterbase.py", line 155, in wrapped File "mesonbuild\interpreterbase.py", line 174, in wrapped File "mesonbuild\interpreter.py", line 3236, in func_dependency File "mesonbuild\interpreter.py", line 3283, in dependency_impl File "mesonbuild\dependencies\base.py", line 2234, in find_external_dependency File "mesonbuild\dependencies\base.py", line 1104, in __init__ File "mesonbuild\dependencies\base.py", line 1158, in _get_cmake_info File "mesonbuild\dependencies\base.py", line 1533, in _call_cmake File "mesonbuild\dependencies\base.py", line 1507, in _setup_cmake_dir File "pathlib.py", line 1229, in read_text File "pathlib.py", line 1215, in open File "pathlib.py", line 1071, in _opener FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Program Files\\Meson\\mesonbuild\\dependencies\\data\\CMakePathInfo.txt' ``` I don't know how my issue is related to https://github.com/mesonbuild/meson/issues/5858 (there is also no solution answer).
btw the directory mesonbuild does not exist in the Meson directory. meson was install by means of pip. What does `pip show meson --files` show? ``` C:\Users\icherepa>pip show meson --files Name: meson Version: 0.53.2 Summary: A high performance build system Home-page: https://mesonbuild.com Author: Jussi Pakkanen Author-email: [email protected] License: Apache License, Version 2.0 Location: c:\users\icherepa\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages Requires: Required-by: Files: ..\Scripts\meson.exe meson-0.53.2.dist-info\COPYING meson-0.53.2.dist-info\INSTALLER meson-0.53.2.dist-info\METADATA meson-0.53.2.dist-info\RECORD meson-0.53.2.dist-info\WHEEL meson-0.53.2.dist-info\entry_points.txt meson-0.53.2.dist-info\top_level.txt mesonbuild\__init__.py mesonbuild\__pycache__\__init__.cpython-38.pyc mesonbuild\__pycache__\build.cpython-38.pyc mesonbuild\__pycache__\coredata.cpython-38.pyc mesonbuild\__pycache__\depfile.cpython-38.pyc mesonbuild\__pycache__\envconfig.cpython-38.pyc mesonbuild\__pycache__\environment.cpython-38.pyc mesonbuild\__pycache__\interpreter.cpython-38.pyc mesonbuild\__pycache__\interpreterbase.cpython-38.pyc mesonbuild\__pycache__\linkers.cpython-38.pyc mesonbuild\__pycache__\mconf.cpython-38.pyc mesonbuild\__pycache__\mdist.cpython-38.pyc mesonbuild\__pycache__\mesonlib.cpython-38.pyc mesonbuild\__pycache__\mesonmain.cpython-38.pyc mesonbuild\__pycache__\minit.cpython-38.pyc mesonbuild\__pycache__\minstall.cpython-38.pyc mesonbuild\__pycache__\mintro.cpython-38.pyc mesonbuild\__pycache__\mlog.cpython-38.pyc mesonbuild\__pycache__\mparser.cpython-38.pyc mesonbuild\__pycache__\msetup.cpython-38.pyc mesonbuild\__pycache__\msubprojects.cpython-38.pyc mesonbuild\__pycache__\mtest.cpython-38.pyc mesonbuild\__pycache__\munstable_coredata.cpython-38.pyc mesonbuild\__pycache__\optinterpreter.cpython-38.pyc mesonbuild\__pycache__\rewriter.cpython-38.pyc mesonbuild\ast\__init__.py mesonbuild\ast\__pycache__\__init__.cpython-38.pyc mesonbuild\ast\__pycache__\interpreter.cpython-38.pyc mesonbuild\ast\__pycache__\introspection.cpython-38.pyc mesonbuild\ast\__pycache__\postprocess.cpython-38.pyc mesonbuild\ast\__pycache__\printer.cpython-38.pyc mesonbuild\ast\__pycache__\visitor.cpython-38.pyc mesonbuild\ast\interpreter.py mesonbuild\ast\introspection.py mesonbuild\ast\postprocess.py mesonbuild\ast\printer.py mesonbuild\ast\visitor.py mesonbuild\backend\__init__.py mesonbuild\backend\__pycache__\__init__.cpython-38.pyc mesonbuild\backend\__pycache__\backends.cpython-38.pyc mesonbuild\backend\__pycache__\ninjabackend.cpython-38.pyc mesonbuild\backend\__pycache__\vs2010backend.cpython-38.pyc mesonbuild\backend\__pycache__\vs2015backend.cpython-38.pyc mesonbuild\backend\__pycache__\vs2017backend.cpython-38.pyc mesonbuild\backend\__pycache__\vs2019backend.cpython-38.pyc mesonbuild\backend\__pycache__\xcodebackend.cpython-38.pyc mesonbuild\backend\backends.py mesonbuild\backend\ninjabackend.py mesonbuild\backend\vs2010backend.py mesonbuild\backend\vs2015backend.py mesonbuild\backend\vs2017backend.py mesonbuild\backend\vs2019backend.py mesonbuild\backend\xcodebackend.py mesonbuild\build.py mesonbuild\cmake\__init__.py mesonbuild\cmake\__pycache__\__init__.cpython-38.pyc mesonbuild\cmake\__pycache__\client.cpython-38.pyc mesonbuild\cmake\__pycache__\common.cpython-38.pyc mesonbuild\cmake\__pycache__\executor.cpython-38.pyc mesonbuild\cmake\__pycache__\fileapi.cpython-38.pyc mesonbuild\cmake\__pycache__\generator.cpython-38.pyc mesonbuild\cmake\__pycache__\interpreter.cpython-38.pyc mesonbuild\cmake\__pycache__\traceparser.cpython-38.pyc mesonbuild\cmake\client.py mesonbuild\cmake\common.py mesonbuild\cmake\data\__pycache__\run_ctgt.cpython-38.pyc mesonbuild\cmake\data\preload.cmake mesonbuild\cmake\data\run_ctgt.py mesonbuild\cmake\executor.py mesonbuild\cmake\fileapi.py mesonbuild\cmake\generator.py mesonbuild\cmake\interpreter.py mesonbuild\cmake\traceparser.py mesonbuild\compilers\__init__.py mesonbuild\compilers\__pycache__\__init__.cpython-38.pyc mesonbuild\compilers\__pycache__\c.cpython-38.pyc mesonbuild\compilers\__pycache__\c_function_attributes.cpython-38.pyc mesonbuild\compilers\__pycache__\compilers.cpython-38.pyc mesonbuild\compilers\__pycache__\cpp.cpython-38.pyc mesonbuild\compilers\__pycache__\cs.cpython-38.pyc mesonbuild\compilers\__pycache__\cuda.cpython-38.pyc mesonbuild\compilers\__pycache__\d.cpython-38.pyc mesonbuild\compilers\__pycache__\fortran.cpython-38.pyc mesonbuild\compilers\__pycache__\java.cpython-38.pyc mesonbuild\compilers\__pycache__\objc.cpython-38.pyc mesonbuild\compilers\__pycache__\objcpp.cpython-38.pyc mesonbuild\compilers\__pycache__\rust.cpython-38.pyc mesonbuild\compilers\__pycache__\swift.cpython-38.pyc mesonbuild\compilers\__pycache__\vala.cpython-38.pyc mesonbuild\compilers\c.py mesonbuild\compilers\c_function_attributes.py mesonbuild\compilers\compilers.py mesonbuild\compilers\cpp.py mesonbuild\compilers\cs.py mesonbuild\compilers\cuda.py mesonbuild\compilers\d.py mesonbuild\compilers\fortran.py mesonbuild\compilers\java.py mesonbuild\compilers\mixins\__init__.py mesonbuild\compilers\mixins\__pycache__\__init__.cpython-38.pyc mesonbuild\compilers\mixins\__pycache__\arm.cpython-38.pyc mesonbuild\compilers\mixins\__pycache__\ccrx.cpython-38.pyc mesonbuild\compilers\mixins\__pycache__\clang.cpython-38.pyc mesonbuild\compilers\mixins\__pycache__\clike.cpython-38.pyc mesonbuild\compilers\mixins\__pycache__\elbrus.cpython-38.pyc mesonbuild\compilers\mixins\__pycache__\emscripten.cpython-38.pyc mesonbuild\compilers\mixins\__pycache__\gnu.cpython-38.pyc mesonbuild\compilers\mixins\__pycache__\intel.cpython-38.pyc mesonbuild\compilers\mixins\__pycache__\islinker.cpython-38.pyc mesonbuild\compilers\mixins\__pycache__\pgi.cpython-38.pyc mesonbuild\compilers\mixins\__pycache__\visualstudio.cpython-38.pyc mesonbuild\compilers\mixins\arm.py mesonbuild\compilers\mixins\ccrx.py mesonbuild\compilers\mixins\clang.py mesonbuild\compilers\mixins\clike.py mesonbuild\compilers\mixins\elbrus.py mesonbuild\compilers\mixins\emscripten.py mesonbuild\compilers\mixins\gnu.py mesonbuild\compilers\mixins\intel.py mesonbuild\compilers\mixins\islinker.py mesonbuild\compilers\mixins\pgi.py mesonbuild\compilers\mixins\visualstudio.py mesonbuild\compilers\objc.py mesonbuild\compilers\objcpp.py mesonbuild\compilers\rust.py mesonbuild\compilers\swift.py mesonbuild\compilers\vala.py mesonbuild\coredata.py mesonbuild\dependencies\__init__.py mesonbuild\dependencies\__pycache__\__init__.cpython-38.pyc mesonbuild\dependencies\__pycache__\base.cpython-38.pyc mesonbuild\dependencies\__pycache__\boost.cpython-38.pyc mesonbuild\dependencies\__pycache__\coarrays.cpython-38.pyc mesonbuild\dependencies\__pycache__\cuda.cpython-38.pyc mesonbuild\dependencies\__pycache__\dev.cpython-38.pyc mesonbuild\dependencies\__pycache__\hdf5.cpython-38.pyc mesonbuild\dependencies\__pycache__\misc.cpython-38.pyc mesonbuild\dependencies\__pycache__\mpi.cpython-38.pyc mesonbuild\dependencies\__pycache__\platform.cpython-38.pyc mesonbuild\dependencies\__pycache__\scalapack.cpython-38.pyc mesonbuild\dependencies\__pycache__\ui.cpython-38.pyc mesonbuild\dependencies\base.py mesonbuild\dependencies\boost.py mesonbuild\dependencies\coarrays.py mesonbuild\dependencies\cuda.py mesonbuild\dependencies\data\CMakeLists.txt mesonbuild\dependencies\data\CMakeListsLLVM.txt mesonbuild\dependencies\data\CMakePathInfo.txt mesonbuild\dependencies\dev.py mesonbuild\dependencies\hdf5.py mesonbuild\dependencies\misc.py mesonbuild\dependencies\mpi.py mesonbuild\dependencies\platform.py mesonbuild\dependencies\scalapack.py mesonbuild\dependencies\ui.py mesonbuild\depfile.py mesonbuild\envconfig.py mesonbuild\environment.py mesonbuild\interpreter.py mesonbuild\interpreterbase.py mesonbuild\linkers.py mesonbuild\mconf.py mesonbuild\mdist.py mesonbuild\mesonlib.py mesonbuild\mesonmain.py mesonbuild\minit.py mesonbuild\minstall.py mesonbuild\mintro.py mesonbuild\mlog.py mesonbuild\modules\__init__.py mesonbuild\modules\__pycache__\__init__.cpython-38.pyc mesonbuild\modules\__pycache__\cmake.cpython-38.pyc mesonbuild\modules\__pycache__\dlang.cpython-38.pyc mesonbuild\modules\__pycache__\fs.cpython-38.pyc mesonbuild\modules\__pycache__\gnome.cpython-38.pyc mesonbuild\modules\__pycache__\hotdoc.cpython-38.pyc mesonbuild\modules\__pycache__\i18n.cpython-38.pyc mesonbuild\modules\__pycache__\modtest.cpython-38.pyc mesonbuild\modules\__pycache__\pkgconfig.cpython-38.pyc mesonbuild\modules\__pycache__\python.cpython-38.pyc mesonbuild\modules\__pycache__\python3.cpython-38.pyc mesonbuild\modules\__pycache__\qt.cpython-38.pyc mesonbuild\modules\__pycache__\qt4.cpython-38.pyc mesonbuild\modules\__pycache__\qt5.cpython-38.pyc mesonbuild\modules\__pycache__\rpm.cpython-38.pyc mesonbuild\modules\__pycache__\sourceset.cpython-38.pyc mesonbuild\modules\__pycache__\unstable_cuda.cpython-38.pyc mesonbuild\modules\__pycache__\unstable_icestorm.cpython-38.pyc mesonbuild\modules\__pycache__\unstable_kconfig.cpython-38.pyc mesonbuild\modules\__pycache__\unstable_simd.cpython-38.pyc mesonbuild\modules\__pycache__\windows.cpython-38.pyc mesonbuild\modules\cmake.py mesonbuild\modules\dlang.py mesonbuild\modules\fs.py mesonbuild\modules\gnome.py mesonbuild\modules\hotdoc.py mesonbuild\modules\i18n.py mesonbuild\modules\modtest.py mesonbuild\modules\pkgconfig.py mesonbuild\modules\python.py mesonbuild\modules\python3.py mesonbuild\modules\qt.py mesonbuild\modules\qt4.py mesonbuild\modules\qt5.py mesonbuild\modules\rpm.py mesonbuild\modules\sourceset.py mesonbuild\modules\unstable_cuda.py mesonbuild\modules\unstable_icestorm.py mesonbuild\modules\unstable_kconfig.py mesonbuild\modules\unstable_simd.py mesonbuild\modules\windows.py mesonbuild\mparser.py mesonbuild\msetup.py mesonbuild\msubprojects.py mesonbuild\mtest.py mesonbuild\munstable_coredata.py mesonbuild\optinterpreter.py mesonbuild\rewriter.py mesonbuild\scripts\__init__.py mesonbuild\scripts\__pycache__\__init__.cpython-38.pyc mesonbuild\scripts\__pycache__\clangformat.cpython-38.pyc mesonbuild\scripts\__pycache__\clangtidy.cpython-38.pyc mesonbuild\scripts\__pycache__\cleantrees.cpython-38.pyc mesonbuild\scripts\__pycache__\commandrunner.cpython-38.pyc mesonbuild\scripts\__pycache__\coverage.cpython-38.pyc mesonbuild\scripts\__pycache__\delwithsuffix.cpython-38.pyc mesonbuild\scripts\__pycache__\depfixer.cpython-38.pyc mesonbuild\scripts\__pycache__\dirchanger.cpython-38.pyc mesonbuild\scripts\__pycache__\gettext.cpython-38.pyc mesonbuild\scripts\__pycache__\gtkdochelper.cpython-38.pyc mesonbuild\scripts\__pycache__\hotdochelper.cpython-38.pyc mesonbuild\scripts\__pycache__\meson_exe.cpython-38.pyc mesonbuild\scripts\__pycache__\msgfmthelper.cpython-38.pyc mesonbuild\scripts\__pycache__\regen_checker.cpython-38.pyc mesonbuild\scripts\__pycache__\scanbuild.cpython-38.pyc mesonbuild\scripts\__pycache__\symbolextractor.cpython-38.pyc mesonbuild\scripts\__pycache__\tags.cpython-38.pyc mesonbuild\scripts\__pycache__\uninstall.cpython-38.pyc mesonbuild\scripts\__pycache__\vcstagger.cpython-38.pyc mesonbuild\scripts\__pycache__\yelphelper.cpython-38.pyc mesonbuild\scripts\clangformat.py mesonbuild\scripts\clangtidy.py mesonbuild\scripts\cleantrees.py mesonbuild\scripts\commandrunner.py mesonbuild\scripts\coverage.py mesonbuild\scripts\delwithsuffix.py mesonbuild\scripts\depfixer.py mesonbuild\scripts\dirchanger.py mesonbuild\scripts\gettext.py mesonbuild\scripts\gtkdochelper.py mesonbuild\scripts\hotdochelper.py mesonbuild\scripts\meson_exe.py mesonbuild\scripts\msgfmthelper.py mesonbuild\scripts\regen_checker.py mesonbuild\scripts\scanbuild.py mesonbuild\scripts\symbolextractor.py mesonbuild\scripts\tags.py mesonbuild\scripts\uninstall.py mesonbuild\scripts\vcstagger.py mesonbuild\scripts\yelphelper.py mesonbuild\templates\__init__.py mesonbuild\templates\__pycache__\__init__.cpython-38.pyc mesonbuild\templates\__pycache__\cpptemplates.cpython-38.pyc mesonbuild\templates\__pycache__\ctemplates.cpython-38.pyc mesonbuild\templates\__pycache__\dlangtemplates.cpython-38.pyc mesonbuild\templates\__pycache__\fortrantemplates.cpython-38.pyc mesonbuild\templates\__pycache__\objctemplates.cpython-38.pyc mesonbuild\templates\__pycache__\rusttemplates.cpython-38.pyc mesonbuild\templates\cpptemplates.py mesonbuild\templates\ctemplates.py mesonbuild\templates\dlangtemplates.py mesonbuild\templates\fortrantemplates.py mesonbuild\templates\objctemplates.py mesonbuild\templates\rusttemplates.py mesonbuild\wrap\__init__.py mesonbuild\wrap\__pycache__\__init__.cpython-38.pyc mesonbuild\wrap\__pycache__\wrap.cpython-38.pyc mesonbuild\wrap\__pycache__\wraptool.cpython-38.pyc mesonbuild\wrap\wrap.py mesonbuild\wrap\wraptool.py ``` The crude workaround of copying the `mesonbuild/dependencies/data` directory (from the git repo) to `C:\Program Files\Meson\mesonbuild\dependencies\data` appears to work for me, both for the pip-installed version and the MSI-installed (#5858) version. So at least on the surface it would appear that Meson is expecting 'data' files in a fixed location, where it should be looking relative to the install location. In addition, for the MSI case (#5858), the files are entirely missing from the installation. I also encountered a second, analogous issue where `mesonbuild/cmake/data/run_ctgt.py` was missing. Again, errors went away after copying this `data` directory from git. Since we have a dependency on setuptools now we really should be using setuptools' data management stuff, which is robust in these kind of cases.
2020-03-23T18:49:37Z
[]
[]
Traceback (most recent call last): File "mesonbuild\mesonmain.py", line 129, in run File "mesonbuild\msetup.py", line 245, in run File "mesonbuild\msetup.py", line 159, in generate File "mesonbuild\msetup.py", line 192, in _generate File "mesonbuild\interpreter.py", line 4167, in run File "mesonbuild\interpreterbase.py", line 412, in run File "mesonbuild\interpreterbase.py", line 436, in evaluate_codeblock File "mesonbuild\interpreterbase.py", line 430, in evaluate_codeblock File "mesonbuild\interpreterbase.py", line 443, in evaluate_statement File "mesonbuild\interpreterbase.py", line 1064, in assignment File "mesonbuild\interpreterbase.py", line 441, in evaluate_statement File "mesonbuild\interpreterbase.py", line 788, in function_call File "mesonbuild\interpreterbase.py", line 285, in wrapped File "mesonbuild\interpreterbase.py", line 285, in wrapped File "mesonbuild\interpreterbase.py", line 285, in wrapped [Previous line repeated 2 more times] File "mesonbuild\interpreterbase.py", line 155, in wrapped File "mesonbuild\interpreterbase.py", line 174, in wrapped File "mesonbuild\interpreter.py", line 3236, in func_dependency File "mesonbuild\interpreter.py", line 3283, in dependency_impl File "mesonbuild\dependencies\base.py", line 2234, in find_external_dependency File "mesonbuild\dependencies\base.py", line 1104, in __init__ File "mesonbuild\dependencies\base.py", line 1158, in _get_cmake_info File "mesonbuild\dependencies\base.py", line 1533, in _call_cmake File "mesonbuild\dependencies\base.py", line 1507, in _setup_cmake_dir File "pathlib.py", line 1229, in read_text File "pathlib.py", line 1215, in open File "pathlib.py", line 1071, in _opener FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Program Files\\Meson\\mesonbuild\\dependencies\\data\\CMakePathInfo.txt'
9,411
mesonbuild/meson
mesonbuild__meson-7196
804cefc94cd334fccccdf3015eb0b3f589f87515
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -968,6 +968,13 @@ def generate_run_target(self, target): self.processed_targets[target.get_id()] = True def generate_coverage_command(self, elem, outputs): + targets = self.build.get_targets().values() + use_llvm_cov = False + for target in targets: + for compiler in target.compilers.values(): + if compiler.get_id() == 'clang' and not compiler.info.is_darwin(): + use_llvm_cov = True + break elem.add_item('COMMAND', self.environment.get_build_command() + ['--internal', 'coverage'] + outputs + @@ -975,7 +982,8 @@ def generate_coverage_command(self, elem, outputs): os.path.join(self.environment.get_source_dir(), self.build.get_subproject_dir()), self.environment.get_build_dir(), - self.environment.get_log_dir()]) + self.environment.get_log_dir()] + + ['--use_llvm_cov'] if use_llvm_cov else []) def generate_coverage_rules(self): e = NinjaBuildElement(self.all_outputs, 'meson-coverage', 'CUSTOM_COMMAND', 'PHONY') diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -134,9 +134,18 @@ def detect_gcovr(min_version='3.3', new_rootdir_version='4.2', log=False): return gcovr_exe, mesonlib.version_compare(found, '>=' + new_rootdir_version) return None, None +def detect_llvm_cov(): + tools = get_llvm_tool_names('llvm-cov') + for tool in tools: + if mesonlib.exe_exists([tool, '--version']): + return tool + return None + def find_coverage_tools(): gcovr_exe, gcovr_new_rootdir = detect_gcovr() + llvm_cov_exe = detect_llvm_cov() + lcov_exe = 'lcov' genhtml_exe = 'genhtml' @@ -145,7 +154,7 @@ def find_coverage_tools(): if not mesonlib.exe_exists([genhtml_exe, '--version']): genhtml_exe = None - return gcovr_exe, gcovr_new_rootdir, lcov_exe, genhtml_exe + return gcovr_exe, gcovr_new_rootdir, lcov_exe, genhtml_exe, llvm_cov_exe def detect_ninja(version: str = '1.7', log: bool = False) -> str: r = detect_ninja_command_and_version(version, log) diff --git a/mesonbuild/scripts/coverage.py b/mesonbuild/scripts/coverage.py --- a/mesonbuild/scripts/coverage.py +++ b/mesonbuild/scripts/coverage.py @@ -12,15 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -from mesonbuild import environment +from mesonbuild import environment, mesonlib -import argparse, sys, os, subprocess, pathlib +import argparse, sys, os, subprocess, pathlib, stat -def coverage(outputs, source_root, subproject_root, build_root, log_dir): +def coverage(outputs, source_root, subproject_root, build_root, log_dir, use_llvm_cov): outfiles = [] exitcode = 0 - (gcovr_exe, gcovr_new_rootdir, lcov_exe, genhtml_exe) = environment.find_coverage_tools() + (gcovr_exe, gcovr_new_rootdir, lcov_exe, genhtml_exe, llvm_cov_exe) = environment.find_coverage_tools() # gcovr >= 4.2 requires a different syntax for out of source builds if gcovr_new_rootdir: @@ -28,13 +28,18 @@ def coverage(outputs, source_root, subproject_root, build_root, log_dir): else: gcovr_base_cmd = [gcovr_exe, '-r', build_root] + if use_llvm_cov: + gcov_exe_args = ['--gcov-executable', llvm_cov_exe + ' gcov'] + else: + gcov_exe_args = [] + if not outputs or 'xml' in outputs: if gcovr_exe: subprocess.check_call(gcovr_base_cmd + ['-x', '-e', subproject_root, - '-o', os.path.join(log_dir, 'coverage.xml'), - ]) + '-o', os.path.join(log_dir, 'coverage.xml') + ] + gcov_exe_args) outfiles.append(('Xml', pathlib.Path(log_dir, 'coverage.xml'))) elif outputs: print('gcovr >= 3.3 needed to generate Xml coverage report') @@ -44,8 +49,8 @@ def coverage(outputs, source_root, subproject_root, build_root, log_dir): if gcovr_exe: subprocess.check_call(gcovr_base_cmd + ['-e', subproject_root, - '-o', os.path.join(log_dir, 'coverage.txt'), - ]) + '-o', os.path.join(log_dir, 'coverage.txt') + ] + gcov_exe_args) outfiles.append(('Text', pathlib.Path(log_dir, 'coverage.txt'))) elif outputs: print('gcovr >= 3.3 needed to generate text coverage report') @@ -58,19 +63,34 @@ def coverage(outputs, source_root, subproject_root, build_root, log_dir): initial_tracefile = covinfo + '.initial' run_tracefile = covinfo + '.run' raw_tracefile = covinfo + '.raw' + if use_llvm_cov: + # Create a shim to allow using llvm-cov as a gcov tool. + if mesonlib.is_windows(): + llvm_cov_shim_path = os.path.join(log_dir, 'llvm-cov.bat') + with open(llvm_cov_shim_path, 'w') as llvm_cov_bat: + llvm_cov_bat.write('@"{}" gcov %*'.format(llvm_cov_exe)) + else: + llvm_cov_shim_path = os.path.join(log_dir, 'llvm-cov.sh') + with open(llvm_cov_shim_path, 'w') as llvm_cov_sh: + llvm_cov_sh.write('#!/usr/bin/env sh\nexec "{}" gcov $@'.format(llvm_cov_exe)) + os.chmod(llvm_cov_shim_path, os.stat(llvm_cov_shim_path).st_mode | stat.S_IEXEC) + gcov_tool_args = ['--gcov-tool', llvm_cov_shim_path] + else: + gcov_tool_args = [] subprocess.check_call([lcov_exe, '--directory', build_root, '--capture', '--initial', '--output-file', - initial_tracefile]) + initial_tracefile] + + gcov_tool_args) subprocess.check_call([lcov_exe, '--directory', build_root, '--capture', '--output-file', run_tracefile, '--no-checksum', - '--rc', 'lcov_branch_coverage=1', - ]) + '--rc', 'lcov_branch_coverage=1'] + + gcov_tool_args) # Join initial and test results. subprocess.check_call([lcov_exe, '-a', initial_tracefile, @@ -137,6 +157,8 @@ def run(args): const='xml', help='generate Xml report') parser.add_argument('--html', dest='outputs', action='append_const', const='html', help='generate Html report') + parser.add_argument('--use_llvm_cov', action='store_true', + help='use llvm-cov') parser.add_argument('source_root') parser.add_argument('subproject_root') parser.add_argument('build_root') @@ -144,7 +166,7 @@ def run(args): options = parser.parse_args(args) return coverage(options.outputs, options.source_root, options.subproject_root, options.build_root, - options.log_dir) + options.log_dir, options.use_llvm_cov) if __name__ == '__main__': sys.exit(run(sys.argv[1:])) diff --git a/run_unittests.py b/run_unittests.py --- a/run_unittests.py +++ b/run_unittests.py @@ -4829,6 +4829,82 @@ def clean_dir_arguments(text): self.assertEqual(parsed_help['usage'], parsed_section['usage']) self.assertEqual(parsed_help['arguments'], parsed_section['arguments']) + def test_coverage(self): + if mesonbuild.environment.detect_msys2_arch(): + raise unittest.SkipTest('Skipped due to problems with coverage on MSYS2') + gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr() + if not gcovr_exe: + raise unittest.SkipTest('gcovr not found, or too old') + testdir = os.path.join(self.common_test_dir, '1 trivial') + env = get_fake_env(testdir, self.builddir, self.prefix) + cc = env.detect_c_compiler(MachineChoice.HOST) + if cc.get_id() == 'clang': + if not mesonbuild.environment.detect_llvm_cov(): + raise unittest.SkipTest('llvm-cov not found') + if cc.get_id() == 'msvc': + raise unittest.SkipTest('Test only applies to non-MSVC compilers') + self.init(testdir, extra_args=['-Db_coverage=true']) + self.build() + self.run_tests() + self.run_target('coverage') + + def test_coverage_html(self): + if mesonbuild.environment.detect_msys2_arch(): + raise unittest.SkipTest('Skipped due to problems with coverage on MSYS2') + gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr() + if not gcovr_exe: + raise unittest.SkipTest('gcovr not found, or too old') + testdir = os.path.join(self.common_test_dir, '1 trivial') + env = get_fake_env(testdir, self.builddir, self.prefix) + cc = env.detect_c_compiler(MachineChoice.HOST) + if cc.get_id() == 'clang': + if not mesonbuild.environment.detect_llvm_cov(): + raise unittest.SkipTest('llvm-cov not found') + if cc.get_id() == 'msvc': + raise unittest.SkipTest('Test only applies to non-MSVC compilers') + self.init(testdir, extra_args=['-Db_coverage=true']) + self.build() + self.run_tests() + self.run_target('coverage-html') + + def test_coverage_text(self): + if mesonbuild.environment.detect_msys2_arch(): + raise unittest.SkipTest('Skipped due to problems with coverage on MSYS2') + gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr() + if not gcovr_exe: + raise unittest.SkipTest('gcovr not found, or too old') + testdir = os.path.join(self.common_test_dir, '1 trivial') + env = get_fake_env(testdir, self.builddir, self.prefix) + cc = env.detect_c_compiler(MachineChoice.HOST) + if cc.get_id() == 'clang': + if not mesonbuild.environment.detect_llvm_cov(): + raise unittest.SkipTest('llvm-cov not found') + if cc.get_id() == 'msvc': + raise unittest.SkipTest('Test only applies to non-MSVC compilers') + self.init(testdir, extra_args=['-Db_coverage=true']) + self.build() + self.run_tests() + self.run_target('coverage-text') + + def test_coverage_xml(self): + if mesonbuild.environment.detect_msys2_arch(): + raise unittest.SkipTest('Skipped due to problems with coverage on MSYS2') + gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr() + if not gcovr_exe: + raise unittest.SkipTest('gcovr not found, or too old') + testdir = os.path.join(self.common_test_dir, '1 trivial') + env = get_fake_env(testdir, self.builddir, self.prefix) + cc = env.detect_c_compiler(MachineChoice.HOST) + if cc.get_id() == 'clang': + if not mesonbuild.environment.detect_llvm_cov(): + raise unittest.SkipTest('llvm-cov not found') + if cc.get_id() == 'msvc': + raise unittest.SkipTest('Test only applies to non-MSVC compilers') + self.init(testdir, extra_args=['-Db_coverage=true']) + self.build() + self.run_tests() + self.run_target('coverage-xml') + class FailureTests(BasePlatformTests): ''' Tests that test failure conditions. Build files here should be dynamically @@ -6301,21 +6377,6 @@ def test_pch_with_address_sanitizer(self): for i in compdb: self.assertIn("-fsanitize=address", i["command"]) - def test_coverage(self): - gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr() - if not gcovr_exe: - raise unittest.SkipTest('gcovr not found') - if not shutil.which('genhtml') and not gcovr_new_rootdir: - raise unittest.SkipTest('genhtml not found and gcovr is too old') - if 'clang' in os.environ.get('CC', ''): - # We need to use llvm-cov instead of gcovr with clang - raise unittest.SkipTest('Coverage does not work with clang right now, help wanted!') - testdir = os.path.join(self.common_test_dir, '1 trivial') - self.init(testdir, extra_args=['-Db_coverage=true']) - self.build() - self.run_tests() - self.run_target('coverage-html') - def test_cross_find_program(self): testdir = os.path.join(self.unit_test_dir, '11 cross prog') crossfile = tempfile.NamedTemporaryFile(mode='w')
Meson coverage fails while using clang compiler with gcov **Describe the bug** Meson coverage fails while using clang compiler with gcov Error <filename>cpp.gcno:version '402*', prefer '408R' gcov: out of memory allocating 16158259920 bytes after a total of 135168 bytes geninfo: ERROR: GCOV failed for <filename>.cpp.gcda! Traceback (most recent call last): File "/usr/local/bin/meson", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 226, in main return run(sys.argv[1:], launcher) File "/usr/local/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 215, in run return run_script_command(args[1], args[2:]) File "/usr/local/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 163, in run_script_command return module.run(script_args) File "/usr/local/lib/python3.6/site-packages/mesonbuild/scripts/coverage.py", line 147, in run options.log_dir) File "/usr/local/lib/python3.6/site-packages/mesonbuild/scripts/coverage.py", line 72, in coverage '--rc', 'lcov_branch_coverage=1', File "/usr/lib64/python3.6/subprocess.py", line 311, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['lcov', '--directory', '<buildDIR>', '--capture', '--output-file', '<buildDIR>/meson-logs/coverage.info.run', '--no-checksum', '--rc', 'lcov_branch_coverage=1']' returned non-zero exit status 29. ninja: build stopped: subcommand failed. **Expected behavior** Coverage should work independent of compiler (gcc or clang) **system parameters** * Is this a [cross build](https://mesonbuild.com/Cross-compilation.html) or just a plain native build (for the same computer)? - native build * what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.) - CentOS Linux release 7.7.1908 * what Python version are you using e.g. 3.8.0 - Python 3.6.8 * what `meson --version` - 0.53.1 * what `ninja --version` if it's a Ninja build - 1.7.2
The most significant part of the log is: ``` Error cpp.gcno:version '402*', prefer '408R' gcov: out of memory allocating 16158259920 bytes after a total of 135168 bytes ``` Looks like a bug in gcov? clang is not compatible with gcov, this can be resolved using llvm-cov with clang. On my local copy I have found a workaround by setting gcov-tool as llvm-cov in coverage.py file. So can this be resolved in meson coverage file? On Tue, 25 Feb, 2020, 11:43 AM Nirbheek Chauhan, <[email protected]> wrote: > The most significant part of the log is: > > Error > cpp.gcno:version '402*', prefer '408R' > > gcov: out of memory allocating 16158259920 bytes after a total of 135168 bytes > > Looks like a bug in gcov? > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/mesonbuild/meson/issues/6691?email_source=notifications&email_token=AOTYMHWQWRSDWFVLK5XRED3RESZJLA5CNFSM4K25EHBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM2WNAY#issuecomment-590702211>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AOTYMHXE33I2PO47XZ5KMRLRESZJLANCNFSM4K25EHBA> > . > In coverage.py, I made the following changes: ``` 67 subprocess.check_call([lcov_exe, 68 '--directory', build_root, 69 '--base-directory', build_root, 70 **'--gcov-tool', '../llvm.sh',** 71 '--capture', 72 '-o', run_tracefile, 73 ]) ``` And the llvm.sh content is as follows: ``` 1 #!/bin/bash 2 exec llvm-cov gcov "$@" ``` > The most significant part of the log is: > > ``` > Error > cpp.gcno:version '402*', prefer '408R' > > gcov: out of memory allocating 16158259920 bytes after a total of 135168 bytes > ``` > > Looks like a bug in gcov? Since gcov/lcov and clang are not compatible, shouldn't this be the responsibility of meson to search for some compatible tool with clang for coverage? Or meson should give option to user to select coverage tool using some argument!?
2020-05-24T05:50:47Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/meson", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 226, in main return run(sys.argv[1:], launcher) File "/usr/local/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 215, in run return run_script_command(args[1], args[2:]) File "/usr/local/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 163, in run_script_command return module.run(script_args) File "/usr/local/lib/python3.6/site-packages/mesonbuild/scripts/coverage.py", line 147, in run options.log_dir) File "/usr/local/lib/python3.6/site-packages/mesonbuild/scripts/coverage.py", line 72, in coverage '--rc', 'lcov_branch_coverage=1', File "/usr/lib64/python3.6/subprocess.py", line 311, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['lcov', '--directory', '<buildDIR>', '--capture', '--output-file', '<buildDIR>/meson-logs/coverage.info.run', '--no-checksum', '--rc', 'lcov_branch_coverage=1']' returned non-zero exit status 29.
9,448
mesonbuild/meson
mesonbuild__meson-7527
70edf82c6c77902cd64f44848302bbac92d611d8
diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py --- a/mesonbuild/cmake/interpreter.py +++ b/mesonbuild/cmake/interpreter.py @@ -651,7 +651,7 @@ def __init__(self, target: CMakeGeneratorTarget): def __repr__(self) -> str: return '<{}: {} {}>'.format(self.__class__.__name__, self.name, self.outputs) - def postprocess(self, output_target_map: OutputTargetMap, root_src_dir: str, subdir: str, all_outputs: T.List[str]) -> None: + def postprocess(self, output_target_map: OutputTargetMap, root_src_dir: str, subdir: str, all_outputs: T.List[str], trace: CMakeTraceParser) -> None: # Default the working directory to ${CMAKE_CURRENT_BINARY_DIR} if not self.working_dir: self.working_dir = self.current_bin_dir.as_posix() @@ -694,7 +694,18 @@ def ensure_absolute(x: Path) -> Path: if not j: continue target = output_target_map.executable(j) - cmd += [target] if target else [j] + if target: + cmd += [target] + continue + elif j in trace.targets: + trace_tgt = trace.targets[j] + if trace_tgt.type == 'EXECUTABLE' and 'IMPORTED_LOCATION' in trace_tgt.properties: + cmd += trace_tgt.properties['IMPORTED_LOCATION'] + continue + mlog.debug('CMake: Found invalid CMake target "{}" --> ignoring \n{}'.format(j, trace_tgt)) + + # Fallthrough on error + cmd += [j] commands += [cmd] self.command = commands @@ -969,7 +980,7 @@ def analyse(self) -> None: object_libs = [] custom_target_outputs = [] # type: T.List[str] for i in self.custom_targets: - i.postprocess(self.output_target_map, self.src_dir, self.subdir, custom_target_outputs) + i.postprocess(self.output_target_map, self.src_dir, self.subdir, custom_target_outputs, self.trace) for i in self.targets: i.postprocess(self.output_target_map, self.src_dir, self.subdir, self.install_prefix, self.trace) if i.type == 'OBJECT_LIBRARY': diff --git a/mesonbuild/cmake/traceparser.py b/mesonbuild/cmake/traceparser.py --- a/mesonbuild/cmake/traceparser.py +++ b/mesonbuild/cmake/traceparser.py @@ -269,6 +269,7 @@ def _cmake_add_executable(self, tline: CMakeTraceLine): args = list(tline.args) # Make a working copy # Make sure the exe is imported + is_imported = True if 'IMPORTED' not in args: return self._gen_exception('add_executable', 'non imported executables are not supported', tline) @@ -277,7 +278,7 @@ def _cmake_add_executable(self, tline: CMakeTraceLine): if len(args) < 1: return self._gen_exception('add_executable', 'requires at least 1 argument', tline) - self.targets[args[0]] = CMakeTarget(args[0], 'EXECUTABLE', {}) + self.targets[args[0]] = CMakeTarget(args[0], 'EXECUTABLE', {}, tline=tline, imported=is_imported) def _cmake_add_library(self, tline: CMakeTraceLine): # DOC: https://cmake.org/cmake/help/latest/command/add_library.html
Meson, Cmake and PROTOBUF_GENERATE_CPP uses wrong executable **Describe the bug** When running PROTOBUF_GENERATE_CPP in a cmake subproject, `protobuf::protoc` is attempted to be used as an executable rather than `protoc`. **To Reproduce** 1. Clone [this repo](https://github.com/mdegans/libdistance/tree/a974132399ad4f69f6bbe32a85db44e4c848fb2f) 2. Comment out subdirs (since those require proprietary software) 3. attempt to build the "distanceproto" wrap subproject. Output on my system: ``` [4/11] Generating cm_custom_tgt_0 with a custom command FAILED: subprojects/distanceproto/distance.pb.cc subprojects/distanceproto/distance.pb.h /home/mdegans/.local/bin/meson --internal cmake_run_ctgt -o subprojects/distanceproto/distance.pb.cc subprojects/distanceproto/distance.pb.h -O /home/mdegans/Projects/libdistance/builddir/subprojects/distanceproto/__CMake_build/src/distance.pb.cc /home/mdegans/Projects/libdistance/builddir/subprojects/distanceproto/__CMake_build/src/distance.pb.h -d /home/mdegans/Projects/libdistance/builddir/subprojects/distanceproto/__CMake_build/src protobuf::protoc --cpp_out=/home/mdegans/Projects/libdistance/builddir/subprojects/distanceproto/__CMake_build/src -I '/home/mdegans/Projects/libdistance/subprojects/distanceproto/src /home/mdegans/Projects/libdistance/subprojects/distanceproto/src/distance.proto' ';;;' Traceback (most recent call last): File "/home/mdegans/.local/bin/meson", line 8, in <module> sys.exit(main()) File "/home/mdegans/.local/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 228, in main return run(sys.argv[1:], launcher) File "/home/mdegans/.local/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 217, in run return run_script_command(args[1], args[2:]) File "/home/mdegans/.local/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 165, in run_script_command return module.run(script_args) File "/home/mdegans/.local/lib/python3.6/site-packages/mesonbuild/scripts/cmake_run_ctgt.py", line 67, in run res = subprocess.run(cmd, stdout=stdout, stderr=stderr, cwd=args.directory, check=True) File "/usr/lib/python3.6/subprocess.py", line 423, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.6/subprocess.py", line 729, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'protobuf::protoc': 'protobuf::protoc' [7/11] Compiling C++ object src/libdistance.so.p/FileMetaBroker.cpp.o ninja: build stopped: subcommand failed. ``` **Expected behavior** For "protoc" to be called instead of "protobuf::protoc" **system parameters** * plain native build. * Ubuntu 18.04 * Python 3.6.9 * 0.55.0 * 1.8.2 Alternatively (if this is a CMake bug), if the output of a `generator.process()` supported indexing and such generated headers could be installed with `install_headers` I could stop using CMake on the protobuf subproject. Basically I'm trying to isntall generated headers and am not sure if that's possible currently with Meson, so I'm stuck with CMake :/
Related solution for those who might consider switching their subproject to meson as a solution: #7511
2020-08-03T15:50:30Z
[]
[]
Traceback (most recent call last): File "/home/mdegans/.local/bin/meson", line 8, in <module> sys.exit(main()) File "/home/mdegans/.local/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 228, in main return run(sys.argv[1:], launcher) File "/home/mdegans/.local/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 217, in run return run_script_command(args[1], args[2:]) File "/home/mdegans/.local/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 165, in run_script_command return module.run(script_args) File "/home/mdegans/.local/lib/python3.6/site-packages/mesonbuild/scripts/cmake_run_ctgt.py", line 67, in run res = subprocess.run(cmd, stdout=stdout, stderr=stderr, cwd=args.directory, check=True) File "/usr/lib/python3.6/subprocess.py", line 423, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.6/subprocess.py", line 729, in __init__ restore_signals, start_new_session) File "/usr/lib/python3.6/subprocess.py", line 1364, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'protobuf::protoc': 'protobuf::protoc'
9,466
mesonbuild/meson
mesonbuild__meson-7689
0b0873c7438471732e5237b1c667e5a3b3fe3c82
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -543,10 +543,10 @@ def generate_compdb(self): # rule store as being wanted in compdb for for_machine in MachineChoice: for lang in self.environment.coredata.compilers[for_machine]: - rules += [ "%s%s" % (rule, ext) for rule in [self.get_compiler_rule_name(lang, for_machine)] - for ext in ['', '_RSP']] - rules += [ "%s%s" % (rule, ext) for rule in [self.get_pch_rule_name(lang, for_machine)] - for ext in ['', '_RSP']] + rules += ["%s%s" % (rule, ext) for rule in [self.get_compiler_rule_name(lang, for_machine)] + for ext in ['', '_RSP']] + rules += ["%s%s" % (rule, ext) for rule in [self.get_pch_rule_name(lang, for_machine)] + for ext in ['', '_RSP']] compdb_options = ['-x'] if mesonlib.version_compare(self.ninja_version, '>=1.9') else [] ninja_compdb = [self.ninja_command, '-t', 'compdb'] + compdb_options + rules builddir = self.environment.get_build_dir() @@ -990,7 +990,7 @@ def generate_coverage_command(self, elem, outputs): self.build.get_subproject_dir()), self.environment.get_build_dir(), self.environment.get_log_dir()] + - (['--use_llvm_cov'] if use_llvm_cov else [])) + (['--use_llvm_cov'] if use_llvm_cov else [])) def generate_coverage_rules(self): e = NinjaBuildElement(self.all_outputs, 'meson-coverage', 'CUSTOM_COMMAND', 'PHONY') @@ -1560,13 +1560,13 @@ def generate_rust_target(self, target): self.get_target_dir(target)) else: target_slashname_workaround_dir = self.get_target_dir(target) - (rpath_args, target.rpath_dirs_to_remove) = \ - rustc.build_rpath_args(self.environment, - self.environment.get_build_dir(), - target_slashname_workaround_dir, - self.determine_rpath_dirs(target), - target.build_rpath, - target.install_rpath) + rpath_args, target.rpath_dirs_to_remove = ( + rustc.build_rpath_args(self.environment, + self.environment.get_build_dir(), + target_slashname_workaround_dir, + self.determine_rpath_dirs(target), + target.build_rpath, + target.install_rpath)) # ... but then add rustc's sysroot to account for rustup # installations for rpath_arg in rpath_args: @@ -2777,13 +2777,13 @@ def generate_link(self, target, outname, obj_list, linker, extra_args=None, stdl self.get_target_dir(target)) else: target_slashname_workaround_dir = self.get_target_dir(target) - (rpath_args, target.rpath_dirs_to_remove) = \ - linker.build_rpath_args(self.environment, - self.environment.get_build_dir(), - target_slashname_workaround_dir, - self.determine_rpath_dirs(target), - target.build_rpath, - target.install_rpath) + (rpath_args, target.rpath_dirs_to_remove) = ( + linker.build_rpath_args(self.environment, + self.environment.get_build_dir(), + target_slashname_workaround_dir, + self.determine_rpath_dirs(target), + target.build_rpath, + target.install_rpath)) commands += rpath_args # Add libraries generated by custom targets custom_target_libraries = self.get_custom_target_provided_libraries(target) @@ -3041,7 +3041,9 @@ def _scan_fortran_file_deps(src: Path, srcdir: Path, dirname: Path, tdeps, compi # included files incmatch = incre.match(line) if incmatch is not None: - incfile = srcdir / incmatch.group(1) + incfile = src.parent / incmatch.group(1) + # NOTE: src.parent is most general, in particular for CMake subproject with Fortran file + # having an `include 'foo.f'` statement. if incfile.suffix.lower()[1:] in compiler.file_suffixes: mod_files.extend(_scan_fortran_file_deps(incfile, srcdir, dirname, tdeps, compiler)) # modules
Crash with CMake subproject containing fortran sources **Describe the bug** While configuring a Meson project with a CMake subproject I get this: ``` Build targets in project: 255 PHARE 0.0.1 Subprojects SAMRAI: YES Found ninja-1.10.1 at /usr/bin/ninja Traceback (most recent call last): File "/home/jeandet/Documents/prog/meson/mesonbuild/mesonmain.py", line 140, in run return options.run_func(options) File "/home/jeandet/Documents/prog/meson/mesonbuild/msetup.py", line 245, in run app.generate() File "/home/jeandet/Documents/prog/meson/mesonbuild/msetup.py", line 159, in generate self._generate(env) File "/home/jeandet/Documents/prog/meson/mesonbuild/msetup.py", line 215, in _generate intr.backend.generate() File "/home/jeandet/Documents/prog/meson/mesonbuild/backend/ninjabackend.py", line 514, in generate self.generate_target(t) File "/home/jeandet/Documents/prog/meson/mesonbuild/backend/ninjabackend.py", line 832, in generate_target obj_list.append(self.generate_single_compile(target, src, False, [], header_deps)) File "/home/jeandet/Documents/prog/meson/mesonbuild/backend/ninjabackend.py", line 2390, in generate_single_compile extra_deps += self.get_fortran_deps(compiler, abs_src, target) File "/home/jeandet/Documents/prog/meson/mesonbuild/backend/ninjabackend.py", line 2092, in get_fortran_deps mod_files = _scan_fortran_file_deps(src, srcdir, dirname, tdeps, compiler) File "/home/jeandet/Documents/prog/meson/mesonbuild/backend/ninjabackend.py", line 3046, in _scan_fortran_file_deps mod_files.extend(_scan_fortran_file_deps(incfile, srcdir, dirname, tdeps, compiler)) File "/home/jeandet/Documents/prog/meson/mesonbuild/backend/ninjabackend.py", line 3039, in _scan_fortran_file_deps with src.open(encoding='ascii', errors='ignore') as f: File "/usr/lib64/python3.8/pathlib.py", line 1218, in open return io.open(self, mode, buffering, encoding, errors, newline, File "/usr/lib64/python3.8/pathlib.py", line 1074, in _opener return self._accessor.open(self, flags, mode) FileNotFoundError: [Errno 2] No such file or directory: '/home/jeandet/Documents/prog/PHARE/bc_common.f' ``` Where top project PHARE has no Fortran sources, so this might have leaked form SAMRAI subproject, maybe missing subproject path? **To Reproduce** ``` git clone -b meson-is-cool https://github.com/jeandet/PHARE meson PHARE build ``` **system parameters** * Native build * Fedora 32 * Python 3.8.5 * Meson 0.55.1 and master * Ninja 1.10.1
2020-09-03T03:19:27Z
[]
[]
Traceback (most recent call last): File "/home/jeandet/Documents/prog/meson/mesonbuild/mesonmain.py", line 140, in run return options.run_func(options) File "/home/jeandet/Documents/prog/meson/mesonbuild/msetup.py", line 245, in run app.generate() File "/home/jeandet/Documents/prog/meson/mesonbuild/msetup.py", line 159, in generate self._generate(env) File "/home/jeandet/Documents/prog/meson/mesonbuild/msetup.py", line 215, in _generate intr.backend.generate() File "/home/jeandet/Documents/prog/meson/mesonbuild/backend/ninjabackend.py", line 514, in generate self.generate_target(t) File "/home/jeandet/Documents/prog/meson/mesonbuild/backend/ninjabackend.py", line 832, in generate_target obj_list.append(self.generate_single_compile(target, src, False, [], header_deps)) File "/home/jeandet/Documents/prog/meson/mesonbuild/backend/ninjabackend.py", line 2390, in generate_single_compile extra_deps += self.get_fortran_deps(compiler, abs_src, target) File "/home/jeandet/Documents/prog/meson/mesonbuild/backend/ninjabackend.py", line 2092, in get_fortran_deps mod_files = _scan_fortran_file_deps(src, srcdir, dirname, tdeps, compiler) File "/home/jeandet/Documents/prog/meson/mesonbuild/backend/ninjabackend.py", line 3046, in _scan_fortran_file_deps mod_files.extend(_scan_fortran_file_deps(incfile, srcdir, dirname, tdeps, compiler)) File "/home/jeandet/Documents/prog/meson/mesonbuild/backend/ninjabackend.py", line 3039, in _scan_fortran_file_deps with src.open(encoding='ascii', errors='ignore') as f: File "/usr/lib64/python3.8/pathlib.py", line 1218, in open return io.open(self, mode, buffering, encoding, errors, newline, File "/usr/lib64/python3.8/pathlib.py", line 1074, in _opener return self._accessor.open(self, flags, mode) FileNotFoundError: [Errno 2] No such file or directory: '/home/jeandet/Documents/prog/PHARE/bc_common.f'
9,476
mesonbuild/meson
mesonbuild__meson-772
49583ccfabcc3db057521bf2801f75f5bab94e0e
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -139,7 +139,13 @@ def get_data(self, url): else: resp = urllib.request.urlopen(url) with contextlib.closing(resp) as resp: - dlsize = int(resp.info()['Content-Length']) + try: + dlsize = int(resp.info()['Content-Length']) + except TypeError: + dlsize = None + if dlsize is None: + print('Downloading file of unknown size.') + return resp.read() print('Download size:', dlsize) print('Downloading: ', end='') sys.stdout.flush()
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' ``` Dowloading json from https://github.com/nlohmann/json/archive/v2.0.3.tar.gz Traceback (most recent call last): File "/usr/lib/python3.5/site-packages/mesonbuild/mesonmain.py", line 283, in run app.generate() File "/usr/lib/python3.5/site-packages/mesonbuild/mesonmain.py", line 166, in generate intr.run() File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1154, in run self.evaluate_codeblock(self.ast) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1176, in evaluate_codeblock raise e File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1170, in evaluate_codeblock self.evaluate_statement(cur) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1293, in evaluate_statement return self.assignment(cur) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 2208, in assignment value = self.evaluate_statement(node.value) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1291, in evaluate_statement return self.function_call(cur) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 2189, in function_call return self.funcs[func_name](node, self.flatten(posargs), kwargs) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 73, in wrapped return f(self, node, args, kwargs) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1374, in func_subproject return self.do_subproject(dirname, kwargs) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1388, in do_subproject resolved = r.resolve(dirname) File "/usr/lib/python3.5/site-packages/mesonbuild/wrap/wrap.py", line 103, in resolve self.download(p, packagename) File "/usr/lib/python3.5/site-packages/mesonbuild/wrap/wrap.py", line 172, in download srcdata = self.get_data(srcurl) File "/usr/lib/python3.5/site-packages/mesonbuild/wrap/wrap.py", line 137, in get_data dlsize = int(resp.info()['Content-Length']) TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' + ninja ninja: error: loading 'build.ninja': No such file or directory + ninja ninja: error: loading 'build.ninja': No such file or directory ```
Has happened several times on local dev and on CI too.
2016-09-09T19:12:51Z
[]
[]
Traceback (most recent call last): File "/usr/lib/python3.5/site-packages/mesonbuild/mesonmain.py", line 283, in run app.generate() File "/usr/lib/python3.5/site-packages/mesonbuild/mesonmain.py", line 166, in generate intr.run() File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1154, in run self.evaluate_codeblock(self.ast) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1176, in evaluate_codeblock raise e File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1170, in evaluate_codeblock self.evaluate_statement(cur) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1293, in evaluate_statement return self.assignment(cur) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 2208, in assignment value = self.evaluate_statement(node.value) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1291, in evaluate_statement return self.function_call(cur) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 2189, in function_call return self.funcs[func_name](node, self.flatten(posargs), kwargs) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 73, in wrapped return f(self, node, args, kwargs) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1374, in func_subproject return self.do_subproject(dirname, kwargs) File "/usr/lib/python3.5/site-packages/mesonbuild/interpreter.py", line 1388, in do_subproject resolved = r.resolve(dirname) File "/usr/lib/python3.5/site-packages/mesonbuild/wrap/wrap.py", line 103, in resolve self.download(p, packagename) File "/usr/lib/python3.5/site-packages/mesonbuild/wrap/wrap.py", line 172, in download srcdata = self.get_data(srcurl) File "/usr/lib/python3.5/site-packages/mesonbuild/wrap/wrap.py", line 137, in get_data dlsize = int(resp.info()['Content-Length']) TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'
9,479
mesonbuild/meson
mesonbuild__meson-7958
5dd174c60b209aff2eef8fa38c12cc8a3c6753db
diff --git a/mesonbuild/compilers/mixins/emscripten.py b/mesonbuild/compilers/mixins/emscripten.py --- a/mesonbuild/compilers/mixins/emscripten.py +++ b/mesonbuild/compilers/mixins/emscripten.py @@ -50,7 +50,7 @@ def thread_flags(self, env: 'Environment') -> T.List[str]: def thread_link_flags(self, env: 'Environment') -> T.List[str]: args = ['-s', 'USE_PTHREADS=1'] - count = env.coredata.compiler_options[self.for_machine]['{}_thread_count'.format(self.language)].value # type: int + count = env.coredata.compiler_options[self.for_machine][self.language]['thread_count'].value # type: int if count: args.extend(['-s', 'PTHREAD_POOL_SIZE={}'.format(count)]) return args @@ -58,7 +58,7 @@ def thread_link_flags(self, env: 'Environment') -> T.List[str]: def get_options(self) -> 'coredata.OptionDictType': opts = super().get_options() opts.update({ - '{}_thread_count'.format(self.language): coredata.UserIntegerOption( + 'thread_count': coredata.UserIntegerOption( 'Number of threads to use in web assembly, set to 0 to disable', (0, None, 4), # Default was picked at random ),
AttributeError with Emscripten since Meson 0.56.0 **Describe the bug** Meson raises this `AttributeError` when cross-building glib with Emscripten. ``` Checking if "atomic ops define" compiles: NO Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/mesonbuild/mesonmain.py", line 140, in run return options.run_func(options) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/msetup.py", line 253, in run app.generate() File "/usr/local/lib/python3.7/dist-packages/mesonbuild/msetup.py", line 161, in generate self._generate(env) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/msetup.py", line 200, in _generate intr.run() File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreter.py", line 4703, in run super().run() File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 519, in run self.evaluate_codeblock(self.ast, start=1) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 544, in evaluate_codeblock raise e File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 537, in evaluate_codeblock self.evaluate_statement(cur) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 560, in evaluate_statement return self.evaluate_if(cur) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 647, in evaluate_if self.evaluate_codeblock(node.elseblock) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 544, in evaluate_codeblock raise e File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 537, in evaluate_codeblock self.evaluate_statement(cur) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 552, in evaluate_statement self.assignment(cur) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 1219, in assignment value = self.evaluate_statement(node.value) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 550, in evaluate_statement return self.function_call(cur) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 909, in function_call return func(node, func_args, kwargs) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 393, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 393, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 393, in wrapped return f(*wrapped_args, **wrapped_kwargs) [Previous line repeated 3 more times] File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 209, in wrapped ret = f(*wrapped_args, **wrapped_kwargs) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 228, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreter.py", line 3719, in func_dependency d = self.dependency_impl(name, display_name, kwargs) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreter.py", line 3813, in dependency_impl dep = dependencies.find_external_dependency(name, self.environment, kwargs) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/dependencies/base.py", line 2392, in find_external_dependency d = c() File "/usr/local/lib/python3.7/dist-packages/mesonbuild/dependencies/misc.py", line 118, in __init__ self.link_args = self.clib_compiler.thread_link_flags(environment) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/compilers/mixins/emscripten.py", line 53, in thread_link_flags count = env.coredata.compiler_options[self.for_machine]['{}_thread_count'.format(self.language)].value # type: int AttributeError: 'dict' object has no attribute 'value' ``` Reverting to Meson 0.55.3 or applying this patch seems to fix it: ```diff diff --git a/mesonbuild/compilers/mixins/emscripten.py b/mesonbuild/compilers/mixins/emscripten.py index 1111111..2222222 100644 --- a/mesonbuild/compilers/mixins/emscripten.py +++ b/mesonbuild/compilers/mixins/emscripten.py @@ -50,7 +50,7 @@ class EmscriptenMixin(Compiler): def thread_link_flags(self, env: 'Environment') -> T.List[str]: args = ['-s', 'USE_PTHREADS=1'] - count = env.coredata.compiler_options[self.for_machine]['{}_thread_count'.format(self.language)].value # type: int + count = env.coredata.compiler_options[self.for_machine][self.language]['thread_count'].value # type: int if count: args.extend(['-s', 'PTHREAD_POOL_SIZE={}'.format(count)]) return args @@ -58,7 +58,7 @@ class EmscriptenMixin(Compiler): def get_options(self) -> 'coredata.OptionDictType': opts = super().get_options() opts.update({ - '{}_thread_count'.format(self.language): coredata.UserIntegerOption( + 'thread_count': coredata.UserIntegerOption( 'Number of threads to use in web assembly, set to 0 to disable', (0, None, 4), # Default was picked at random ), ``` **To Reproduce** ```bash git clone https://github.com/kleisauke/wasm-vips.git cd wasm-vips docker build -t wasm-vips . docker run --rm -v $(pwd):/src wasm-vips ./build.sh -e node --enable-simd ``` (If you want, I could make a minimal reproduction) **Expected behavior** Successful build (like Meson 0.55.3). **system parameters** * Docker cross build (emscripten) * Debian 10.6 (buster) * Python 3.7.3 * meson 0.56.0 (https://github.com/mesonbuild/meson/commit/f16d31607eb3cd0f281758bd0944e206ef6be387) * Ninja 1.8.2
Here's a simplified minimal reproduction: ```bash # Download and install the latest tagged Emscripten release # See https://emscripten.org/docs/getting_started/downloads.html#installation-instructions cd ~ git clone https://github.com/emscripten-core/emsdk.git cd emsdk ./emsdk install latest ./emsdk activate latest source ./emsdk_env.sh # Reproduce the above AttributeError cd ~ git clone https://github.com/mesonbuild/meson cd "meson/test cases/wasm/2 threads" curl -LO https://github.com/kleisauke/wasm-vips/raw/master/build/emscripten-crossfile.meson meson setup _build --cross-file=emscripten-crossfile.meson --default-library=static --buildtype=release emmake ninja -C _build ```
2020-11-09T17:09:17Z
[]
[]
Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/mesonbuild/mesonmain.py", line 140, in run return options.run_func(options) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/msetup.py", line 253, in run app.generate() File "/usr/local/lib/python3.7/dist-packages/mesonbuild/msetup.py", line 161, in generate self._generate(env) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/msetup.py", line 200, in _generate intr.run() File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreter.py", line 4703, in run super().run() File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 519, in run self.evaluate_codeblock(self.ast, start=1) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 544, in evaluate_codeblock raise e File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 537, in evaluate_codeblock self.evaluate_statement(cur) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 560, in evaluate_statement return self.evaluate_if(cur) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 647, in evaluate_if self.evaluate_codeblock(node.elseblock) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 544, in evaluate_codeblock raise e File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 537, in evaluate_codeblock self.evaluate_statement(cur) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 552, in evaluate_statement self.assignment(cur) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 1219, in assignment value = self.evaluate_statement(node.value) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 550, in evaluate_statement return self.function_call(cur) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 909, in function_call return func(node, func_args, kwargs) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 393, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 393, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 393, in wrapped return f(*wrapped_args, **wrapped_kwargs) [Previous line repeated 3 more times] File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 209, in wrapped ret = f(*wrapped_args, **wrapped_kwargs) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreterbase.py", line 228, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreter.py", line 3719, in func_dependency d = self.dependency_impl(name, display_name, kwargs) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/interpreter.py", line 3813, in dependency_impl dep = dependencies.find_external_dependency(name, self.environment, kwargs) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/dependencies/base.py", line 2392, in find_external_dependency d = c() File "/usr/local/lib/python3.7/dist-packages/mesonbuild/dependencies/misc.py", line 118, in __init__ self.link_args = self.clib_compiler.thread_link_flags(environment) File "/usr/local/lib/python3.7/dist-packages/mesonbuild/compilers/mixins/emscripten.py", line 53, in thread_link_flags count = env.coredata.compiler_options[self.for_machine]['{}_thread_count'.format(self.language)].value # type: int AttributeError: 'dict' object has no attribute 'value'
9,499
mesonbuild/meson
mesonbuild__meson-7978
d4cd0ceb9d4efcd0f376db3e10405a7160fd5c41
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -266,7 +266,7 @@ def length_estimate(self, infiles, outfiles, elems): # expand variables in command command = ' '.join([self._quoter(x) for x in self.command + self.args]) estimate = len(command) - for m in re.finditer(r'(\${\w*}|\$\w*)?[^$]*', command): + for m in re.finditer(r'(\${\w+}|\$\w+)?[^$]*', command): if m.start(1) != -1: estimate -= m.end(1) - m.start(1) + 1 chunk = m.group(1)
[meson 0.56] Cannot handle spaces in [binaries] paths / string index out of range in ninjabackend.py **Describe the bug** ``` Traceback (most recent call last): File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\mesonmain.py", line 140, in run return options.run_func(options) File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\msetup.py", line 253, in run app.generate() File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\msetup.py", line 161, in generate self._generate(env) File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\msetup.py", line 223, in _generate intr.backend.generate() File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 533, in generate self.write_rules(outfile) File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 1122, in write_rules b.count_rule_references() File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 342, in count_rule_references if self._should_use_rspfile(): File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 336, in _should_use_rspfile return self.rule.length_estimate(infilenames, File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 273, in length_estimate if chunk[1] == '{': IndexError: string index out of range ```
added a `print(command)` in line 269 before the for loop and a `print(m)` in the loop. The output is: ``` "C:/Program$ Files$ (x86)/Microsoft$ Visual$ Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe" $ARGS /Fo$out "/c" $in <re.Match object; span=(0, 11), match='"C:/Program'> <re.Match object; span=(11, 18), match='$ Files'> ``` Also it worked fine with meson 0.55.1 the important parts of the native file: ``` [binaries] mt = 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x64/mt.exe' c = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe' cpp = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe' rc = 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x64/rc.exe' c_ld = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/link.exe' cpp_ld = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/link.exe' cmake = 'C:/Program Files/CMake/bin/cmake.exe' ``` The regex should probably be: `for m in re.finditer(r'(\${\w+}|\$\w+)?[^$]*', command):` and not `for m in re.finditer(r'(\${\w*}|\$\w*)?[^$]*', command):` cc @bonzini
2020-11-13T14:16:03Z
[]
[]
Traceback (most recent call last): File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\mesonmain.py", line 140, in run return options.run_func(options) File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\msetup.py", line 253, in run app.generate() File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\msetup.py", line 161, in generate self._generate(env) File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\msetup.py", line 223, in _generate intr.backend.generate() File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 533, in generate self.write_rules(outfile) File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 1122, in write_rules b.count_rule_references() File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 342, in count_rule_references if self._should_use_rspfile(): File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 336, in _should_use_rspfile return self.rule.length_estimate(infilenames, File "E:\vcpkg_cache\downloads\tools\meson\meson-0.56.0\mesonbuild\backend\ninjabackend.py", line 273, in length_estimate if chunk[1] == '{': IndexError: string index out of range
9,501
mesonbuild/meson
mesonbuild__meson-8071
8d04b3ce745821b18c78ba5ee19e4f00726d8d89
diff --git a/mesonbuild/compilers/mixins/clang.py b/mesonbuild/compilers/mixins/clang.py --- a/mesonbuild/compilers/mixins/clang.py +++ b/mesonbuild/compilers/mixins/clang.py @@ -19,7 +19,7 @@ import typing as T from ... import mesonlib -from ...linkers import AppleDynamicLinker +from ...linkers import AppleDynamicLinker, ClangClDynamicLinker from ..compilers import CompileCheckMode from .gnu import GnuLikeCompiler @@ -108,6 +108,12 @@ def openmp_flags(self) -> T.List[str]: else: # Shouldn't work, but it'll be checked explicitly in the OpenMP dependency. return [] + + def get_win_subsystem_args(self, value: str) -> T.List[str]: + if self.info.is_windows() and not self.info.is_cygwin() and isinstance(self.linker, ClangClDynamicLinker): + return [f'-Wl,/subsystem:{value}'] + + return super().get_win_subsystem_args(value) @classmethod def use_linker_args(cls, linker: str) -> T.List[str]: diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -940,6 +940,10 @@ def _guess_win_linker(self, compiler: T.List[str], comp_class: Compiler, return LLVMDynamicLinker( compiler, for_machine, comp_class.LINKER_PREFIX, override, version=search_version(o)) + elif not invoked_directly: + return ClangClDynamicLinker( + for_machine, override, exelist=compiler, prefix=comp_class.LINKER_PREFIX, + version=search_version(o), direct=False, machine=None) if value is not None and invoked_directly: compiler = value @@ -1236,7 +1240,7 @@ def sanitize(p): # style ld, but for clang on "real" windows we'll use # either link.exe or lld-link.exe try: - linker = self._guess_win_linker(compiler, cls, for_machine) + linker = self._guess_win_linker(compiler, cls, for_machine, invoked_directly=False) except MesonException: pass if linker is None: diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py --- a/mesonbuild/linkers.py +++ b/mesonbuild/linkers.py @@ -1164,6 +1164,14 @@ def __init__(self, for_machine: mesonlib.MachineChoice, always_args: T.List[str] super().__init__(exelist or ['lld-link.exe'], for_machine, prefix, always_args, machine=machine, version=version, direct=direct) + def get_output_args(self, outputname: str) -> T.List[str]: + # If we're being driven indirectly by clang just skip /MACHINE + # as clang's target triple will handle the machine selection + if self.machine is None: + return self._apply_prefix([f"/OUT:{outputname}"]) + + return super().get_output_args(outputname) + class XilinkDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):
Cross-compilation from Apple Silicon macOS Big Sur **Describe the bug** Meson's cross-compilation capabilities don't seem to work properly on Apple Silicon build machines. Describing the bug specifically is a little difficult because there are a couple of outcomes that, to me, seem non-sensical. The toolchain I'm using is a from-git build of Clang 12.0.0 including LLD. The clang build has its default target triple adjusted to `x86_64-unknown-windows-msvc` and default linker set to `lld`. * Scenario 1: Meson configures the project but fails to detect the host machine cpu properly, instead marking the target cpu as `x86_64` ``` C compiler for the host machine: /usr/local/cross/x86_64-unknown-windows-msvc/bin/clang (clang 12.0.0 "e820 clang version 12.0.0 ([email protected]:llvm/llvm-project.git 80e326a8c4cfae770c10d7bb3d0ae291011bd91f)") C linker for the host machine: /usr/local/cross/x86_64-unknown-windows-msvc/bin/clang ld64 unknown version C compiler for the build machine: cc (clang 12.0.0 "Apple clang version 12.0.0 (clang-1200.0.32.27)") C linker for the build machine: cc ld64 609.7 Build machine cpu family: aarch64 Build machine cpu: arm64 Host machine cpu family: aarch64 Host machine cpu: arm64 Target machine cpu family: x86_64 Target machine cpu: x86_64 Build targets in project: 1 ``` * Scenario 2: Adding `c_ld=lld` to the `binaries` section of the cross-file crashes meson with a `file not found` exception even though meson shouldn't treat it as a filename, instead passing it to clang via `-fuse-ld=lld` ``` Traceback (most recent call last): File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/mesonmain.py", line 140, in run return options.run_func(options) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/msetup.py", line 253, in run app.generate() File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/msetup.py", line 161, in generate self._generate(env) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/msetup.py", line 178, in _generate intr = interpreter.Interpreter(b) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreter.py", line 2427, in __init__ self.parse_project() File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreterbase.py", line 504, in parse_project self.evaluate_codeblock(self.ast, end=1) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreterbase.py", line 544, in evaluate_codeblock raise e File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreterbase.py", line 537, in evaluate_codeblock self.evaluate_statement(cur) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreterbase.py", line 550, in evaluate_statement return self.function_call(cur) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreterbase.py", line 909, in function_call return func(node, func_args, kwargs) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreterbase.py", line 197, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreterbase.py", line 228, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreter.py", line 3201, in func_project self.add_languages(proj_langs, True, MachineChoice.HOST) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreter.py", line 3325, in add_languages success = self.add_languages_for(args, required, for_machine) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreter.py", line 3357, in add_languages_for comp = self.environment.detect_compiler_for(lang, for_machine) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/environment.py", line 1860, in detect_compiler_for comp = self.compiler_from_language(lang, for_machine) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/environment.py", line 1832, in compiler_from_language comp = self.detect_c_compiler(for_machine) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/environment.py", line 1334, in detect_c_compiler return self._detect_c_or_cpp_compiler('c', for_machine) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/environment.py", line 1228, in _detect_c_or_cpp_compiler linker = self._guess_win_linker(compiler, cls, for_machine) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/environment.py", line 945, in _guess_win_linker p, o, e = Popen_safe(compiler + check_args) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/mesonlib.py", line 1217, in Popen_safe p = subprocess.Popen(args, universal_newlines=True, close_fds=False, File "/opt/homebrew/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 947, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/opt/homebrew/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1819, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'lld' ``` * Scenario 3 (only valid if `win_subsystem` is included): Meson reports that the `efi_application` subsystem isn't supported for MinGW even though I'm running clang on macOS ``` C compiler for the host machine: /usr/local/cross/x86_64-unknown-windows-msvc/bin/clang (clang 12.0.0 "e820 clang version 12.0.0 ([email protected]:llvm/llvm-project.git 80e326a8c4cfae770c10d7bb3d0ae291011bd91f)") C linker for the host machine: /usr/local/cross/x86_64-unknown-windows-msvc/bin/clang ld64 unknown version C compiler for the build machine: cc (clang 12.0.0 "Apple clang version 12.0.0 (clang-1200.0.32.27)") C linker for the build machine: cc ld64 609.7 Build machine cpu family: aarch64 Build machine cpu: arm64 Host machine cpu family: aarch64 Host machine cpu: arm64 Target machine cpu family: x86_64 Target machine cpu: x86_64 Build targets in project: 1 Found ninja-1.10.2 at /opt/homebrew/bin/ninja ERROR: Only "windows" and "console" are supported for win_subsystem with MinGW, not "efi_application". ``` **To Reproduce** Project Meson file & cross-file attached. **Expected behavior** Host-machine cpu family & host-machine cpu should be detected as `x86_64` as specified in the cross-file instead of `aarch64` & `arm64` respectively. When using `win_subsystem` Meson generates `-Wl,-subsystem:efi_application` instead of throwing a configuration error. **System Parameters** * Cross-compilation from aarch64 macOS to x86_64 Windows * macOS Big Sur * Python 3.9.0 * Meson 0.56 * Ninja 1.10.2 [meson.txt](https://github.com/mesonbuild/meson/files/5640628/meson.txt) [clang.txt](https://github.com/mesonbuild/meson/files/5640631/clang.txt)
This check seems to be bogus: ```python def get_win_subsystem_args(self, value: str) -> T.List[str]: args = [] if self.info.is_windows() or self.info.is_cygwin(): if 'windows' in value: args = ['-Wl,--subsystem,windows'] elif 'console' in value: args = ['-Wl,--subsystem,console'] else: raise mesonlib.MesonException('Only "windows" and "console" are supported for win_subsystem with MinGW, not "{}".'.format(value)) if ',' in value: args[-1] = args[-1] + ':' + value.split(',')[1] return args ``` Clang with the GNU compatible driver can invoke `lld-link` to build EFI targets just fine. I'm not sure about MinGW specifically but since this applies to cross-compilations completely unrelated to MinGW as in my case above, this should probably be adjusted. As an example on my Apple Silicon build machine: ```sh /opt/homebrew/Cellar/llvm/11.0.0/bin/clang -target x86_64-unknown-windows-msvc -ffreestanding -fshort-wchar -mno-red-zone -nostdlib -c ../src/main.c /opt/homebrew/Cellar/llvm/11.0.0/bin/clang -target x86_64-unknown-windows-msvc -fuse-ld=lld -nostdlib -Wl,-entry:efi_main -Wl,-subsystem:efi_application -o owl.efi main.o ``` These two invocations successfully compile an EFI application. *EDIT*: The argument syntax used here isn't valid for `lld-link` either since it only accepts the `link.exe` style flags, granted using the GNU style `-` prefix instead of `/` is also supported as illustrated in the example above.
2020-12-07T07:04:21Z
[]
[]
Traceback (most recent call last): File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/mesonmain.py", line 140, in run return options.run_func(options) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/msetup.py", line 253, in run app.generate() File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/msetup.py", line 161, in generate self._generate(env) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/msetup.py", line 178, in _generate intr = interpreter.Interpreter(b) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreter.py", line 2427, in __init__ self.parse_project() File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreterbase.py", line 504, in parse_project self.evaluate_codeblock(self.ast, end=1) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreterbase.py", line 544, in evaluate_codeblock raise e File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreterbase.py", line 537, in evaluate_codeblock self.evaluate_statement(cur) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreterbase.py", line 550, in evaluate_statement return self.function_call(cur) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreterbase.py", line 909, in function_call return func(node, func_args, kwargs) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreterbase.py", line 197, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreterbase.py", line 228, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreter.py", line 3201, in func_project self.add_languages(proj_langs, True, MachineChoice.HOST) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreter.py", line 3325, in add_languages success = self.add_languages_for(args, required, for_machine) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/interpreter.py", line 3357, in add_languages_for comp = self.environment.detect_compiler_for(lang, for_machine) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/environment.py", line 1860, in detect_compiler_for comp = self.compiler_from_language(lang, for_machine) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/environment.py", line 1832, in compiler_from_language comp = self.detect_c_compiler(for_machine) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/environment.py", line 1334, in detect_c_compiler return self._detect_c_or_cpp_compiler('c', for_machine) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/environment.py", line 1228, in _detect_c_or_cpp_compiler linker = self._guess_win_linker(compiler, cls, for_machine) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/environment.py", line 945, in _guess_win_linker p, o, e = Popen_safe(compiler + check_args) File "/opt/homebrew/Cellar/meson/0.56.0/lib/python3.9/site-packages/mesonbuild/mesonlib.py", line 1217, in Popen_safe p = subprocess.Popen(args, universal_newlines=True, close_fds=False, File "/opt/homebrew/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 947, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/opt/homebrew/Cellar/[email protected]/3.9.0_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1819, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'lld'
9,506
mesonbuild/meson
mesonbuild__meson-8158
c64d4070763b2daf82a50a7b4f5b130b2bb91062
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -45,7 +45,7 @@ ) from ..mesonlib import get_compiler_for_source, has_path_sep, OptionKey from .backends import CleanTrees -from ..build import InvalidArguments +from ..build import GeneratedList, InvalidArguments from ..interpreter import Interpreter if T.TYPE_CHECKING: @@ -691,13 +691,6 @@ def create_target_source_introspection(self, target: build.Target, comp: compile src_block['sources'] += sources src_block['generated_sources'] += generated_sources - def is_rust_target(self, target): - if len(target.sources) > 0: - first_file = target.sources[0] - if first_file.fname.endswith('.rs'): - return True - return False - def generate_target(self, target): try: if isinstance(target, build.BuildTarget): @@ -723,7 +716,7 @@ def generate_target(self, target): if isinstance(target, build.Jar): self.generate_jar_target(target) return - if self.is_rust_target(target): + if target.uses_rust(): self.generate_rust_target(target) return if 'cs' in target.compilers: @@ -1588,12 +1581,27 @@ def generate_rust_target(self, target: build.BuildTarget) -> None: args = rustc.compiler_args() # Compiler args for compiling this target args += compilers.get_base_compile_args(base_proxy, rustc) + self.generate_generator_list_rules(target) + + orderdeps = [os.path.join(t.subdir, t.get_filename()) for t in target.link_targets] + main_rust_file = None for i in target.get_sources(): if not rustc.can_compile(i): raise InvalidArguments('Rust target {} contains a non-rust source file.'.format(target.get_basename())) if main_rust_file is None: main_rust_file = i.rel_to_builddir(self.build_to_src) + for g in target.get_generated_sources(): + for i in g.get_outputs(): + if not rustc.can_compile(i): + raise InvalidArguments('Rust target {} contains a non-rust source file.'.format(target.get_basename())) + if isinstance(g, GeneratedList): + fname = os.path.join(self.get_target_private_dir(target), i) + else: + fname = i + if main_rust_file is None: + main_rust_file = fname + orderdeps.append(fname) if main_rust_file is None: raise RuntimeError('A Rust target has no Rust sources. This is weird. Also a bug. Please report') target_name = os.path.join(target.subdir, target.get_filename()) @@ -1631,7 +1639,6 @@ def generate_rust_target(self, target: build.BuildTarget) -> None: args += target.get_extra_args('rust') args += rustc.get_output_args(os.path.join(target.subdir, target.get_filename())) args += self.environment.coredata.get_external_args(target.for_machine, rustc.language) - orderdeps = [os.path.join(t.subdir, t.get_filename()) for t in target.link_targets] linkdirs = OrderedDict() for d in target.link_targets: linkdirs[d.subdir] = True @@ -1678,7 +1685,7 @@ def generate_rust_target(self, target: build.BuildTarget) -> None: args += ['-C', 'link-arg=' + rpath_arg + ':' + os.path.join(rustc.get_sysroot(), 'lib')] compiler_name = self.get_compiler_rule_name('rust', target.for_machine) element = NinjaBuildElement(self.all_outputs, target_name, compiler_name, main_rust_file) - if len(orderdeps) > 0: + if orderdeps: element.add_orderdep(orderdeps) element.add_item('ARGS', args) element.add_item('targetdep', depfile) diff --git a/mesonbuild/build.py b/mesonbuild/build.py --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -569,7 +569,7 @@ def __init__(self, name: str, subdir: str, subproject: str, for_machine: Machine unity_opt = environment.coredata.get_option(OptionKey('unity')) self.is_unity = unity_opt == 'on' or (unity_opt == 'subprojects' and subproject != '') self.environment = environment - self.sources = [] + self.sources: T.List[File] = [] self.compilers = OrderedDict() # type: OrderedDict[str, Compiler] self.objects = [] self.external_deps = [] @@ -588,7 +588,7 @@ def __init__(self, name: str, subdir: str, subproject: str, for_machine: Machine self.need_install = False self.pch = {} self.extra_args: T.Dict[str, T.List['FileOrString']] = {} - self.generated = [] + self.generated: T.Sequence[T.Union[GeneratedList, CustomTarget, CustomTargetIndex]] = [] self.d_features = {} self.pic = False self.pie = False @@ -1412,9 +1412,16 @@ def get_clink_dynamic_linker_and_stdlibs(self): m = 'Could not get a dynamic linker for build target {!r}' raise AssertionError(m.format(self.name)) - def get_using_rustc(self) -> bool: + def uses_rust(self) -> bool: """Is this target a rust target.""" - return self.sources and self.sources[0].fname.endswith('.rs') + if self.sources: + first_file = self.sources[0] + if first_file.fname.endswith('.rs'): + return True + elif self.generated: + if self.generated[0].get_outputs()[0].endswith('.rs'): + return True + return False def get_using_msvc(self): ''' @@ -1434,11 +1441,13 @@ def get_using_msvc(self): 2. If the target contains only objects, process_compilers guesses and picks the first compiler that smells right. ''' - compiler, _ = self.get_clink_dynamic_linker_and_stdlibs() + # Rustc can use msvc style linkers + if self.uses_rust(): + compiler = self.environment.coredata.compilers[self.for_machine]['rust'] + else: + compiler, _ = self.get_clink_dynamic_linker_and_stdlibs() # Mixing many languages with MSVC is not supported yet so ignore stdlibs. - if compiler and compiler.get_linker_id() in {'link', 'lld-link', 'xilink', 'optlink'}: - return True - return False + return compiler and compiler.get_linker_id() in {'link', 'lld-link', 'xilink', 'optlink'} def check_module_linking(self): ''' @@ -1687,7 +1696,7 @@ def __init__(self, name: str, subdir: str, subproject: str, for_machine: Machine self.import_filename = self.gcc_import_filename if m.is_windows() and ('cs' in self.compilers or - self.get_using_rustc() or + self.uses_rust() or self.get_using_msvc()): self.debug_filename = self.name + '.pdb' @@ -1877,7 +1886,7 @@ def determine_filenames(self, env): suffix = 'dll' self.vs_import_filename = '{0}{1}.lib'.format(self.prefix if self.prefix is not None else '', self.name) self.gcc_import_filename = '{0}{1}.dll.a'.format(self.prefix if self.prefix is not None else 'lib', self.name) - if self.get_using_rustc(): + if self.uses_rust(): # Shared library is of the form foo.dll prefix = '' # Import library is called foo.dll.lib diff --git a/mesonbuild/modules/unstable_rust.py b/mesonbuild/modules/unstable_rust.py --- a/mesonbuild/modules/unstable_rust.py +++ b/mesonbuild/modules/unstable_rust.py @@ -85,7 +85,7 @@ def test(self, state: 'ModuleState', args: T.List, kwargs: T.Dict[str, T.Any]) - base_target: BuildTarget = unholder(args[1]) if not isinstance(base_target, BuildTarget): raise InterpreterException('Second positional argument to rustmod.test() must be a library or executable') - if not base_target.get_using_rustc(): + if not base_target.uses_rust(): raise InterpreterException('Second positional argument to rustmod.test() must be a rust based target') extra_args = stringlistify(kwargs.get('args', []))
Failure when using CustomTarget with a Rust executable **Describe the bug** Using a CustomTarget as the only source of a Rust executable makes meson fail. **To Reproduce** The self-contained `meson.build` is: ``` project('proj', 'rust') main_rs = custom_target( 'main_rs', output: 'main.rs', capture: true, command: ['echo', 'fn main() { println!("hi") }' ], ) executable('main', [main_rs]) ``` Then fails at `meson build` with the following stack trace: ``` Found ninja-1.10.2 at /usr/bin/ninja Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/mesonbuild/mesonmain.py", line 140, in run return options.run_func(options) File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 253, in run app.generate() File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 161, in generate self._generate(env) File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 223, in _generate intr.backend.generate() File "/usr/lib/python3.8/site-packages/mesonbuild/backend/ninjabackend.py", line 519, in generate self.generate_target(t) File "/usr/lib/python3.8/site-packages/mesonbuild/backend/ninjabackend.py", line 842, in generate_target linker, stdlib_args = self.determine_linker_and_stdlib_args(target) File "/usr/lib/python3.8/site-packages/mesonbuild/backend/backends.py", line 465, in determine_linker_and_stdlib_args l, stdlib_args = target.get_clink_dynamic_linker_and_stdlibs() File "/usr/lib/python3.8/site-packages/mesonbuild/build.py", line 1325, in get_clink_dynamic_linker_and_stdlibs raise AssertionError(m.format(self.name)) AssertionError: Could not get a dynamic linker for build target 'main' ``` **Expected behavior** Expected success, and when executing `ninja -C build` an executable called `main` would be created. **Notes** After digging a bit it seems that generated sources are not taken into account by neither `is_rust_target` nor `generate_rust_target` in the ninjabackend. Failing to identify this as a rust target seems to be the main problem here. **System parameters** * Linux * Meson 0.56.0 * Ninja 1.10.2
Just be aware generating rust sources doesn't really work in general, because rust expects a unified build and source tree (because that's how cargo works). You need to copy all of your sources into the builddir by hand to make this work. Likely we'll eventually do that for you since upstream doesn't seem interested in fixing it.
2021-01-05T23:58:23Z
[]
[]
Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/mesonbuild/mesonmain.py", line 140, in run return options.run_func(options) File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 253, in run app.generate() File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 161, in generate self._generate(env) File "/usr/lib/python3.8/site-packages/mesonbuild/msetup.py", line 223, in _generate intr.backend.generate() File "/usr/lib/python3.8/site-packages/mesonbuild/backend/ninjabackend.py", line 519, in generate self.generate_target(t) File "/usr/lib/python3.8/site-packages/mesonbuild/backend/ninjabackend.py", line 842, in generate_target linker, stdlib_args = self.determine_linker_and_stdlib_args(target) File "/usr/lib/python3.8/site-packages/mesonbuild/backend/backends.py", line 465, in determine_linker_and_stdlib_args l, stdlib_args = target.get_clink_dynamic_linker_and_stdlibs() File "/usr/lib/python3.8/site-packages/mesonbuild/build.py", line 1325, in get_clink_dynamic_linker_and_stdlibs raise AssertionError(m.format(self.name)) AssertionError: Could not get a dynamic linker for build target 'main'
9,517
mesonbuild/meson
mesonbuild__meson-8437
b86ef3f85020eb8ed0e464a7653fa9e57cd527c2
diff --git a/packaging/createmsi.py b/packaging/createmsi.py --- a/packaging/createmsi.py +++ b/packaging/createmsi.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2017 The Meson development team +# Copyright 2017-2021 The Meson development team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -25,12 +25,14 @@ import sys import os from glob import glob -import platform import xml.etree.ElementTree as ET sys.path.append(os.getcwd()) from mesonbuild import coredata +# Elementtree does not support CDATA. So hack it. +WINVER_CHECK = '<![CDATA[Installed OR (VersionNT64 > 602)]]>' + def gen_guid(): ''' Generate guid @@ -77,8 +79,7 @@ def __init__(self): self.update_guid = '141527EE-E28A-4D14-97A4-92E6075D28B2' self.main_xml = 'meson.wxs' self.main_o = 'meson.wixobj' - self.bytesize = 32 if '32' in platform.architecture()[0] else 64 - self.final_output = 'meson-{}-{}.msi'.format(self.version, self.bytesize) + self.final_output = 'meson-{}-64.msi'.format(self.version) self.staging_dirs = ['dist', 'dist2'] self.progfile_dir = 'ProgramFiles64Folder' redist_glob = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Redist\\MSVC\\v*\\MergeModules\\Microsoft_VC142_CRT_x64.msm' @@ -141,6 +142,7 @@ def get_more_modules(): 'distutils.version', 'distutils.command.build_ext', 'distutils.command.build', + 'filecmp', ] def build_dist(self): @@ -206,11 +208,13 @@ def generate_files(self): 'SummaryCodepage': '1252', }) + condition = ET.SubElement(product, 'Condition', {'Message': 'This application is only supported on Windows 10 or higher.'}) + + condition.text = 'X'*len(WINVER_CHECK) ET.SubElement(product, 'MajorUpgrade', {'DowngradeErrorMessage': 'A newer version of Meson is already installed.'}) - if self.bytesize == 64: - package.set('Platform', 'x64') + package.set('Platform', 'x64') ET.SubElement(product, 'Media', { 'Id': '1', 'Cabinet': 'meson.cab', @@ -272,6 +276,12 @@ def generate_files(self): doc = xml.dom.minidom.parse(self.main_xml) with open(self.main_xml, 'w') as open_file: open_file.write(doc.toprettyxml()) + # One last fix, add CDATA. + with open(self.main_xml, 'r') as open_file: + data = open_file.read() + data = data.replace('X'*len(WINVER_CHECK), WINVER_CHECK) + with open(self.main_xml, 'w') as open_file: + open_file.write(data) def build_features(self, top_feature, staging_dir): ''' @@ -295,8 +305,7 @@ def create_xml(self, nodes, current_dir, parent_xml_node, staging_dir): 'Guid': gen_guid(), }) self.feature_components[staging_dir].append(component_id) - if self.bytesize == 64: - comp_xml_node.set('Win64', 'yes') + comp_xml_node.set('Win64', 'yes') if self.component_num == 0: ET.SubElement(comp_xml_node, 'Environment', { 'Id': 'Environment',
Problems building gtk4 on windows with 'msi meson' **Describe the bug** We've got this bug report that describes a failure to build gtk4 on windows using meson from the msi installer: https://gitlab.gnome.org/GNOME/gtk/-/issues/3701 **To Reproduce** - git clone https://gitlab.gnome.org/GNOME/gtk.git - cd gtk - meson setup . ..\gtk-build ``` Traceback (most recent call last): File "mesonbuild\mesonmain.py", line 132, in run File "mesonbuild\mesonmain.py", line 100, in run_runpython_command File "runpy.py", line 268, in run_path File "runpy.py", line 97, in _run_module_code File "runpy.py", line 87, in _run_code File "C:\Users\Aleksandr\gtk\gdk\gen-gdk-gresources-xml.py", line 8, in <module> import filecmp ModuleNotFoundError: No module named 'filecmp' ``` **Expected behavior** successful build, as with pip installed meson
PyInstaller likes to cut down on the size of a distributed application by stripping out stdlib modules which it heuristically detects are not being used. The script to create the .msi already overrides and forces inclusion for a bunch of modules that those heuristics get wrong for meson itself. https://github.com/mesonbuild/meson/blob/b86ef3f85020eb8ed0e464a7653fa9e57cd527c2/packaging/createmsi.py#L121-L144 Unfortunately that means it's very... suboptimal... for the case where the PyInstaller-installed application intends to additionally ship a full python interpreter capable of running arbitrary external scripts. And meson does try to use its own python interpreter to run .py programs used in a project build. I think this means the approach to packaging the .msi needs to be re-evaluated. Maybe there's some way to force PyInstaller to just bundle the entire python stdlib? Alternatively, pass a list of every single module in the stdlib to the current --hidden-imports code. Which does seem a bit meh for maintainability...
2021-02-28T11:30:40Z
[]
[]
Traceback (most recent call last): File "mesonbuild\mesonmain.py", line 132, in run File "mesonbuild\mesonmain.py", line 100, in run_runpython_command File "runpy.py", line 268, in run_path File "runpy.py", line 97, in _run_module_code File "runpy.py", line 87, in _run_code File "C:\Users\Aleksandr\gtk\gdk\gen-gdk-gresources-xml.py", line 8, in <module> import filecmp ModuleNotFoundError: No module named 'filecmp'
9,530
mesonbuild/meson
mesonbuild__meson-887
e2b3752f875754abcc3981754505ae0db9e18155
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1128,7 +1128,7 @@ def __init__(self, build, backend, subproject='', subdir='', subproject_dir='sub raise me self.sanity_check_ast() self.variables = {} - self.builtin = {} + self.builtin = {'meson': MesonMain(build, self)} self.generators = [] self.visited_subdirs = {} self.global_args_frozen = False @@ -1150,7 +1150,6 @@ def __init__(self, build, backend, subproject='', subdir='', subproject_dir='sub self.builtin['target_machine'] = CrossMachineInfo(cross_info.config['target_machine']) else: self.builtin['target_machine'] = self.builtin['host_machine'] - self.builtin['meson'] = MesonMain(build, self) self.build_def_files = [os.path.join(self.subdir, environment.build_filename)] def build_func_dict(self): @@ -1254,9 +1253,6 @@ def sanity_check_ast(self): first = self.ast.lines[0] if not isinstance(first, mparser.FunctionNode) or first.func_name != 'project': raise InvalidCode('First statement must be a call to project') - args = self.reduce_arguments(first.args)[0] - if len(args) < 2: - raise InvalidArguments('Not enough arguments to project(). Needs at least the project name and one language') def check_cross_stdlibs(self): @@ -1615,6 +1611,8 @@ def func_project(self, node, args, kwargs): self.build.project_name = args[0] if self.environment.first_invocation and 'default_options' in kwargs: self.parse_default_options(kwargs['default_options']) + if len(args) < 2: + raise InvalidArguments('Not enough arguments to project(). Needs at least the project name and one language') self.active_projectname = args[0] self.project_version = kwargs.get('version', 'undefined') proj_license = mesonlib.stringlistify(kwargs.get('license', 'unknown'))
AttributeError: 'Interpreter' object has no attribute 'builtin' I just updated to the latest master and got this stackdump. ``` python mkdir build python3 ./ECS/MDP1/meson/meson.py --buildtype=debugoptimized build The Meson build system Version: 0.36.0.dev1 Source dir: /tmp/foo Build dir: /tmp/foo/build Build type: native build Traceback (most recent call last): File "/tmp/foo/ECS/MDP1/meson/mesonbuild/mesonmain.py", line 282, in run app.generate() File "/tmp/foo/ECS/MDP1/meson/mesonbuild/mesonmain.py", line 159, in generate intr = interpreter.Interpreter(b, g) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 1129, in __init__ self.sanity_check_ast() File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 1258, in sanity_check_ast args = self.reduce_arguments(first.args)[0] File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2387, in reduce_arguments reduced_kw[key] = self.evaluate_statement(a) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 1435, in evaluate_statement return self.evaluate_arraystatement(cur) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2744, in evaluate_arraystatement (arguments, kwargs) = self.reduce_arguments(cur.args) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2381, in reduce_arguments reduced_pos = [self.evaluate_statement(arg) for arg in args.arguments] File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2381, in <listcomp> reduced_pos = [self.evaluate_statement(arg) for arg in args.arguments] File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 1423, in evaluate_statement return self.method_call(cur) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2515, in method_call return self.string_method_call(obj, method_name, args) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2434, in string_method_call (posargs, _) = self.reduce_arguments(args) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2381, in reduce_arguments reduced_pos = [self.evaluate_statement(arg) for arg in args.arguments] File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2381, in <listcomp> reduced_pos = [self.evaluate_statement(arg) for arg in args.arguments] File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 1423, in evaluate_statement return self.method_call(cur) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2505, in method_call obj = self.get_variable(object_name) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 1308, in get_variable if varname in self.builtin: AttributeError: 'Interpreter' object has no attribute 'builtin' ```
Hi jussi, I just updated to today's master (e2b3752f8757) and I'm still seeing this error. I'm stuck. Can you help me figure out what's going on?
2016-10-10T17:32:35Z
[]
[]
Traceback (most recent call last): File "/tmp/foo/ECS/MDP1/meson/mesonbuild/mesonmain.py", line 282, in run app.generate() File "/tmp/foo/ECS/MDP1/meson/mesonbuild/mesonmain.py", line 159, in generate intr = interpreter.Interpreter(b, g) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 1129, in __init__ self.sanity_check_ast() File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 1258, in sanity_check_ast args = self.reduce_arguments(first.args)[0] File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2387, in reduce_arguments reduced_kw[key] = self.evaluate_statement(a) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 1435, in evaluate_statement return self.evaluate_arraystatement(cur) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2744, in evaluate_arraystatement (arguments, kwargs) = self.reduce_arguments(cur.args) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2381, in reduce_arguments reduced_pos = [self.evaluate_statement(arg) for arg in args.arguments] File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2381, in <listcomp> reduced_pos = [self.evaluate_statement(arg) for arg in args.arguments] File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 1423, in evaluate_statement return self.method_call(cur) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2515, in method_call return self.string_method_call(obj, method_name, args) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2434, in string_method_call (posargs, _) = self.reduce_arguments(args) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2381, in reduce_arguments reduced_pos = [self.evaluate_statement(arg) for arg in args.arguments] File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2381, in <listcomp> reduced_pos = [self.evaluate_statement(arg) for arg in args.arguments] File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 1423, in evaluate_statement return self.method_call(cur) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 2505, in method_call obj = self.get_variable(object_name) File "/tmp/foo/ECS/MDP1/meson/mesonbuild/interpreter.py", line 1308, in get_variable if varname in self.builtin: AttributeError: 'Interpreter' object has no attribute 'builtin'
9,552
mesonbuild/meson
mesonbuild__meson-900
c3db008d82026834e45d07a07e5418585df62026
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -149,18 +149,22 @@ def set_builtin_option(self, optname, value): raise RuntimeError('Tried to set unknown builtin option %s.' % optname) def load(filename): - with open(filename, 'rb') as f: - obj = pickle.load(f) + load_fail_msg = 'Coredata file {!r} is corrupted. Try with a fresh build tree.'.format(filename) + try: + with open(filename, 'rb') as f: + obj = pickle.load(f) + except pickle.UnpicklingError: + raise MesonException(load_fail_msg) if not isinstance(obj, CoreData): - raise RuntimeError('Core data file is corrupted.') + raise MesonException(load_fail_msg) if obj.version != version: - raise RuntimeError('Build tree has been generated with Meson version %s, which is incompatible with current version %s.'% + raise MesonException('Build directory has been generated with Meson version %s, which is incompatible with current version %s.\nPlease delete this build directory AND create a new one.'% (obj.version, version)) return obj def save(obj, filename): if obj.version != version: - raise RuntimeError('Fatal version mismatch corruption.') + raise MesonException('Fatal version mismatch corruption.') with open(filename, 'wb') as f: pickle.dump(obj, f)
Feature Request: Deal with upgrades better Hi Jussi, I just upgraded from .27-research to .28-research and got an error message - which I expected. Is there a flag or target that could be added to force this upgrade to happen? And by upgrade, I mean delete the old stuff and regenerate. It's awkward to tell people to `rm -rf build; mkdir build; <cc flags> meson build` when I upgrade meson on the systems and their build breaks. I'm trying to replace our crusty make based build and this, IMO, is a wart. (meson is still awesome, though!) ``` [1/1] Regenerating build files Traceback (most recent call last): File "/opt/meson/share/meson/meson.py", line 211, in run app.generate() File "/opt/meson/share/meson/meson.py", line 126, in generate env = environment.Environment(self.source_dir, self.build_dir, self.meson_script_file, self.options) File "/opt/meson/share/meson/environment.py", line 69, in __init__ self.coredata = coredata.load(cdf) File "/opt/meson/share/meson/coredata.py", line 199, in load (obj.version, version)) RuntimeError: Build tree has been generated with Meson version 0.27.0-research, which is incompatible with current version 0.28.0-research. ```
We could do it automatically, I guess, but doing this loses all build tree state and files that are there (it is common for people to copy extra files to their build dir to use for manual tests etc). Blowing those away without the user's consent is not really nice. It is also a fair bit of work trying to transition all configuration settings from one version to another automatically. Once Meson gets a bit more popular, people will mostly get it via distro packages. Those update only rarely so this should not be such a big of an issue. If you are running latest trunk, well, that's one of the downsides of being on the bleeding edge. :) So yes, the current situation is not really optimal, but fixing it properly would take a lot of resources that are, as always, scarce. Would you find this acceptable? Would something like this work? - Capture the `os.environ` when the user first calls `meson` and store somewhere in the build dir - Capture the command line args meson was run with and store somewhere in the build dir - Add an argument like `--reinitializie-meson-and-lose-all-build-directory-data` or maybe something a bit shorter - When the users types `meson --reinitializie-meson-and-lose-all-build-directory-data <build-dir>`, meson would - Overwrite the current environment with the stored env. - Overwrite the current command line args with the stored ones - Blow away everything inside of the `build-dir` - Finally, meson would run itself like normal To me the entire point of a separate build dir is that its contents can be considered volatile/junk. In any case, wouldn't it be enough to just remove some meson + ninja dirs, or does the build dir have to be empty initially? I think the way autotools works in maintainer-mode is quite nice and worth emulating (I realise it's not the exact same use case). > To me the entire point of a separate build dir is that its contents can be considered volatile/junk. In any case, wouldn't it be enough to just remove some meson + ninja dirs, or does the build dir have to be empty initially? If meson is happy with a non empty build dir then so am I! No need to blow away everything. > I think the way autotools works in maintainer-mode is quite nice and worth emulating (I realise it's not the exact same use case). I just looked up [maintainer-mode](https://blogs.gnome.org/desrt/2011/09/08/am_maintainer_mode-is-not-cool/) - it looks like it would do the opposite of what meson does currently - ie: not update the ninja file unless a flag gets passed in. Personally, I think the way meson behaves now is ideal. To see what the problem is let's assume that you first run Meson on your project. Then you work on it and add a new Meson option `foo`. Then you change it from the default value. Once this is done you update. If the system is not careful and loses the value of this setting (for example, by going back to the default), then this may lead to unexpected behaviour for the user. Even if you stored all these changes there is _still_ an error case. Suppose you edit your Meson options, update Meson and only _then_ try to compile. You have done two unrelated changes and there is no reliable way to recover from that. The current approach is not not the most user friendly but it is a) explicit and unambiguous b) simple and understandable and c) does not have unexpected failure modes. Adding a target that does the equivalent of `rm interesting files here; meson.py <src dir> <build dir>` is doable but it would erase all build configuration state. Hmm, I hadn't considered changing values via mesonconf... automatic regeneration is tricky. Is a released version, the user doesn't see the stack dump, right? I only see it because I'm running HEAD? I just got pinged again about this again - total confusion. Can we print out a more reasonable (for meson noobs) error message instead of a stack dump and a message that doesn't tell you how to resolve the issue? Yes, we should print a better error message. A stack trace just looks terrible and people's eyes glaze over and they miss the message at the bottom.
2016-10-12T21:09:40Z
[]
[]
Traceback (most recent call last): File "/opt/meson/share/meson/meson.py", line 211, in run app.generate() File "/opt/meson/share/meson/meson.py", line 126, in generate env = environment.Environment(self.source_dir, self.build_dir, self.meson_script_file, self.options) File "/opt/meson/share/meson/environment.py", line 69, in __init__ self.coredata = coredata.load(cdf) File "/opt/meson/share/meson/coredata.py", line 199, in load (obj.version, version)) RuntimeError: Build tree has been generated with Meson version 0.27.0-research, which is incompatible with current version 0.28.0-research.
9,565
mesonbuild/meson
mesonbuild__meson-9106
d2fa6d50809e6a5955999152f43a461595c6bc4c
diff --git a/mesonbuild/build.py b/mesonbuild/build.py --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -513,40 +513,49 @@ def __init__(self, name: str, subdir: str, subproject: str, build_by_default: bo raise RuntimeError(f'Target type is not set for target class "{type(self).__name__}". This is a bug') def __lt__(self, other: object) -> bool: - if not hasattr(other, 'get_id') and not callable(other.get_id): + if not isinstance(other, Target): return NotImplemented return self.get_id() < other.get_id() def __le__(self, other: object) -> bool: - if not hasattr(other, 'get_id') and not callable(other.get_id): + if not isinstance(other, Target): return NotImplemented return self.get_id() <= other.get_id() def __gt__(self, other: object) -> bool: - if not hasattr(other, 'get_id') and not callable(other.get_id): + if not isinstance(other, Target): return NotImplemented return self.get_id() > other.get_id() def __ge__(self, other: object) -> bool: - if not hasattr(other, 'get_id') and not callable(other.get_id): + if not isinstance(other, Target): return NotImplemented return self.get_id() >= other.get_id() def get_default_install_dir(self, env: environment.Environment) -> T.Tuple[str, str]: raise NotImplementedError + def get_custom_install_dir(self) -> T.List[T.Union[str, bool]]: + raise NotImplementedError + def get_install_dir(self, environment: environment.Environment) -> T.Tuple[T.Any, str, bool]: # Find the installation directory. default_install_dir, install_dir_name = self.get_default_install_dir(environment) outdirs = self.get_custom_install_dir() - if outdirs[0] is not None and outdirs[0] != default_install_dir and outdirs[0] is not True: + if outdirs and outdirs[0] != default_install_dir and outdirs[0] is not True: # Either the value is set to a non-default value, or is set to # False (which means we want this specific output out of many # outputs to not be installed). custom_install_dir = True else: custom_install_dir = False - outdirs[0] = default_install_dir + # if outdirs is empty we need to set to something, otherwise we set + # only the first value to the default + if outdirs: + outdirs[0] = default_install_dir + else: + outdirs = [default_install_dir] + return outdirs, install_dir_name, custom_install_dir def get_basename(self) -> str: @@ -611,8 +620,15 @@ def process_kwargs_base(self, kwargs: T.Dict[str, T.Any]) -> None: @staticmethod def parse_overrides(kwargs: T.Dict[str, T.Any]) -> T.Dict[OptionKey, str]: + opts = kwargs.get('override_options', []) + + # In this case we hav ean already parsed and ready to go dictionary + # provided by typed_kwargs + if isinstance(opts, dict): + return T.cast(T.Dict[OptionKey, str], opts) + result: T.Dict[OptionKey, str] = {} - overrides = stringlistify(kwargs.get('override_options', [])) + overrides = stringlistify(opts) for o in overrides: if '=' not in o: raise InvalidArguments('Overrides must be of form "key=value"') @@ -634,6 +650,8 @@ def should_install(self) -> bool: class BuildTarget(Target): known_kwargs = known_build_target_kwargs + install_dir: T.List[T.Union[str, bool]] + def __init__(self, name: str, subdir: str, subproject: str, for_machine: MachineChoice, sources: T.List['SourceOutputs'], objects, environment: environment.Environment, kwargs): super().__init__(name, subdir, subproject, True, for_machine) @@ -990,7 +1008,7 @@ def get_link_dep_subdirs(self) -> 'ImmutableSetProtocol[str]': def get_default_install_dir(self, environment: environment.Environment) -> T.Tuple[str, str]: return environment.get_libdir(), '{libdir}' - def get_custom_install_dir(self): + def get_custom_install_dir(self) -> T.List[T.Union[str, bool]]: return self.install_dir def get_custom_install_mode(self) -> T.Optional['FileMode']: @@ -1074,7 +1092,7 @@ def process_kwargs(self, kwargs, environment): self.add_deps(deplist) # If an item in this list is False, the output corresponding to # the list index of that item will not be installed - self.install_dir = typeslistify(kwargs.get('install_dir', [None]), + self.install_dir = typeslistify(kwargs.get('install_dir', []), (str, bool)) self.install_mode = kwargs.get('install_mode', None) self.install_tag = stringlistify(kwargs.get('install_tag', [None])) @@ -2226,9 +2244,15 @@ def get_default_object(self) -> BuildTarget: raise MesonBugException(f'self._preferred_library == "{self._preferred_library}" is neither "shared" nor "static".') class CommandBase: - def flatten_command(self, cmd): + + depend_files: T.List[File] + dependencies: T.List[T.Union[BuildTarget, 'CustomTarget']] + subproject: str + + def flatten_command(self, cmd: T.Sequence[T.Union[str, File, programs.ExternalProgram, 'BuildTarget', 'CustomTarget', 'CustomTargetIndex']]) -> \ + T.List[T.Union[str, File, BuildTarget, 'CustomTarget']]: cmd = listify(cmd) - final_cmd = [] + final_cmd: T.List[T.Union[str, File, BuildTarget, 'CustomTarget']] = [] for c in cmd: if isinstance(c, str): final_cmd.append(c) @@ -2279,6 +2303,8 @@ class CustomTarget(Target, CommandBase): 'env', } + install_dir: T.List[T.Union[str, bool]] + def __init__(self, name: str, subdir: str, subproject: str, kwargs: T.Dict[str, T.Any], absolute_paths: bool = False, backend: T.Optional['Backend'] = None): self.typename = 'custom' @@ -2375,7 +2401,7 @@ def process_kwargs(self, kwargs, backend): raise InvalidArguments("Can't both capture output and output to console") if 'command' not in kwargs: raise InvalidArguments('Missing keyword argument "command".') - if 'depfile' in kwargs: + if kwargs.get('depfile') is not None: depfile = kwargs['depfile'] if not isinstance(depfile, str): raise InvalidArguments('Depfile must be a string.') @@ -2397,32 +2423,36 @@ def process_kwargs(self, kwargs, backend): raise InvalidArguments('"install_dir" must be specified ' 'when installing a target') - if isinstance(kwargs['install_dir'], list): - FeatureNew.single_use('multiple install_dir for custom_target', '0.40.0', self.subproject) - # If an item in this list is False, the output corresponding to - # the list index of that item will not be installed - self.install_dir = typeslistify(kwargs['install_dir'], (str, bool)) - self.install_mode = kwargs.get('install_mode', None) - # If only one tag is provided, assume all outputs have the same tag. - # Otherwise, we must have as much tags as outputs. - self.install_tag = typeslistify(kwargs.get('install_tag', [None]), (str, bool)) - if len(self.install_tag) == 1: - self.install_tag = self.install_tag * len(self.outputs) - elif len(self.install_tag) != len(self.outputs): - m = f'Target {self.name!r} has {len(self.outputs)} outputs but {len(self.install_tag)} "install_tag"s were found.' - raise InvalidArguments(m) + if isinstance(kwargs['install_dir'], list): + FeatureNew.single_use('multiple install_dir for custom_target', '0.40.0', self.subproject) + # If an item in this list is False, the output corresponding to + # the list index of that item will not be installed + self.install_dir = typeslistify(kwargs['install_dir'], (str, bool)) + self.install_mode = kwargs.get('install_mode', None) + # If only one tag is provided, assume all outputs have the same tag. + # Otherwise, we must have as much tags as outputs. + install_tag: T.List[T.Union[str, bool, None]] = typeslistify(kwargs.get('install_tag', []), (str, bool, type(None))) + if not install_tag: + self.install_tag = [None] * len(self.outputs) + elif len(install_tag) == 1: + self.install_tag = install_tag * len(self.outputs) + elif install_tag and len(install_tag) != len(self.outputs): + m = f'Target {self.name!r} has {len(self.outputs)} outputs but {len(install_tag)} "install_tag"s were found.' + raise InvalidArguments(m) + else: + self.install_tag = install_tag else: self.install = False - self.install_dir = [None] + self.install_dir = [] self.install_mode = None self.install_tag = [] - if 'build_always' in kwargs and 'build_always_stale' in kwargs: + if kwargs.get('build_always') is not None and kwargs.get('build_always_stale') is not None: raise InvalidArguments('build_always and build_always_stale are mutually exclusive. Combine build_by_default and build_always_stale.') - elif 'build_always' in kwargs: - if 'build_by_default' not in kwargs: + elif kwargs.get('build_always') is not None: + if kwargs.get('build_by_default') is not None: self.build_by_default = kwargs['build_always'] self.build_always_stale = kwargs['build_always'] - elif 'build_always_stale' in kwargs: + elif kwargs.get('build_always_stale') is not None: self.build_always_stale = kwargs['build_always_stale'] if not isinstance(self.build_always_stale, bool): raise InvalidArguments('Argument build_always_stale must be a boolean.') @@ -2446,7 +2476,7 @@ def get_dependencies(self): def should_install(self) -> bool: return self.install - def get_custom_install_dir(self): + def get_custom_install_dir(self) -> T.List[T.Union[str, bool]]: return self.install_dir def get_custom_install_mode(self) -> T.Optional['FileMode']: @@ -2530,8 +2560,13 @@ def __len__(self) -> int: return len(self.outputs) class RunTarget(Target, CommandBase): - def __init__(self, name: str, command, dependencies, - subdir: str, subproject: str, env: T.Optional['EnvironmentVariables'] = None): + + def __init__(self, name: str, + command: T.Sequence[T.Union[str, File, BuildTarget, 'CustomTarget', 'CustomTargetIndex', programs.ExternalProgram]], + dependencies: T.Sequence[T.Union[BuildTarget, 'CustomTarget']], + subdir: str, + subproject: str, + env: T.Optional['EnvironmentVariables'] = None): self.typename = 'run' # These don't produce output artifacts super().__init__(name, subdir, subproject, False, MachineChoice.BUILD) @@ -2541,20 +2576,17 @@ def __init__(self, name: str, command, dependencies, self.absolute_paths = False self.env = env - def __repr__(self): + def __repr__(self) -> str: repr_str = "<{0} {1}: {2}>" return repr_str.format(self.__class__.__name__, self.get_id(), self.command[0]) - def process_kwargs(self, kwargs): - return self.process_kwargs_base(kwargs) - - def get_dependencies(self): + def get_dependencies(self) -> T.List[T.Union[BuildTarget, 'CustomTarget']]: return self.dependencies - def get_generated_sources(self): + def get_generated_sources(self) -> T.List['GeneratedTypes']: return [] - def get_sources(self): + def get_sources(self) -> T.List[File]: return [] def should_install(self) -> bool: @@ -2571,11 +2603,12 @@ def get_outputs(self) -> T.List[str]: else: raise RuntimeError('RunTarget: self.name is neither a list nor a string. This is a bug') - def type_suffix(self): + def type_suffix(self) -> str: return "@run" class AliasTarget(RunTarget): - def __init__(self, name, dependencies, subdir, subproject): + def __init__(self, name: str, dependencies: T.Sequence[T.Union[BuildTarget, 'CustomTarget']], + subdir: str, subproject: str): super().__init__(name, [], dependencies, subdir, subproject) def __repr__(self): @@ -2677,7 +2710,7 @@ def is_internal(self) -> bool: def extract_all_objects_recurse(self) -> T.List[T.Union[str, 'ExtractedObjects']]: return self.target.extract_all_objects_recurse() - def get_custom_install_dir(self): + def get_custom_install_dir(self) -> T.List[T.Union[str, bool]]: return self.target.get_custom_install_dir() class ConfigurationData(HoldableObject): diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -50,10 +50,14 @@ NullSubprojectInterpreter, ) from .type_checking import ( + COMMAND_KW, + DEPENDS_KW, + DEPEND_FILES_KW, + DEPFILE_KW, ENV_KW, INSTALL_MODE_KW, LANGUAGE_KW, - NATIVE_KW, + NATIVE_KW, OVERRIDE_OPTIONS_KW, REQUIRED_KW, NoneType, in_set_validator, @@ -86,6 +90,18 @@ build.GeneratedList] +def _output_validator(outputs: T.List[str]) -> T.Optional[str]: + for i in outputs: + if i == '': + return 'Output must not be empty.' + elif i.strip() == '': + return 'Output must not consist only of whitespace.' + elif has_path_sep(i): + return f'Output {i!r} must not contain a path segment.' + + return None + + def stringifyUserArguments(args, quote=False): if isinstance(args, list): return '[%s]' % ', '.join([stringifyUserArguments(x, True) for x in args]) @@ -1623,20 +1639,71 @@ def func_vcs_tag(self, node, args, kwargs): def func_subdir_done(self, node, args, kwargs): raise SubdirDoneRequest() - @FeatureNewKwargs('custom_target', '0.60.0', ['install_tag']) - @FeatureNewKwargs('custom_target', '0.57.0', ['env']) - @FeatureNewKwargs('custom_target', '0.48.0', ['console']) - @FeatureNewKwargs('custom_target', '0.47.0', ['install_mode', 'build_always_stale']) - @FeatureNewKwargs('custom_target', '0.40.0', ['build_by_default']) - @FeatureNewKwargs('custom_target', '0.59.0', ['feed']) - @permittedKwargs({'input', 'output', 'command', 'install', 'install_dir', 'install_mode', - 'build_always', 'capture', 'depends', 'depend_files', 'depfile', - 'build_by_default', 'build_always_stale', 'console', 'env', - 'feed', 'install_tag'}) @typed_pos_args('custom_target', optargs=[str]) - def func_custom_target(self, node: mparser.FunctionNode, args: T.Tuple[T.Optional[str]], kwargs: 'TYPE_kwargs') -> build.CustomTarget: - if 'depfile' in kwargs and ('@BASENAME@' in kwargs['depfile'] or '@PLAINNAME@' in kwargs['depfile']): + @typed_kwargs( + 'custom_target', + COMMAND_KW, + DEPEND_FILES_KW, + DEPENDS_KW, + DEPFILE_KW, + ENV_KW.evolve(since='0.57.0'), + INSTALL_MODE_KW.evolve(since='0.47.0'), + OVERRIDE_OPTIONS_KW, + KwargInfo('build_by_default', (bool, type(None)), since='0.40.0'), + KwargInfo('build_always', (bool, type(None)), deprecated='0.47.0'), + KwargInfo('build_always_stale', (bool, type(None)), since='0.47.0'), + KwargInfo('feed', bool, default=False, since='0.59.0'), + KwargInfo('capture', bool, default=False), + KwargInfo('console', bool, default=False, since='0.48.0'), + KwargInfo('install', bool, default=False), + KwargInfo('install_dir', ContainerTypeInfo(list, (str, bool)), listify=True, default=[]), + KwargInfo( + 'output', + ContainerTypeInfo(list, str, allow_empty=False), + listify=True, + required=True, + default=[], + validator=_output_validator, + ), + KwargInfo( + 'input', + ContainerTypeInfo(list, (str, mesonlib.File, ExternalProgram, build.BuildTarget, build.CustomTarget, build.CustomTargetIndex, build.ExtractedObjects, build.GeneratedList)), + listify=True, + default=[], + ), + KwargInfo('install_tag', ContainerTypeInfo(list, (str, bool)), listify=True, default=[], since='0.60.0'), + ) + def func_custom_target(self, node: mparser.FunctionNode, args: T.Tuple[str], + kwargs: 'kwargs.CustomTarget') -> build.CustomTarget: + if kwargs['depfile'] and ('@BASENAME@' in kwargs['depfile'] or '@PLAINNAME@' in kwargs['depfile']): FeatureNew.single_use('substitutions in custom_target depfile', '0.47.0', self.subproject) + + # Don't mutate the kwargs + kwargs = kwargs.copy() + + # Remap build_always to build_by_default and build_always_stale + if kwargs['build_always'] is not None and kwargs['build_always_stale'] is not None: + raise InterpreterException('CustomTarget: "build_always" and "build_always_stale" are mutually exclusive') + + if kwargs['build_by_default'] is None and kwargs['install']: + kwargs['build_by_default'] = True + + elif kwargs['build_always'] is not None: + if kwargs['build_by_default'] is None: + kwargs['build_by_default'] = kwargs['build_always'] + kwargs['build_always_stale'] = kwargs['build_by_default'] + + # Set this to None to satisfy process_kwargs + kwargs['build_always'] = None + + # These are are nullaable so that we can konw whether they're explicitly + # set or not. If they haven't been overwritten, set them to their true + # default + if kwargs['build_by_default'] is None: + kwargs['build_by_default'] = False + if kwargs['build_always_stale'] is None: + kwargs['build_always_stale'] = False + return self._func_custom_target_impl(node, args, kwargs) def _func_custom_target_impl(self, node, args, kwargs): @@ -1664,35 +1731,24 @@ def _func_custom_target_impl(self, node, args, kwargs): self.add_target(tg.name, tg) return tg - @FeatureNewKwargs('run_target', '0.57.0', ['env']) - @permittedKwargs({'command', 'depends', 'env'}) @typed_pos_args('run_target', str) - def func_run_target(self, node: mparser.FunctionNode, args: T.Tuple[str], kwargs: 'TYPE_kwargs') -> build.RunTarget: - if 'command' not in kwargs: - raise InterpreterException('Missing "command" keyword argument') - all_args = extract_as_list(kwargs, 'command') - deps = extract_as_list(kwargs, 'depends') + @typed_kwargs( + 'run_target', + COMMAND_KW, + DEPENDS_KW, + ENV_KW.evolve(since='0.57.0'), + ) + def func_run_target(self, node: mparser.FunctionNode, args: T.Tuple[str], + kwargs: 'kwargs.RunTarget') -> build.RunTarget: + all_args = kwargs['command'].copy() - cleaned_args = [] for i in listify(all_args): - if not isinstance(i, (str, build.BuildTarget, build.CustomTarget, ExternalProgram, mesonlib.File)): - mlog.debug('Wrong type:', str(i)) - raise InterpreterException('Invalid argument to run_target.') if isinstance(i, ExternalProgram) and not i.found(): raise InterpreterException(f'Tried to use non-existing executable {i.name!r}') - cleaned_args.append(i) - if isinstance(cleaned_args[0], str): - cleaned_args[0] = self.func_find_program(node, cleaned_args[0], {}) + if isinstance(all_args[0], str): + all_args[0] = self.func_find_program(node, all_args[0], {}) name = args[0] - if not isinstance(name, str): - raise InterpreterException('First argument must be a string.') - cleaned_deps = [] - for d in deps: - if not isinstance(d, (build.BuildTarget, build.CustomTarget)): - raise InterpreterException('Depends items must be build targets.') - cleaned_deps.append(d) - env = self.unpack_env_kwarg(kwargs) - tg = build.RunTarget(name, cleaned_args, cleaned_deps, self.subdir, self.subproject, env) + tg = build.RunTarget(name, all_args, kwargs['depends'], self.subdir, self.subproject, kwargs['env']) self.add_target(name, tg) full_name = (self.subproject, name) assert full_name not in self.build.run_target_names @@ -1709,14 +1765,12 @@ def func_alias_target(self, node: mparser.BaseNode, args: T.Tuple[str, T.List[bu self.add_target(name, tg) return tg - @permittedKwargs({'arguments', 'output', 'depends', 'depfile', 'capture', - 'preserve_path_from'}) @typed_pos_args('generator', (build.Executable, ExternalProgram)) @typed_kwargs( 'generator', KwargInfo('arguments', ContainerTypeInfo(list, str, allow_empty=False), required=True, listify=True), KwargInfo('output', ContainerTypeInfo(list, str, allow_empty=False), required=True, listify=True), - KwargInfo('depfile', (str, NoneType), validator=lambda x: 'Depfile must be a plain filename with a subdirectory' if has_path_sep(x) else None), + DEPFILE_KW, KwargInfo('capture', bool, default=False, since='0.43.0'), KwargInfo('depends', ContainerTypeInfo(list, (build.BuildTarget, build.CustomTarget)), default=[], listify=True), ) @@ -1908,6 +1962,8 @@ def func_subdir(self, node: mparser.BaseNode, args: T.Tuple[str], kwargs: 'TYPE_ def _get_kwarg_install_mode(self, kwargs: T.Dict[str, T.Any]) -> T.Optional[FileMode]: if kwargs.get('install_mode', None) is None: return None + if isinstance(kwargs['install_mode'], FileMode): + return kwargs['install_mode'] install_mode: T.List[str] = [] mode = mesonlib.typeslistify(kwargs.get('install_mode', []), (str, int)) for m in mode: diff --git a/mesonbuild/interpreter/kwargs.py b/mesonbuild/interpreter/kwargs.py --- a/mesonbuild/interpreter/kwargs.py +++ b/mesonbuild/interpreter/kwargs.py @@ -10,7 +10,8 @@ from .. import build from .. import coredata -from ..mesonlib import MachineChoice, File, FileMode, FileOrString +from ..mesonlib import MachineChoice, File, FileMode, FileOrString, OptionKey +from ..programs import ExternalProgram class FuncAddProjectArgs(TypedDict): @@ -87,7 +88,7 @@ class FuncGenerator(TypedDict): arguments: T.List[str] output: T.List[str] - depfile: bool + depfile: T.Optional[str] capture: bool depends: T.List[T.Union[build.BuildTarget, build.CustomTarget]] @@ -155,3 +156,33 @@ class FuncIncludeDirectories(TypedDict): class FuncAddLanguages(ExtractRequired): native: T.Optional[bool] + +class RunTarget(TypedDict): + + command: T.List[T.Union[str, build.BuildTarget, build.CustomTarget, ExternalProgram, File]] + depends: T.List[T.Union[build.BuildTarget, build.CustomTarget]] + env: build.EnvironmentVariables + + +class CustomTarget(TypedDict): + + build_always: bool + build_always_stale: bool + build_by_default: bool + capture: bool + command: T.List[T.Union[str, build.BuildTarget, build.CustomTarget, + build.CustomTargetIndex, ExternalProgram, File]] + consonle: bool + depend_files: T.List[FileOrString] + depends: T.List[T.Union[build.BuildTarget, build.CustomTarget]] + depfile: T.Optional[str] + env: build.EnvironmentVariables + feed: bool + input: T.List[T.Union[str, build.BuildTarget, build.CustomTarget, build.CustomTargetIndex, + build.ExtractedObjects, build.GeneratedList, ExternalProgram, File]] + install: bool + install_dir: T.List[T.Union[str, bool]] + install_mode: FileMode + install_tag: T.List[T.Union[str, bool]] + output: T.List[str] + override_options: T.Dict[OptionKey, str] diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py --- a/mesonbuild/interpreter/type_checking.py +++ b/mesonbuild/interpreter/type_checking.py @@ -6,11 +6,12 @@ import typing as T from .. import compilers -from ..build import EnvironmentVariables +from ..build import EnvironmentVariables, CustomTarget, BuildTarget, CustomTargetIndex from ..coredata import UserFeatureOption from ..interpreterbase import TYPE_var from ..interpreterbase.decorators import KwargInfo, ContainerTypeInfo -from ..mesonlib import FileMode, MachineChoice, listify +from ..mesonlib import File, FileMode, MachineChoice, listify, has_path_sep, OptionKey +from ..programs import ExternalProgram # Helper definition for type checks that are `Optional[T]` NoneType: T.Type[None] = type(None) @@ -157,13 +158,21 @@ def _splitter(v: str) -> T.Optional[str]: return None -def _env_convertor(value: T.Union[EnvironmentVariables, T.List[str], T.Dict[str, str], str, None]) -> EnvironmentVariables: - def splitter(input: str) -> T.Tuple[str, str]: - a, b = input.split('=', 1) - return (a.strip(), b.strip()) - if isinstance(value, (str, list)): - return EnvironmentVariables(dict(splitter(v) for v in listify(value))) +def split_equal_string(input: str) -> T.Tuple[str, str]: + """Split a string in the form `x=y` + + This assumes that the string has already been validated to split properly. + """ + a, b = input.split('=', 1) + return (a, b) + + +def _env_convertor(value: T.Union[EnvironmentVariables, T.List[str], T.List[T.List[str]], T.Dict[str, str], str, None]) -> EnvironmentVariables: + if isinstance(value, str): + return EnvironmentVariables(dict([split_equal_string(value)])) + elif isinstance(value, list): + return EnvironmentVariables(dict(split_equal_string(v) for v in listify(value))) elif isinstance(value, dict): return EnvironmentVariables(value) elif value is None: @@ -177,3 +186,50 @@ def splitter(input: str) -> T.Tuple[str, str]: validator=_env_validator, convertor=_env_convertor, ) + +DEPFILE_KW: KwargInfo[T.Optional[str]] = KwargInfo( + 'depfile', + (str, type(None)), + validator=lambda x: 'Depfile must be a plain filename with a subdirectory' if has_path_sep(x) else None +) + +DEPENDS_KW: KwargInfo[T.List[T.Union[BuildTarget, CustomTarget]]] = KwargInfo( + 'depends', + ContainerTypeInfo(list, (BuildTarget, CustomTarget)), + listify=True, + default=[], +) + +DEPEND_FILES_KW: KwargInfo[T.List[T.Union[str, File]]] = KwargInfo( + 'depend_files', + ContainerTypeInfo(list, (File, str)), + listify=True, + default=[], +) + +COMMAND_KW: KwargInfo[T.List[T.Union[str, BuildTarget, CustomTarget, CustomTargetIndex, ExternalProgram, File]]] = KwargInfo( + 'command', + # TODO: should accept CustomTargetIndex as well? + ContainerTypeInfo(list, (str, BuildTarget, CustomTarget, CustomTargetIndex, ExternalProgram, File), allow_empty=False), + required=True, + listify=True, + default=[], +) + +def _override_options_convertor(raw: T.List[str]) -> T.Dict[OptionKey, str]: + output: T.Dict[OptionKey, str] = {} + for each in raw: + k, v = split_equal_string(each) + output[OptionKey.from_string(k)] = v + return output + + +OVERRIDE_OPTIONS_KW: KwargInfo[T.List[str]] = KwargInfo( + 'override_options', + ContainerTypeInfo(list, str), + listify=True, + default=[], + # Reusing the env validator is a littl overkill, but nicer than duplicating the code + validator=_env_validator, + convertor=_override_options_convertor, +) diff --git a/mesonbuild/interpreterbase/decorators.py b/mesonbuild/interpreterbase/decorators.py --- a/mesonbuild/interpreterbase/decorators.py +++ b/mesonbuild/interpreterbase/decorators.py @@ -373,7 +373,7 @@ def __init__(self, name: str, types: T.Union[T.Type[_T], T.Tuple[T.Type[_T], ... since_values: T.Optional[T.Dict[str, str]] = None, deprecated: T.Optional[str] = None, deprecated_values: T.Optional[T.Dict[str, str]] = None, - validator: T.Optional[T.Callable[[_T], T.Optional[str]]] = None, + validator: T.Optional[T.Callable[[T.Any], T.Optional[str]]] = None, convertor: T.Optional[T.Callable[[_T], object]] = None, not_set_warning: T.Optional[str] = None): self.name = name diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py --- a/mesonbuild/modules/pkgconfig.py +++ b/mesonbuild/modules/pkgconfig.py @@ -381,7 +381,8 @@ def generate_libs_flags(libs): if uninstalled: install_dir = os.path.dirname(state.backend.get_target_filename_abs(l)) else: - install_dir = l.get_custom_install_dir()[0] + _i = l.get_custom_install_dir() + install_dir = _i[0] if _i else None if install_dir is False: continue is_custom_target = isinstance(l, (build.CustomTarget, build.CustomTargetIndex)) @@ -471,9 +472,9 @@ def generate(self, state: 'ModuleState', args, kwargs): raise mesonlib.MesonException('Pkgconfig_gen first positional argument must be a library object') default_name = mainlib.name default_description = state.project_name + ': ' + mainlib.name - install_dir = mainlib.get_custom_install_dir()[0] - if isinstance(install_dir, str): - default_install_dir = os.path.join(install_dir, 'pkgconfig') + install_dir = mainlib.get_custom_install_dir() + if install_dir and isinstance(install_dir[0], str): + default_install_dir = os.path.join(install_dir[0], 'pkgconfig') elif len(args) > 1: raise mesonlib.MesonException('Too many positional arguments passed to Pkgconfig_gen.') diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py --- a/mesonbuild/modules/qt.py +++ b/mesonbuild/modules/qt.py @@ -556,14 +556,14 @@ def compile_translations(self, state: 'ModuleState', args: T.Tuple, kwargs: 'Com else: outdir = state.subdir cmd = [self.tools['lrelease'], '@INPUT@', '-qm', '@OUTPUT@'] - lrelease_kwargs = {'output': '@[email protected]', - 'input': ts, - 'install': kwargs['install'], - 'install_tag': 'i18n', - 'build_by_default': kwargs['build_by_default'], - 'command': cmd} - if install_dir is not None: - lrelease_kwargs['install_dir'] = install_dir + lrelease_kwargs: T.Dict[str, T.Any] = { + 'output': '@[email protected]', + 'input': ts, + 'install': kwargs['install'], + 'install_dir': install_dir or [], + 'install_tag': 'i18n', + 'build_by_default': kwargs['build_by_default'], + 'command': cmd} lrelease_target = build.CustomTarget(f'qt{self.qt_version}-compile-{ts}', outdir, state.subproject, lrelease_kwargs) translations.append(lrelease_target) if qresource: diff --git a/mesonbuild/modules/unstable_external_project.py b/mesonbuild/modules/unstable_external_project.py --- a/mesonbuild/modules/unstable_external_project.py +++ b/mesonbuild/modules/unstable_external_project.py @@ -71,7 +71,7 @@ def __init__(self, self.targets = self._create_targets() - def _configure(self, state: ModuleState): + def _configure(self, state: ModuleState) -> None: if self.configure_command == 'waf': FeatureNew('Waf external project', '0.60.0').use(self.subproject) waf = state.find_program('waf')
IndexError with `custom_target(…, output: [], build_by_default: true)` in a `subdir()` **Describe the bug** `custom_target(…, output: [], build_by_default: true)` in a `subdir()` causes a `IndexError`. ``` Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/mesonbuild/mesonmain.py", line 227, in run return options.run_func(options) File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 281, in run app.generate() File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 184, in generate self._generate(env) File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 246, in _generate intr.backend.generate() File "/usr/lib/python3.9/site-packages/mesonbuild/backend/ninjabackend.py", line 559, in generate self.generate_ending() File "/usr/lib/python3.9/site-packages/mesonbuild/backend/ninjabackend.py", line 3209, in generate_ending targetlist.append(os.path.join(self.get_target_dir(t), t.get_outputs()[0])) IndexError: list index out of range ``` Omitting `build_by_default: true` or doing this in the project root does not cause a `IndexError`. However `ninja.build` seems to have a syntax error. ``` ninja: error: build.ninja:31: expected path build : CUSTOM_COMMAND ../sub1/infile | /bin/true ^ near here WARNING: Could not create compilation database. ninja: Entering directory `_builddir' ninja: error: build.ninja:31: expected path build : CUSTOM_COMMAND ../sub1/infile | /bin/true ^ near here ``` **To Reproduce** ```console $ mkdir -p test01/sub1 $ cd test01 $ touch sub1/infile $ cat meson.build project('test01') subdir('sub1') $ cat sub1/meson.build custom_target('index-error', command: ['/bin/true'], input: 'infile', output: [], build_by_default: true) $ meson setup _builddir && meson compile -C _builddir ``` **Expected behavior** If `output` must not be empty a error message like `src/meson.build:42:0: ERROR: output must not be empty`. **system parameters** * Is this a [cross build](https://mesonbuild.com/Cross-compilation.html) or just a plain native build (for the same computer)? native * what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.) Fedora 34 * what Python version are you using e.g. 3.8.0 3.9.6 * what `meson --version` 0.59.0 * what `ninja --version` if it's a Ninja build 1.10.2
This should raise an error, I was actually looking at custom_target last night and this uses permittedKwargs to define what kwargs are allowed, but not the newer typed_kwargs which validates the value automatically. (Silly me had to struggle way too much with install_man which *is* typed_kwargs and I can't add more kwargs without implementing or copying from other typed_kwargs -- that and permittedKwargs doesn't mix AFAICT.) I think I understand enough of how this works now, that I'm going to try tonight to switch to typed_kwargs and fix this. @eli-schwartz I'm working on that right now actually. Excellent, so I don't need to bother in that case. (As mentioned in IRC, yours was already partially done from before, and I haven't even started. This means I get to be lazy again.)
2021-08-12T23:06:51Z
[]
[]
Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/mesonbuild/mesonmain.py", line 227, in run return options.run_func(options) File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 281, in run app.generate() File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 184, in generate self._generate(env) File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 246, in _generate intr.backend.generate() File "/usr/lib/python3.9/site-packages/mesonbuild/backend/ninjabackend.py", line 559, in generate self.generate_ending() File "/usr/lib/python3.9/site-packages/mesonbuild/backend/ninjabackend.py", line 3209, in generate_ending targetlist.append(os.path.join(self.get_target_dir(t), t.get_outputs()[0])) IndexError: list index out of range
9,571
mesonbuild/meson
mesonbuild__meson-9369
98d1ec7a32e15e82b62a35d0288e8458321ebd23
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -222,9 +222,9 @@ def compile_resources(self, state, args, kwargs): ifile = os.path.join(ifile.subdir, ifile.fname) elif isinstance(ifile, str): ifile = os.path.join(state.subdir, ifile) - elif isinstance(ifile, (interpreter.CustomTargetHolder, - interpreter.CustomTargetIndexHolder, - interpreter.GeneratedObjectsHolder)): + elif isinstance(ifile, (build.CustomTarget, + build.CustomTargetIndex, + build.GeneratedList)): m = 'Resource xml files generated at build-time cannot be used ' \ 'with gnome.compile_resources() because we need to scan ' \ 'the xml for dependencies. Use configure_file() instead ' \ @@ -286,7 +286,7 @@ def compile_resources(self, state, args, kwargs): kwargs['depend_files'] = depend_files kwargs['command'] = cmd else: - depfile = kwargs['output'] + '.d' + depfile = f'{output}.d' kwargs['depfile'] = depfile kwargs['command'] = copy.copy(cmd) + ['--dependency-file', '@DEPFILE@'] target_c = GResourceTarget(name, state.subdir, state.subproject, kwargs) @@ -1633,7 +1633,7 @@ def genmarshal(self, state, args, kwargs): raise MesonException(f'Genmarshal does not take a {arg} keyword argument.') install_header = kwargs.pop('install_header', False) - install_dir = kwargs.pop('install_dir', None) + install_dir = kwargs.pop('install_dir', []) custom_kwargs = { 'input': sources, @@ -1658,8 +1658,7 @@ def genmarshal(self, state, args, kwargs): body = build.CustomTarget(output + '_c', state.subdir, state.subproject, custom_kwargs) custom_kwargs['install'] = install_header - if install_dir is not None: - custom_kwargs['install_dir'] = install_dir + custom_kwargs['install_dir'] = install_dir if new_genmarshal: cmd += ['--pragma-once'] custom_kwargs['command'] = cmd + ['--header', '@INPUT@']
Throws exception instead of parsing error meson git c6d74ac7e0890c323bd1190d5f5d3d938fc6d59a When building this tree, meson throws an exception instead of complaining about the parsing error and where it occurred. [grilo-wip-hadess-grlnet-disable-fix.zip](https://github.com/mesonbuild/meson/files/7278069/grilo-wip-hadess-grlnet-disable-fix.zip) ```sh $ ~/Projects/jhbuild/meson/meson.py --prefix /home/hadess/Projects/gnome-install --libdir lib --buildtype=debugoptimized /home/hadess/Downloads/grilo-wip-hadess-grlnet-disable-fix The Meson build system Version: 0.59.99 Source dir: /home/hadess/Downloads/grilo-wip-hadess-grlnet-disable-fix Build dir: /tmp/bug-repro Build type: native build Project name: grilo Project version: 0.3.14 C compiler for the host machine: ccache cc (gcc 11.2.1 "cc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1)") C linker for the host machine: cc ld.bfd 2.37-10 Host machine cpu family: x86_64 Host machine cpu: x86_64 Found pkg-config: /usr/bin/pkg-config (1.8.0) Run-time dependency gio-2.0 found: YES 2.70.0 Run-time dependency glib-2.0 found: YES 2.70.0 Run-time dependency gmodule-2.0 found: YES 2.70.0 Run-time dependency gobject-2.0 found: YES 2.70.0 Run-time dependency libxml-2.0 found: YES 2.9.12 Run-time dependency libsoup-2.4 found: YES 2.74.0 Run-time dependency totem-plparser found: YES 3.26.6 Program g-ir-scanner found: YES (/usr/bin/g-ir-scanner) Program vapigen found: YES (/usr/bin/vapigen) Run-time dependency gtk+-3.0 found: YES 3.24.30 Run-time dependency oauth found: YES 1.0.3 Run-time dependency gobject-introspection-1.0 found: YES 1.70.0 Run-time dependency vapigen found: YES 0.54.1 Found pkg-config: /usr/bin/pkg-config (1.8.0) Program glib-genmarshal found: YES (/usr/bin/glib-genmarshal) Traceback (most recent call last): File "/home/hadess/Projects/jhbuild/meson/mesonbuild/mesonmain.py", line 228, in run return options.run_func(options) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/msetup.py", line 290, in run app.generate() File "/home/hadess/Projects/jhbuild/meson/mesonbuild/msetup.py", line 181, in generate self._generate(env) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/msetup.py", line 225, in _generate intr.run() File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreter/interpreter.py", line 2456, in run super().run() File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 165, in run self.evaluate_codeblock(self.ast, start=1) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 190, in evaluate_codeblock raise e File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 183, in evaluate_codeblock self.evaluate_statement(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 196, in evaluate_statement return self.function_call(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 82, in wrapper res = f(self, node) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 629, in function_call return func(node, func_args, kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 697, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 114, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 275, in wrapper return f(*nargs, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreter/interpreter.py", line 1941, in func_subdir self.evaluate_codeblock(codeblock) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 190, in evaluate_codeblock raise e File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 183, in evaluate_codeblock self.evaluate_statement(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 198, in evaluate_statement self.assignment(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 848, in assignment value = self.evaluate_statement(node.value) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 200, in evaluate_statement return self.method_call(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 666, in method_call return self._holderify(obj.method_call(method_name, args, kwargs)) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreter/interpreterobjects.py", line 751, in method_call ret = method(state, args, kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 114, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/modules/gnome.py", line 1669, in genmarshal header = build.CustomTarget(output + '_h', state.subdir, state.subproject, custom_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/build.py", line 2317, in __init__ self.process_kwargs(kwargs, backend) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/build.py", line 2426, in process_kwargs if isinstance(kwargs['install_dir'], list): KeyError: 'install_dir' ```
The fix is here below, but I would have expected an error about the type mismatches before the ninja file generation. ```patch diff --git a/bindings/vala/meson.build b/bindings/vala/meson.build index f5723b3..493634c 100644 --- a/bindings/vala/meson.build +++ b/bindings/vala/meson.build @@ -10,7 +10,7 @@ vala_sources = [ # LIBRARY, GIR, DEPS ] if enable_grlnet - vala_sources += ['grilo-net-@0@'.format(grl_majorminor), grlnet_gir[0], ['gio-2.0']] + vala_sources += [['grilo-net-@0@'.format(grl_majorminor), grlnet_gir[0], ['gio-2.0']]] endif foreach s: vala_sources ``` Sounds like a regression since custom_target() got ported to typed_kwargs(). Modules are creating ct without going through those decorators. @dcbaker I think the fix is to add a wrapper on ModuleState() object to create custom targets. Modules should stop using internal APIs like that. See ModuleState.test(), we did the same thing there. @xclaesse The plan is to make CustomTarget itself useful, we shouldn't have to add wrappers around the initialzers of internal class, they should stop doing the interpreter's job, stop taking a `kwargs`, and use keywords. I'll get it fixed. True, that's why state.test() takes python arguments instead of a kwargs dict, even if internally it goes back to a kwarg for now. I think we should still wrap that with a ModuleState method for CustomTarget too, one reason for that is I want - on the long term - get ride of ModuleReturnValue, ModuleState should be responsible of adding targets into the build list instead of process_new_values().
2021-10-07T16:28:29Z
[]
[]
Traceback (most recent call last): File "/home/hadess/Projects/jhbuild/meson/mesonbuild/mesonmain.py", line 228, in run return options.run_func(options) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/msetup.py", line 290, in run app.generate() File "/home/hadess/Projects/jhbuild/meson/mesonbuild/msetup.py", line 181, in generate self._generate(env) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/msetup.py", line 225, in _generate intr.run() File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreter/interpreter.py", line 2456, in run super().run() File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 165, in run self.evaluate_codeblock(self.ast, start=1) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 190, in evaluate_codeblock raise e File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 183, in evaluate_codeblock self.evaluate_statement(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 196, in evaluate_statement return self.function_call(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 82, in wrapper res = f(self, node) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 629, in function_call return func(node, func_args, kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 697, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 114, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 275, in wrapper return f(*nargs, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreter/interpreter.py", line 1941, in func_subdir self.evaluate_codeblock(codeblock) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 190, in evaluate_codeblock raise e File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 183, in evaluate_codeblock self.evaluate_statement(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 198, in evaluate_statement self.assignment(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 848, in assignment value = self.evaluate_statement(node.value) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 200, in evaluate_statement return self.method_call(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 666, in method_call return self._holderify(obj.method_call(method_name, args, kwargs)) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreter/interpreterobjects.py", line 751, in method_call ret = method(state, args, kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 114, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/modules/gnome.py", line 1669, in genmarshal header = build.CustomTarget(output + '_h', state.subdir, state.subproject, custom_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/build.py", line 2317, in __init__ self.process_kwargs(kwargs, backend) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/build.py", line 2426, in process_kwargs if isinstance(kwargs['install_dir'], list): KeyError: 'install_dir'
9,599
mesonbuild/meson
mesonbuild__meson-9473
ef255db73ad9d8f53a53cdeff49625e3a5802b25
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -1434,13 +1434,16 @@ def mkenums(self, state, args, kwargs): # so --template consumes it. h_cmd = cmd + ['--template', '@INPUT@'] h_sources = [h_template] + sources - custom_kwargs['install'] = install_header - if 'install_dir' not in custom_kwargs: - custom_kwargs['install_dir'] = \ + + # Copy so we don't mutate the arguments for the c_template + h_kwargs = custom_kwargs.copy() + h_kwargs['install'] = install_header + if 'install_dir' not in h_kwargs: + h_kwargs['install_dir'] = \ state.environment.coredata.get_option(mesonlib.OptionKey('includedir')) h_target = self._make_mkenum_custom_target(state, h_sources, h_output, h_cmd, - custom_kwargs) + h_kwargs) targets.append(h_target) if c_template is not None: @@ -1449,16 +1452,19 @@ def mkenums(self, state, args, kwargs): # so --template consumes it. c_cmd = cmd + ['--template', '@INPUT@'] c_sources = [c_template] + sources + + c_kwargs = custom_kwargs.copy() # Never install the C file. Complain on bug tracker if you need it. - custom_kwargs['install'] = False + c_kwargs['install'] = False + c_kwargs['install_dir'] = False if h_template is not None: if 'depends' in custom_kwargs: - custom_kwargs['depends'] += [h_target] + c_kwargs['depends'] += [h_target] else: - custom_kwargs['depends'] = h_target + c_kwargs['depends'] = h_target c_target = self._make_mkenum_custom_target(state, c_sources, c_output, c_cmd, - custom_kwargs) + c_kwargs) targets.insert(0, c_target) if c_template is None and h_template is None:
KeyError: 'install_dir' **Describe the bug** AUR package [msitools](https://aur.archlinux.org/packages/msitools/) fails to build with meson 0.60.0. The meson output looks like this: ``` + exec meson setup --prefix /usr --libexecdir lib --sbindir bin --buildtype plain --auto-features enabled --wrap-mode nodownload -D b_lto=true -D b_pie=true . build The Meson build system Version: 0.60.0 Source dir: /home/yes/git-repos/AUR/msitools/src/msitools-0.101 Build dir: /home/yes/git-repos/AUR/msitools/src/msitools-0.101/build Build type: native build Project name: msitools Project version: 0.101 C compiler for the host machine: cc (gcc 11.1.0 "cc (GCC) 11.1.0") C linker for the host machine: cc ld.bfd 2.36.1 Vala compiler for the host machine: valac (valac 0.54.2) Host machine cpu family: x86_64 Host machine cpu: x86_64 Program build-aux/meson-dist found: YES (/home/yes/git-repos/AUR/msitools/src/msitools-0.101/build-aux/meson-dist) Program perl found: YES (/usr/bin/perl) Program bison found: YES (/usr/bin/bison) Program subprojects/bats-core/bin/bats found: YES (/home/yes/git-repos/AUR/msitools/src/msitools-0.101/subprojects/bats-core/bin/bats) Found pkg-config: /usr/bin/pkg-config (1.8.0) Run-time dependency glib-2.0 found: YES 2.70.0 Run-time dependency gobject-2.0 found: YES 2.70.0 Run-time dependency gio-2.0 found: YES 2.70.0 Run-time dependency libgsf-1 found: YES 1.14.47 Run-time dependency libgcab-1.0 found: YES 1.4 Run-time dependency libxml-2.0 found: YES 2.9.12 Configuring config.h using configuration Program glib-mkenums found: YES (/usr/bin/glib-mkenums) Program glib-mkenums found: YES (/usr/bin/glib-mkenums) Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/mesonbuild/mesonmain.py", line 138, in run return options.run_func(options) File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 294, in run app.generate() File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 185, in generate self._generate(env) File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 229, in _generate intr.run() File "/usr/lib/python3.9/site-packages/mesonbuild/interpreter/interpreter.py", line 2484, in run super().run() File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 150, in run self.evaluate_codeblock(self.ast, start=1) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 175, in evaluate_codeblock raise e File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 168, in evaluate_codeblock self.evaluate_statement(cur) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 181, in evaluate_statement return self.function_call(cur) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 456, in function_call res = func(node, func_args, kwargs) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 713, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 115, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 276, in wrapper return f(*nargs, **wrapped_kwargs) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreter/interpreter.py", line 1969, in func_subdir self.evaluate_codeblock(codeblock) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 175, in evaluate_codeblock raise e File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 168, in evaluate_codeblock self.evaluate_statement(cur) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 183, in evaluate_statement self.assignment(cur) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 568, in assignment value = self.evaluate_statement(node.value) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 185, in evaluate_statement return self.method_call(cur) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 484, in method_call res = obj.method_call(method_name, args, kwargs) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreter/interpreterobjects.py", line 754, in method_call ret = method(state, args, kwargs) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 115, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/lib/python3.9/site-packages/mesonbuild/modules/gnome.py", line 1459, in mkenums c_target = self._make_mkenum_custom_target(state, c_sources, File "/usr/lib/python3.9/site-packages/mesonbuild/modules/gnome.py", line 1596, in _make_mkenum_custom_target return build.CustomTarget(output, state.subdir, state.subproject, custom_kwargs, File "/usr/lib/python3.9/site-packages/mesonbuild/build.py", line 2330, in __init__ self.process_kwargs(kwargs, backend) File "/usr/lib/python3.9/site-packages/mesonbuild/build.py", line 2441, in process_kwargs if isinstance(kwargs['install_dir'], list): KeyError: 'install_dir' ``` According to https://github.com/mesonbuild/meson/issues/9365#issuecomment-937724433, it appears to be a meson bug that is not fully fixed. **To Reproduce** ```bash $ git clone https://aur.archlinux.org/msitools.git $ cd msitools/ $ makepkg ``` **Expected behavior** The package builds without issue. **system parameters** * Is this a [cross build](https://mesonbuild.com/Cross-compilation.html) or just a plain native build (for the same computer)? * native build * what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.) * Arch Linux * what Python version are you using e.g. 3.8.0 * 3.9.7 * what `meson --version` * 0.60.0 * what `ninja --version` if it's a Ninja build * 1.10.2
@dcbaker this seems to be the same kind of issue as you fixed in https://github.com/mesonbuild/meson/pull/9369. Sigh, yup. I'll get CustomTarget completely converted for 0.61... I might need to send out the gnome module cleanups piecemeal as they're rather draining to work on.
2021-10-27T18:04:38Z
[]
[]
Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/mesonbuild/mesonmain.py", line 138, in run return options.run_func(options) File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 294, in run app.generate() File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 185, in generate self._generate(env) File "/usr/lib/python3.9/site-packages/mesonbuild/msetup.py", line 229, in _generate intr.run() File "/usr/lib/python3.9/site-packages/mesonbuild/interpreter/interpreter.py", line 2484, in run super().run() File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 150, in run self.evaluate_codeblock(self.ast, start=1) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 175, in evaluate_codeblock raise e File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 168, in evaluate_codeblock self.evaluate_statement(cur) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 181, in evaluate_statement return self.function_call(cur) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 456, in function_call res = func(node, func_args, kwargs) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 713, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 115, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 276, in wrapper return f(*nargs, **wrapped_kwargs) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreter/interpreter.py", line 1969, in func_subdir self.evaluate_codeblock(codeblock) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 175, in evaluate_codeblock raise e File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 168, in evaluate_codeblock self.evaluate_statement(cur) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 183, in evaluate_statement self.assignment(cur) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 568, in assignment value = self.evaluate_statement(node.value) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 185, in evaluate_statement return self.method_call(cur) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 484, in method_call res = obj.method_call(method_name, args, kwargs) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreter/interpreterobjects.py", line 754, in method_call ret = method(state, args, kwargs) File "/usr/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 115, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/lib/python3.9/site-packages/mesonbuild/modules/gnome.py", line 1459, in mkenums c_target = self._make_mkenum_custom_target(state, c_sources, File "/usr/lib/python3.9/site-packages/mesonbuild/modules/gnome.py", line 1596, in _make_mkenum_custom_target return build.CustomTarget(output, state.subdir, state.subproject, custom_kwargs, File "/usr/lib/python3.9/site-packages/mesonbuild/build.py", line 2330, in __init__ self.process_kwargs(kwargs, backend) File "/usr/lib/python3.9/site-packages/mesonbuild/build.py", line 2441, in process_kwargs if isinstance(kwargs['install_dir'], list): KeyError: 'install_dir'
9,611
mesonbuild/meson
mesonbuild__meson-9484
ae35b1f45ac5850547f2db52b7b50a54789fcca1
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -278,18 +278,20 @@ def compile_resources(self, state, args, kwargs): if install_header and not export: raise MesonException('GResource header is installed yet export is not enabled') - kwargs['input'] = args[1] - kwargs['output'] = output - kwargs['depends'] = depends + c_kwargs = kwargs.copy() + c_kwargs['input'] = args[1] + c_kwargs['output'] = output + c_kwargs['depends'] = depends + c_kwargs.setdefault('install_dir', []) if not mesonlib.version_compare(glib_version, gresource_dep_needed_version): # This will eventually go out of sync if dependencies are added - kwargs['depend_files'] = depend_files - kwargs['command'] = cmd + c_kwargs['depend_files'] = depend_files + c_kwargs['command'] = cmd else: depfile = f'{output}.d' - kwargs['depfile'] = depfile - kwargs['command'] = copy.copy(cmd) + ['--dependency-file', '@DEPFILE@'] - target_c = GResourceTarget(name, state.subdir, state.subproject, kwargs) + c_kwargs['depfile'] = depfile + c_kwargs['command'] = copy.copy(cmd) + ['--dependency-file', '@DEPFILE@'] + target_c = GResourceTarget(name, state.subdir, state.subproject, c_kwargs) if gresource: # Only one target for .gresource files return ModuleReturnValue(target_c, [target_c]) @@ -1456,7 +1458,7 @@ def mkenums(self, state, args, kwargs): c_kwargs = custom_kwargs.copy() # Never install the C file. Complain on bug tracker if you need it. c_kwargs['install'] = False - c_kwargs['install_dir'] = False + c_kwargs['install_dir'] = [] if h_template is not None: if 'depends' in custom_kwargs: c_kwargs['depends'] += [h_target]
Throws exception instead of parsing error meson git c6d74ac7e0890c323bd1190d5f5d3d938fc6d59a When building this tree, meson throws an exception instead of complaining about the parsing error and where it occurred. [grilo-wip-hadess-grlnet-disable-fix.zip](https://github.com/mesonbuild/meson/files/7278069/grilo-wip-hadess-grlnet-disable-fix.zip) ```sh $ ~/Projects/jhbuild/meson/meson.py --prefix /home/hadess/Projects/gnome-install --libdir lib --buildtype=debugoptimized /home/hadess/Downloads/grilo-wip-hadess-grlnet-disable-fix The Meson build system Version: 0.59.99 Source dir: /home/hadess/Downloads/grilo-wip-hadess-grlnet-disable-fix Build dir: /tmp/bug-repro Build type: native build Project name: grilo Project version: 0.3.14 C compiler for the host machine: ccache cc (gcc 11.2.1 "cc (GCC) 11.2.1 20210728 (Red Hat 11.2.1-1)") C linker for the host machine: cc ld.bfd 2.37-10 Host machine cpu family: x86_64 Host machine cpu: x86_64 Found pkg-config: /usr/bin/pkg-config (1.8.0) Run-time dependency gio-2.0 found: YES 2.70.0 Run-time dependency glib-2.0 found: YES 2.70.0 Run-time dependency gmodule-2.0 found: YES 2.70.0 Run-time dependency gobject-2.0 found: YES 2.70.0 Run-time dependency libxml-2.0 found: YES 2.9.12 Run-time dependency libsoup-2.4 found: YES 2.74.0 Run-time dependency totem-plparser found: YES 3.26.6 Program g-ir-scanner found: YES (/usr/bin/g-ir-scanner) Program vapigen found: YES (/usr/bin/vapigen) Run-time dependency gtk+-3.0 found: YES 3.24.30 Run-time dependency oauth found: YES 1.0.3 Run-time dependency gobject-introspection-1.0 found: YES 1.70.0 Run-time dependency vapigen found: YES 0.54.1 Found pkg-config: /usr/bin/pkg-config (1.8.0) Program glib-genmarshal found: YES (/usr/bin/glib-genmarshal) Traceback (most recent call last): File "/home/hadess/Projects/jhbuild/meson/mesonbuild/mesonmain.py", line 228, in run return options.run_func(options) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/msetup.py", line 290, in run app.generate() File "/home/hadess/Projects/jhbuild/meson/mesonbuild/msetup.py", line 181, in generate self._generate(env) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/msetup.py", line 225, in _generate intr.run() File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreter/interpreter.py", line 2456, in run super().run() File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 165, in run self.evaluate_codeblock(self.ast, start=1) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 190, in evaluate_codeblock raise e File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 183, in evaluate_codeblock self.evaluate_statement(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 196, in evaluate_statement return self.function_call(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 82, in wrapper res = f(self, node) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 629, in function_call return func(node, func_args, kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 697, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 114, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 275, in wrapper return f(*nargs, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreter/interpreter.py", line 1941, in func_subdir self.evaluate_codeblock(codeblock) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 190, in evaluate_codeblock raise e File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 183, in evaluate_codeblock self.evaluate_statement(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 198, in evaluate_statement self.assignment(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 848, in assignment value = self.evaluate_statement(node.value) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 200, in evaluate_statement return self.method_call(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 666, in method_call return self._holderify(obj.method_call(method_name, args, kwargs)) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreter/interpreterobjects.py", line 751, in method_call ret = method(state, args, kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 114, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/modules/gnome.py", line 1669, in genmarshal header = build.CustomTarget(output + '_h', state.subdir, state.subproject, custom_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/build.py", line 2317, in __init__ self.process_kwargs(kwargs, backend) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/build.py", line 2426, in process_kwargs if isinstance(kwargs['install_dir'], list): KeyError: 'install_dir' ```
The fix is here below, but I would have expected an error about the type mismatches before the ninja file generation. ```patch diff --git a/bindings/vala/meson.build b/bindings/vala/meson.build index f5723b3..493634c 100644 --- a/bindings/vala/meson.build +++ b/bindings/vala/meson.build @@ -10,7 +10,7 @@ vala_sources = [ # LIBRARY, GIR, DEPS ] if enable_grlnet - vala_sources += ['grilo-net-@0@'.format(grl_majorminor), grlnet_gir[0], ['gio-2.0']] + vala_sources += [['grilo-net-@0@'.format(grl_majorminor), grlnet_gir[0], ['gio-2.0']]] endif foreach s: vala_sources ``` Sounds like a regression since custom_target() got ported to typed_kwargs(). Modules are creating ct without going through those decorators. @dcbaker I think the fix is to add a wrapper on ModuleState() object to create custom targets. Modules should stop using internal APIs like that. See ModuleState.test(), we did the same thing there. @xclaesse The plan is to make CustomTarget itself useful, we shouldn't have to add wrappers around the initialzers of internal class, they should stop doing the interpreter's job, stop taking a `kwargs`, and use keywords. I'll get it fixed. True, that's why state.test() takes python arguments instead of a kwargs dict, even if internally it goes back to a kwarg for now. I think we should still wrap that with a ModuleState method for CustomTarget too, one reason for that is I want - on the long term - get ride of ModuleReturnValue, ModuleState should be responsible of adding targets into the build list instead of process_new_values(). Not sure if that's the same issue, but I just saw this trying to build gtkmm 3.24.4 with meson 0.60: ``` 0.0 seconds starting phase `build' make all-recursive make[1]: Entering directory '/tmp/guix-build-gtkspell3-3.0.10.drv-0/gtkspell3-3.0.10' Making all in gtkspell make[2]: Entering directory '/tmp/guix-build-gtkspell3-3.0.10.drv-0/gtkspell3-3.0.10/gtkspell' CC libgtkspell3_3_la-gtkspell.lo CC libgtkspell3_3_la-gtkspell-codetable.lo GEN gtkspell3-3.0.deps autoreconf: running: aclocal --force --warnings=no-portability -I m4 aclocal: warning: autoconf input should be named 'configure.ac', not 'configure.in' gtkspell.c: In function ‘gtk_spell_checker_class_init’: gtkspell.c:860:3: warning: ‘g_type_class_add_private’ is deprecated [-Wdeprecated-declarations] 860 | g_type_class_add_private (klass, sizeof (GtkSpellCheckerPrivate)); | ^~~~~~~~~~~~~~~~~~~~~~~~ In file included from /gnu/store/l4zh3hgnykfrm0mlqzhf5bg2g5minkqs-glib-2.70.0/include/glib-2.0/gobject/gobject.h:24, from /gnu/store/l4zh3hgnykfrm0mlqzhf5bg2g5minkqs-glib-2.70.0/include/glib-2.0/gobject/gbinding.h:29, from /gnu/store/l4zh3hgnykfrm0mlqzhf5bg2g5minkqs-glib-2.70.0/include/glib-2.0/glib-object.h:22, from gtkspell.h:25, from gtkspell.c:23: /gnu/store/l4zh3hgnykfrm0mlqzhf5bg2g5minkqs-glib-2.70.0/include/glib-2.0/gobject/gtype.h:1346:10: note: declared here 1346 | void g_type_class_add_private (gpointer g_class, | ^~~~~~~~~~~~~~~~~~~~~~~~ gtkspell.c: In function ‘gtk_spell_checker_init’: gtkspell.c:904:13: warning: Deprecated pre-processor symbol: replace with "G_ADD_PRIVATE" 904 | self->priv = GTK_SPELL_CHECKER_GET_PRIVATE (self); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Traceback (most recent call last): File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/mesonmain.py", line 138, in run return options.run_func(options) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/msetup.py", line 294, in run app.generate() File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/msetup.py", line 185, in generate self._generate(env) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/msetup.py", line 229, in _generate intr.run() File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreter/interpreter.py", line 2484, in run super().run() File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 150, in run self.evaluate_codeblock(self.ast, start=1) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 175, in evaluate_codeblock raise e File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 168, in evaluate_codeblock self.evaluate_statement(cur) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 181, in evaluate_statement return self.function_call(cur) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 456, in function_call res = func(node, func_args, kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 713, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 115, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 276, in wrapper return f(*nargs, **wrapped_kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreter/interpreter.py", line 1969, in func_subdir self.evaluate_codeblock(codeblock) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 175, in evaluate_codeblock raise e File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 168, in evaluate_codeblock self.evaluate_statement(cur) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 191, in evaluate_statement return self.evaluate_if(cur) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 274, in evaluate_if self.evaluate_codeblock(i.block) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 175, in evaluate_codeblock raise e File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 168, in evaluate_codeblock self.evaluate_statement(cur) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 183, in evaluate_statement self.assignment(cur) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 568, in assignment value = self.evaluate_statement(node.value) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 185, in evaluate_statement return self.method_call(cur) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 484, in method_call res = obj.method_call(method_name, args, kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreter/interpreterobjects.py", line 754, in method_call ret = method(state, args, kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 713, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 115, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/modules/gnome.py", line 292, in compile_resources target_c = GResourceTarget(name, state.subdir, state.subproject, kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/modules/__init__.py", line 202, in __init__ super().__init__(name, subdir, subproject, kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/build.py", line 2330, in __init__ self.process_kwargs(kwargs, backend) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/build.py", line 2441, in process_kwargs if isinstance(kwargs['install_dir'], list): KeyError: 'install_dir' The Meson build system Version: 0.60.0 Source dir: /tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4 Build dir: /tmp/guix-build-gtkmm-3.24.4.drv-0/build Build type: native build Project name: gtkmm Project version: 3.24.4 C compiler for the host machine: gcc (gcc 10.3.0 "gcc (GCC) 10.3.0") C linker for the host machine: gcc ld.bfd 2.37 C++ compiler for the host machine: c++ (gcc 10.3.0 "c++ (GCC) 10.3.0") C++ linker for the host machine: c++ ld.bfd 2.37 Host machine cpu family: x86_64 Host machine cpu: x86_64 Program python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Found pkg-config: /gnu/store/wc7lqi6kgki5qzr01g3gvriwdadjiwpc-pkg-config-0.29.2/bin/pkg-config (0.29.2) Run-time dependency gtk+-3.0 found: YES 3.24.30 Run-time dependency cairomm-1.0 found: YES 1.14.2 Run-time dependency pangomm-1.4 found: YES 2.46.0 Run-time dependency gdk-pixbuf-2.0 found: YES 2.42.4 Run-time dependency atkmm-1.6 found: YES 2.28.1 Run-time dependency epoxy found: YES 1.5.5 Run-time dependency glibmm-2.4 found: YES 2.64.5 Run-time dependency giomm-2.4 found: YES 2.64.5 Run-time dependency gtk+-unix-print-3.0 found: YES 3.24.30 Program mm-common-get found: YES (/gnu/store/jgjk0xss7qw8fj0zz4hn8ai9dnq7vlbi-mm-common-1.0.3/bin/mm-common-get) Program m4 found: YES (/gnu/store/4xvaqcjyyrw6y1fwm3drl87xrz1vsln9-m4-1.4.18/bin/m4) Program perl found: YES (/gnu/store/k18as85v9s0z66w40wg9sym4c5qz03l2-perl-5.34.0/bin/perl) Program doxygen found: YES (/gnu/store/79lhh65z70qzwb0x4flgy1n4z05ypr4f-doxygen-1.9.1/bin/doxygen) Program dot found: YES (/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/bin/dot) Program xsltproc found: YES (/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/bin/xsltproc) Compiler for C++ supports arguments -Wall: YES ../gtkmm-3.24.4/meson.build:307: WARNING: Consider using the built-in warning_level option instead of using "-Wall". Library glibmm_generate_extra_defs-2.4 found: YES Configuring gdkmm-3.0.pc using configuration Configuring gdkmm-3.0-uninstalled.pc using configuration Configuring gdkmmconfig.h using configuration Configuring gdkmm.rc using configuration Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Configuring gtkmm-3.0.pc using configuration Configuring gtkmm-3.0-uninstalled.pc using configuration Configuring gtkmmconfig.h using configuration Configuring gtkmm.rc using configuration Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Found pkg-config: /gnu/store/wc7lqi6kgki5qzr01g3gvriwdadjiwpc-pkg-config-0.29.2/bin/pkg-config (0.29.2) Program glib-compile-resources found: YES (/gnu/store/w7a78mbizznxgykmqiia3l0bdyjpn675-glib-2.70.0-bin/bin/glib-compile-resources) error: in phase 'configure': uncaught exception: %exception #<&invoke-error program: "meson" arguments: ("--prefix=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4" "--buildtype=debugoptimized" "-Dc_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dcpp_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dbuild-documentation=true" "/tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4") exit-status: 2 term-signal: #f stop-signal: #f> phase `configure' failed after 1.2 seconds command "meson" "--prefix=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4" "--buildtype=debugoptimized" "-Dc_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dcpp_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dbuild-documentation=true" "/tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4" failed with status 2 builder for `/gnu/store/rp4pmx13wi8ahw781myiryxqb5r7mv33-gtkmm-3.24.4.drv' failed with exit code 1 build of /gnu/store/rp4pmx13wi8ahw781myiryxqb5r7mv33-gtkmm-3.24.4.drv failed View build log at '/var/log/guix/drvs/rp/4pmx13wi8ahw781myiryxqb5r7mv33-gtkmm-3.24.4.drv'. cannot build derivation `/gnu/store/xcwz5cznv97p6030wksj0x8rqc50k7y9-inkscape-1.1.drv': 1 dependencies couldn't be built cannot build derivation `/gnu/store/hqx4mbf6xd9giafjjvz57af41sj3v9kz-dblatex-0.3.12.drv': 1 dependencies couldn't be built cannot build derivation `/gnu/store/ls9qyw3alxm7vvj0brscxcdhkjj0qrqx-dblatex-0.3.12.drv': 1 dependencies couldn't be built cannot build derivation `/gnu/store/gg6x452zqilb4ckgvli5xdzl6naxqvv2-gtk-doc-1.33.2.drv': 1 dependencies couldn't be built cannot build derivation `/gnu/store/q2gb7xi10s1px246s65wv04waphk9yyl-gtk-doc-1.33.2.drv': 1 dependencies couldn't be built cannot build derivation `/gnu/store/xyl76zvjzyx2aas862nblvrr2za5hdxp-ibus-1.5.24.drv': 1 dependencies couldn't be built cannot build derivation `/gnu/store/s7sws9a019jpa1gycsshdqkmx0f5iviv-libical-3.0.10.drv': 1 dependencies couldn't be built cannot build derivation `/gnu/store/bplbpjlyhj3421wsaj510xn9n2l4yaz9-libnotify-0.7.9.drv': 1 dependencies couldn't be built cannot build derivation `/gnu/store/631m221qjkqr5g449xa0vcg8v7j0a1iz-network-manager-1.24.0.drv': 1 dependencies couldn't be built cannot build derivation `/gnu/store/y4ph9885j8ksyd7mg42l0lyi4q4zwlah-orc-0.4.32.drv': 1 dependencies couldn't be built cannot build derivation `/gnu/store/zxkbxvmxsaf2yv0dd4x4hysy3kcj65jg-bluez-5.61.drv': 1 dependencies couldn't be built cannot build derivation `/gnu/store/kh7bnm5yqa44n1zqri8r4xifvyvsqcxq-jami-qt-20210606.1.e2f9490.drv': 1 dependencies couldn't be built guix build: error: build of `/gnu/store/kh7bnm5yqa44n1zqri8r4xifvyvsqcxq-jami-qt-20210606.1.e2f9490.drv' failed mcournoyer@raisin ~/src/guix-core-updates-next [env]$ ./pre-inst-env guix build jami-qt ungoogled-chromium icecat cling^C mcournoyer@raisin ~/src/guix-core-updates-next [env]$ less /var/log/guix/drvs/rp/4pmx13wi8ahw781myiryxqb5r7mv33-gtkmm-3.24.4.drv WARNING: (guile-user): imported module (guix build utils) overrides core binding `delete' starting phase `set-SOURCE-DATE-EPOCH' phase `set-SOURCE-DATE-EPOCH' succeeded after 0.0 seconds starting phase `set-paths' environment variable `PATH' set to `/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/bin:/gnu/store/2vcx1im63fsm3w7yfwgq4az0jg87qvng-ninja-1.10.2/bin:/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/bin:/gnu/store/79lhh65z70qzwb0x4flgy1n4z05ypr4f-doxygen-1.9.1/bin:/gnu/store/w7a78mbizznxgykmqiia3l0bdyjpn675-glib-2.70.0-bin/bin:/gnu/store/4xvaqcjyyrw6y1fwm3drl87xrz1vsln9-m4-1.4.18/bin:/gnu/store/jgjk0xss7qw8fj0zz4hn8ai9dnq7vlbi-mm-common-1.0.3/bin:/gnu/store/k18as85v9s0z66w40wg9sym4c5qz03l2-perl-5.34.0/bin:/gnu/store/wc7lqi6kgki5qzr01g3gvriwdadjiwpc-pkg-config-0.29.2/bin:/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/bin:/gnu/store/fzzl2j23cjjr2srfwxbnbh5jq78vr42f-xorg-server-1.20.10/bin:/gnu/store/ikc2qn1h260f8mdhjz2cwndv2i7n753z-tar-1.34/bin:/gnu/store/v5l2251ck0r4n3w2rjw3l5dzyqsb9zj1-gzip-1.10/bin:/gnu/store/w6zv2mz56wyxr471q38a3cmzm4iqimy8-bzip2-1.0.8/bin:/gnu/store/72kpdqplq4nc87fm7ch47kxy3nlkzsyx-xz-5.2.5/bin:/gnu/store/jazwfsj2v41yih2yzw5nydqgdz1hgfm4-file-5.39/bin:/gnu/store/s49sxmz9g4xmzz222cay9k04ziy3qgmj-diffutils-3.8/bin:/gnu/store/m96snvbl92ivkd32giqh5f3d21bc2n5x-patch-2.7.6/bin:/gnu/store/l8l2y2dlya5rs9hfypmcb4saay7iwn0q-findutils-4.8.0/bin:/gnu/store/v45pjc1yqmy59j9ff913p3ywn9qk4lqx-gawk-5.1.0/bin:/gnu/store/7cddr79rydhc1m4hxr921mq17pz1jj3z-sed-4.8/bin:/gnu/store/ldkm5jwql0qsrfh3ax6rljjsrk0jzv7z-grep-3.6/bin:/gnu/store/25gv43v5rm05i26z39ajrd6nsxa5r461-coreutils-8.32/bin:/gnu/store/l8kxrs01lll3pzjrd590p45l8k045q6q-make-4.3/bin:/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/bin:/gnu/store/k452f0r5bk6n0cbsf5ndxbp5qcf6bpfw-ld-wrapper-0/bin:/gnu/store/6mqcv52gwn2dnbislgv9k99525mzmrrs-binutils-2.37/bin:/gnu/store/vakvgvrb839igv16jkif4lmx11d25jqb-gcc-10.3.0/bin:/gnu/store/2fk1gz2s7ppdicynscra9b19byrrr866-glibc-2.33/bin:/gnu/store/2fk1gz2s7ppdicynscra9b19byrrr866-glibc-2.33/sbin:/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin:/gnu/store/g9lfd19jck8rpxh8wmjbk8rdfcpsh7im-cairo-1.16.0/bin:/gnu/store/if7y9430fim7v0bxdzqhy3yjgsjl2whd-wayland-1.19.0/bin:/gnu/store/zcb10k8l85b4vwgr9s5kl7qwl6hchx37-pango-1.48.10/bin:/gnu/store/4qqz2mrmw92d6yn09fljjn9wpy075qgf-libxkbcommon-1.3.0/bin:/gnu/store/j4ndfdhyzl2az6hifgfh5fwwfhp87ykl-librsvg-2.50.7/bin:/gnu/store/375858dr3cqbwry58xcgc0776205p0mf-freetype-2.10.4/bin:/gnu/store/379xr5pkxprcamhlcbqz9nghj90qxw86-fontconfig-minimal-2.13.94/bin:/gnu/store/0h3ami2ijmyvkc63hk5sqsdh3qkrrcv0-fribidi-1.0.9/bin:/gnu/store/brpl5kly3c64ah2y9v3fgbwl32641c0f-libpng-1.6.37/bin:/gnu/store/p1ydkidsr8xkr8ymymzy3lhy2ajwpmiy-gdk-pixbuf-2.42.4/bin:/gnu/store/s0w7szfsajdy6cnrz2w7z4h5spyl4aaj-expat-2.4.1/bin:/gnu/store/xkfcl7pxgblc52hwzq5294r0m7fv53bq-libdatrie-0.2.13/bin:/gnu/store/7sik9fp2ffvnr7l01s423x4r5pn75rf9-icu4c-69.1/bin:/gnu/store/7sik9fp2ffvnr7l01s423x4r5pn75rf9-icu4c-69.1/sbin:/gnu/store/x0ixwynndmgzwjijhhzk703cfac8ygjd-graphite2-1.3.13/bin:/gnu/store/rj72k5d3kaigjvyyx58q7hbn8x9aslff-shared-mime-info-1.15/bin:/gnu/store/a68mx8v3ibbw8igmbfl29xc3r8qacb2n-dbus-1.12.20/bin' environment variable `XDG_DATA_DIRS' set to `/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/share:/gnu/store/2vcx1im63fsm3w7yfwgq4az0jg87qvng-ninja-1.10.2/share:/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/share:/gnu/store/79lhh65z70qzwb0x4flgy1n4z05ypr4f-doxygen-1.9.1/share:/gnu/store/4xvaqcjyyrw6y1fwm3drl87xrz1vsln9-m4-1.4.18/share:/gnu/store/jgjk0xss7qw8fj0zz4hn8ai9dnq7vlbi-mm-common-1.0.3/share:/gnu/store/k18as85v9s0z66w40wg9sym4c5qz03l2-perl-5.34.0/share:/gnu/store/wc7lqi6kgki5qzr01g3gvriwdadjiwpc-pkg-config-0.29.2/share:/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/share:/gnu/store/fzzl2j23cjjr2srfwxbnbh5jq78vr42f-xorg-server-1.20.10/share:/gnu/store/ma0zpvl77bsbdqzwchv8zj3504a85id6-atkmm-2.28.1/share:/gnu/store/0szh0b2fc08m8d7sphg3v9rkk526dxym-cairomm-1.14.2/share:/gnu/store/j1lfwcmmp1g5sy2m8g1glvzk834dv48r-glibmm-2.68.0/share:/gnu/store/aj3jcqff1l4g7fzsqa6y1yjbqiayyrgj-gtk+-3.24.30/share:/gnu/store/8pz417xcywz8s52pf0sjry8nm62v0zdf-pangomm-2.46.0/share:/gnu/store/ikc2qn1h260f8mdhjz2cwndv2i7n753z-tar-1.34/share:/gnu/store/v5l2251ck0r4n3w2rjw3l5dzyqsb9zj1-gzip-1.10/share:/gnu/store/w6zv2mz56wyxr471q38a3cmzm4iqimy8-bzip2-1.0.8/share:/gnu/store/72kpdqplq4nc87fm7ch47kxy3nlkzsyx-xz-5.2.5/share:/gnu/store/jazwfsj2v41yih2yzw5nydqgdz1hgfm4-file-5.39/share:/gnu/store/s49sxmz9g4xmzz222cay9k04ziy3qgmj-diffutils-3.8/share:/gnu/store/m96snvbl92ivkd32giqh5f3d21bc2n5x-patch-2.7.6/share:/gnu/store/l8l2y2dlya5rs9hfypmcb4saay7iwn0q-findutils-4.8.0/share:/gnu/store/v45pjc1yqmy59j9ff913p3ywn9qk4lqx-gawk-5.1.0/share:/gnu/store/7cddr79rydhc1m4hxr921mq17pz1jj3z-sed-4.8/share:/gnu/store/ldkm5jwql0qsrfh3ax6rljjsrk0jzv7z-grep-3.6/share:/gnu/store/25gv43v5rm05i26z39ajrd6nsxa5r461-coreutils-8.32/share:/gnu/store/l8kxrs01lll3pzjrd590p45l8k045q6q-make-4.3/share:/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/share:/gnu/store/6mqcv52gwn2dnbislgv9k99525mzmrrs-binutils-2.37/share:/gnu/store/vakvgvrb839igv16jkif4lmx11d25jqb-gcc-10.3.0/share:/gnu/store/2fk1gz2s7ppdicynscra9b19byrrr866-glibc-2.33/share:/gnu/store/3ywv7s8d38rgcq7ljmc1s084358a2m3h-glibc-2.33-static/share:/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/share:/gnu/store/2i0zpa5w320y8m4zbqk1va8vs6dbawv0-zlib-1.2.11/share:/gnu/store/vpps8gpd7xzj630ixalx7a5gc3bhbk1p-util-linux-2.37.1-lib/share:/gnu/store/g1klcqy022aybasx0p6xbk0kxyxnfxzs-pcre-8.45/share:/gnu/store/hbw4pf3plhab5kqyfpczl3mm0wr9rb39-libffi-3.3/share:/gnu/store/w6hgiyz99wlipjl93967li2z80vfl3gw-xorgproto-2021.4/share:/gnu/store/3nxgh1pmqg44f0ccg16ny4fs81mmafvq-pixman-0.40.0/share:/gnu/store/0kc479whbavx0drhvivahdppr2xmlcyb-mesa-21.2.4/share:/gnu/store/k2xykbwy7z5czrn1xf52fy1x9wdmbr9z-libpciaccess-0.16/share:/gnu/store/0rqgwbhbbpgnn7xygv7am1ljlzfpyb7q-atk-2.36.0/share:/gnu/store/y6bj01dx23smg7lf1jifql2a1hgmy9s4-glibmm-2.64.5/share:/gnu/store/g9lfd19jck8rpxh8wmjbk8rdfcpsh7im-cairo-1.16.0/share:/gnu/store/55wynb8361fq3p7alr8ii4z17fhw44fr-libsigc++-3.0.6/share:/gnu/store/gwsy836sazxn8gr0my9kcgjl971f5d4q-libsigc++-2.9.3/share:/gnu/store/l4zh3hgnykfrm0mlqzhf5bg2g5minkqs-glib-2.70.0/share:/gnu/store/2iy5hrrd581myawb2njjrsxz6zmz6wfm-wayland-protocols-1.23/share:/gnu/store/if7y9430fim7v0bxdzqhy3yjgsjl2whd-wayland-1.19.0/share:/gnu/store/zcb10k8l85b4vwgr9s5kl7qwl6hchx37-pango-1.48.10/share:/gnu/store/1kyfwib4r2sxfyvknfq4r5y5zqc4yddk-libxrender-0.9.10/share:/gnu/store/3dr3qqf6y1lppnshpn3v666z6998nzda-libxrandr-1.5.2/share:/gnu/store/4qqz2mrmw92d6yn09fljjn9wpy075qgf-libxkbcommon-1.3.0/share:/gnu/store/k3cyvfg33cfviiyv176jbg0yw1ipgq4l-libxinerama-1.1.4/share:/gnu/store/36lapwm1w5vi2vcpvxdrj468w0rqmjsr-libxi-1.7.10/share:/gnu/store/yh0pa3cm02qq6a4qxm60hin2qzfcvf8p-libxfixes-6.0.0/share:/gnu/store/zqg1vg42ympnp5398g1p61aqnfn20jyk-libxext-1.3.4/share:/gnu/store/q9n2gkcxx99qrfmh4xdq744qim4cc9rn-libxdamage-1.1.5/share:/gnu/store/mlpma06sa580l8l5mizx5bvm663i0wsk-libxcursor-1.2.0/share:/gnu/store/md29ch9fzxf5712vh42kn6rzw90pmdzy-libxcomposite-0.4.5/share:/gnu/store/xhl2apl68gqkkcqx7c4l78c82l9g5z09-libx11-1.7.2/share:/gnu/store/j4ndfdhyzl2az6hifgfh5fwwfhp87ykl-librsvg-2.50.7/share:/gnu/store/375858dr3cqbwry58xcgc0776205p0mf-freetype-2.10.4/share:/gnu/store/379xr5pkxprcamhlcbqz9nghj90qxw86-fontconfig-minimal-2.13.94/share:/gnu/store/0h3ami2ijmyvkc63hk5sqsdh3qkrrcv0-fribidi-1.0.9/share:/gnu/store/99a2njzz22dkzd8pz75fsi5nbgv9ww0x-linux-libre-headers-5.10.35/share:/gnu/store/39lk5jq66zvsk8r5yfrgmdwdi61gv5xd-util-macros-1.19.3/share:/gnu/store/5kyiwkbmwif4c36sv3qd252c08sb5ipr-libxxf86vm-1.1.4/share:/gnu/store/pblw05r4v2xz72cccv2mg5bh4vaxjrqr-libxshmfence-1.3/share:/gnu/store/xfb3dwr8qj17yqn0lys6bxwl4xvrmnxa-libdrm-2.4.107/share:/gnu/store/pzdnx43bkzpf8ka6hisgs72q6b9xzjf6-libxcb-1.14/share:/gnu/store/brpl5kly3c64ah2y9v3fgbwl32641c0f-libpng-1.6.37/share:/gnu/store/j623gzkdxbiaa04kv8gg6ca8c1fhqhfp-libxft-2.3.3/share:/gnu/store/nrpykryznfzz28gr45lmnfv7a4d9150r-libthai-0.1.28/share:/gnu/store/i7vlvvpr0bf1vzsp994340dcp3izwd95-harfbuzz-2.8.2/share:/gnu/store/p1ydkidsr8xkr8ymymzy3lhy2ajwpmiy-gdk-pixbuf-2.42.4/share:/gnu/store/s0w7szfsajdy6cnrz2w7z4h5spyl4aaj-expat-2.4.1/share:/gnu/store/1g2f2gy9mpnkl2w37j1vqslxakzlr8g8-at-spi2-core-2.40.0/share:/gnu/store/xfbpzv3m5pyhd4pk079v9fhqlp47143s-libxdmcp-1.1.3/share:/gnu/store/ka95pg02g2xv2a6bf56w7daghz3fk2xz-libxau-1.0.9/share:/gnu/store/8r97pw4h31vkkks40ysnlb53sr2cqi9y-libpthread-stubs-0.4/share:/gnu/store/xkfcl7pxgblc52hwzq5294r0m7fv53bq-libdatrie-0.2.13/share:/gnu/store/7sik9fp2ffvnr7l01s423x4r5pn75rf9-icu4c-69.1/share:/gnu/store/x0ixwynndmgzwjijhhzk703cfac8ygjd-graphite2-1.3.13/share:/gnu/store/rj72k5d3kaigjvyyx58q7hbn8x9aslff-shared-mime-info-1.15/share:/gnu/store/24r1mvps1i27831g3z7kq3ylajyq69g0-libxtst-1.2.3/share:/gnu/store/a68mx8v3ibbw8igmbfl29xc3r8qacb2n-dbus-1.12.20/share' environment variable `GIO_EXTRA_MODULES' unset environment variable `PERL5LIB' set to `/gnu/store/k18as85v9s0z66w40wg9sym4c5qz03l2-perl-5.34.0/lib/perl5/site_perl' environment variable `PKG_CONFIG_PATH' set to `/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/lib/pkgconfig:/gnu/store/jgjk0xss7qw8fj0zz4hn8ai9dnq7vlbi-mm-common-1.0.3/share/pkgconfig:/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/lib/pkgconfig:/gnu/store/fzzl2j23cjjr2srfwxbnbh5jq78vr42f-xorg-server-1.20.10/lib/pkgconfig:/gnu/store/ma0zpvl77bsbdqzwchv8zj3504a85id6-atkmm-2.28.1/lib/pkgconfig:/gnu/store/0szh0b2fc08m8d7sphg3v9rkk526dxym-cairomm-1.14.2/lib/pkgconfig:/gnu/store/j1lfwcmmp1g5sy2m8g1glvzk834dv48r-glibmm-2.68.0/lib/pkgconfig:/gnu/store/aj3jcqff1l4g7fzsqa6y1yjbqiayyrgj-gtk+-3.24.30/lib/pkgconfig:/gnu/store/8pz417xcywz8s52pf0sjry8nm62v0zdf-pangomm-2.46.0/lib/pkgconfig:/gnu/store/72kpdqplq4nc87fm7ch47kxy3nlkzsyx-xz-5.2.5/lib/pkgconfig:/gnu/store/jazwfsj2v41yih2yzw5nydqgdz1hgfm4-file-5.39/lib/pkgconfig:/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/lib/pkgconfig:/gnu/store/2i0zpa5w320y8m4zbqk1va8vs6dbawv0-zlib-1.2.11/lib/pkgconfig:/gnu/store/vpps8gpd7xzj630ixalx7a5gc3bhbk1p-util-linux-2.37.1-lib/lib/pkgconfig:/gnu/store/g1klcqy022aybasx0p6xbk0kxyxnfxzs-pcre-8.45/lib/pkgconfig:/gnu/store/hbw4pf3plhab5kqyfpczl3mm0wr9rb39-libffi-3.3/lib/pkgconfig:/gnu/store/w6hgiyz99wlipjl93967li2z80vfl3gw-xorgproto-2021.4/share/pkgconfig:/gnu/store/3nxgh1pmqg44f0ccg16ny4fs81mmafvq-pixman-0.40.0/lib/pkgconfig:/gnu/store/0kc479whbavx0drhvivahdppr2xmlcyb-mesa-21.2.4/lib/pkgconfig:/gnu/store/k2xykbwy7z5czrn1xf52fy1x9wdmbr9z-libpciaccess-0.16/lib/pkgconfig:/gnu/store/0rqgwbhbbpgnn7xygv7am1ljlzfpyb7q-atk-2.36.0/lib/pkgconfig:/gnu/store/y6bj01dx23smg7lf1jifql2a1hgmy9s4-glibmm-2.64.5/lib/pkgconfig:/gnu/store/g9lfd19jck8rpxh8wmjbk8rdfcpsh7im-cairo-1.16.0/lib/pkgconfig:/gnu/store/55wynb8361fq3p7alr8ii4z17fhw44fr-libsigc++-3.0.6/lib/pkgconfig:/gnu/store/gwsy836sazxn8gr0my9kcgjl971f5d4q-libsigc++-2.9.3/lib/pkgconfig:/gnu/store/l4zh3hgnykfrm0mlqzhf5bg2g5minkqs-glib-2.70.0/lib/pkgconfig:/gnu/store/2iy5hrrd581myawb2njjrsxz6zmz6wfm-wayland-protocols-1.23/share/pkgconfig:/gnu/store/if7y9430fim7v0bxdzqhy3yjgsjl2whd-wayland-1.19.0/lib/pkgconfig:/gnu/store/zcb10k8l85b4vwgr9s5kl7qwl6hchx37-pango-1.48.10/lib/pkgconfig:/gnu/store/1kyfwib4r2sxfyvknfq4r5y5zqc4yddk-libxrender-0.9.10/lib/pkgconfig:/gnu/store/3dr3qqf6y1lppnshpn3v666z6998nzda-libxrandr-1.5.2/lib/pkgconfig:/gnu/store/4qqz2mrmw92d6yn09fljjn9wpy075qgf-libxkbcommon-1.3.0/lib/pkgconfig:/gnu/store/k3cyvfg33cfviiyv176jbg0yw1ipgq4l-libxinerama-1.1.4/lib/pkgconfig:/gnu/store/36lapwm1w5vi2vcpvxdrj468w0rqmjsr-libxi-1.7.10/lib/pkgconfig:/gnu/store/yh0pa3cm02qq6a4qxm60hin2qzfcvf8p-libxfixes-6.0.0/lib/pkgconfig:/gnu/store/zqg1vg42ympnp5398g1p61aqnfn20jyk-libxext-1.3.4/lib/pkgconfig:/gnu/store/q9n2gkcxx99qrfmh4xdq744qim4cc9rn-libxdamage-1.1.5/lib/pkgconfig:/gnu/store/mlpma06sa580l8l5mizx5bvm663i0wsk-libxcursor-1.2.0/lib/pkgconfig:/gnu/store/md29ch9fzxf5712vh42kn6rzw90pmdzy-libxcomposite-0.4.5/lib/pkgconfig:/gnu/store/xhl2apl68gqkkcqx7c4l78c82l9g5z09-libx11-1.7.2/lib/pkgconfig:/gnu/store/k1d80vmiaixyqi5lrjqi18r5i9qhhaj1-libepoxy-1.5.5/lib/pkgconfig:/gnu/store/dhfmlvc8iyfs7c86nm6magglr835idpg-libcloudproviders-minimal-0.3.1/lib/pkgconfig:/gnu/store/j4ndfdhyzl2az6hifgfh5fwwfhp87ykl-librsvg-2.50.7/lib/pkgconfig:/gnu/store/375858dr3cqbwry58xcgc0776205p0mf-freetype-2.10.4/lib/pkgconfig:/gnu/store/379xr5pkxprcamhlcbqz9nghj90qxw86-fontconfig-minimal-2.13.94/lib/pkgconfig:/gnu/store/0h3ami2ijmyvkc63hk5sqsdh3qkrrcv0-fribidi-1.0.9/lib/pkgconfig:/gnu/store/sxp3lfbnyqzdq7m87qc23yaq1invxa14-at-spi2-atk-2.38.0/lib/pkgconfig:/gnu/store/39lk5jq66zvsk8r5yfrgmdwdi61gv5xd-util-macros-1.19.3/lib/pkgconfig:/gnu/store/5kyiwkbmwif4c36sv3qd252c08sb5ipr-libxxf86vm-1.1.4/lib/pkgconfig:/gnu/store/pblw05r4v2xz72cccv2mg5bh4vaxjrqr-libxshmfence-1.3/lib/pkgconfig:/gnu/store/h9mqw1kn1vs6jqzafaybi1gc846r148i-libvdpau-1.4/lib/pkgconfig:/gnu/store/xfb3dwr8qj17yqn0lys6bxwl4xvrmnxa-libdrm-2.4.107/lib/pkgconfig:/gnu/store/pzdnx43bkzpf8ka6hisgs72q6b9xzjf6-libxcb-1.14/lib/pkgconfig:/gnu/store/brpl5kly3c64ah2y9v3fgbwl32641c0f-libpng-1.6.37/lib/pkgconfig:/gnu/store/j623gzkdxbiaa04kv8gg6ca8c1fhqhfp-libxft-2.3.3/lib/pkgconfig:/gnu/store/nrpykryznfzz28gr45lmnfv7a4d9150r-libthai-0.1.28/lib/pkgconfig:/gnu/store/i7vlvvpr0bf1vzsp994340dcp3izwd95-harfbuzz-2.8.2/lib/pkgconfig:/gnu/store/p1ydkidsr8xkr8ymymzy3lhy2ajwpmiy-gdk-pixbuf-2.42.4/lib/pkgconfig:/gnu/store/s0w7szfsajdy6cnrz2w7z4h5spyl4aaj-expat-2.4.1/lib/pkgconfig:/gnu/store/1g2f2gy9mpnkl2w37j1vqslxakzlr8g8-at-spi2-core-2.40.0/lib/pkgconfig:/gnu/store/xfbpzv3m5pyhd4pk079v9fhqlp47143s-libxdmcp-1.1.3/lib/pkgconfig:/gnu/store/ka95pg02g2xv2a6bf56w7daghz3fk2xz-libxau-1.0.9/lib/pkgconfig:/gnu/store/8r97pw4h31vkkks40ysnlb53sr2cqi9y-libpthread-stubs-0.4/lib/pkgconfig:/gnu/store/xkfcl7pxgblc52hwzq5294r0m7fv53bq-libdatrie-0.2.13/lib/pkgconfig:/gnu/store/7sik9fp2ffvnr7l01s423x4r5pn75rf9-icu4c-69.1/lib/pkgconfig:/gnu/store/x0ixwynndmgzwjijhhzk703cfac8ygjd-graphite2-1.3.13/lib/pkgconfig:/gnu/store/rj72k5d3kaigjvyyx58q7hbn8x9aslff-shared-mime-info-1.15/share/pkgconfig:/gnu/store/24r1mvps1i27831g3z7kq3ylajyq69g0-libxtst-1.2.3/lib/pkgconfig:/gnu/store/a68mx8v3ibbw8igmbfl29xc3r8qacb2n-dbus-1.12.20/lib/pkgconfig' environment variable `GUIX_GTK3_PATH' set to `/gnu/store/aj3jcqff1l4g7fzsqa6y1yjbqiayyrgj-gtk+-3.24.30/lib/gtk-3.0' environment variable `BASH_LOADABLES_PATH' unset environment variable `C_INCLUDE_PATH' set to `/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/include:/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/include:/gnu/store/fzzl2j23cjjr2srfwxbnbh5jq78vr42f-xorg-server-1.20.10/include:/gnu/store/ma0zpvl77bsbdqzwchv8zj3504a85id6-atkmm-2.28.1/include:/gnu/store/0szh0b2fc08m8d7sphg3v9rkk526dxym-cairomm-1.14.2/include:/gnu/store/j1lfwcmmp1g5sy2m8g1glvzk834dv48r-glibmm-2.68.0/include:/gnu/store/aj3jcqff1l4g7fzsqa6y1yjbqiayyrgj-gtk+-3.24.30/include:/gnu/store/8pz417xcywz8s52pf0sjry8nm62v0zdf-pangomm-2.46.0/include:/gnu/store/w6zv2mz56wyxr471q38a3cmzm4iqimy8-bzip2-1.0.8/include:/gnu/store/72kpdqplq4nc87fm7ch47kxy3nlkzsyx-xz-5.2.5/include:/gnu/store/jazwfsj2v41yih2yzw5nydqgdz1hgfm4-file-5.39/include:/gnu/store/v45pjc1yqmy59j9ff913p3ywn9qk4lqx-gawk-5.1.0/include:/gnu/store/l8kxrs01lll3pzjrd590p45l8k045q6q-make-4.3/include:/gnu/store/6mqcv52gwn2dnbislgv9k99525mzmrrs-binutils-2.37/include:/gnu/store/vakvgvrb839igv16jkif4lmx11d25jqb-gcc-10.3.0/include:/gnu/store/2fk1gz2s7ppdicynscra9b19byrrr866-glibc-2.33/include:/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/include:/gnu/store/2i0zpa5w320y8m4zbqk1va8vs6dbawv0-zlib-1.2.11/include:/gnu/store/vpps8gpd7xzj630ixalx7a5gc3bhbk1p-util-linux-2.37.1-lib/include:/gnu/store/g1klcqy022aybasx0p6xbk0kxyxnfxzs-pcre-8.45/include:/gnu/store/hbw4pf3plhab5kqyfpczl3mm0wr9rb39-libffi-3.3/include:/gnu/store/w6hgiyz99wlipjl93967li2z80vfl3gw-xorgproto-2021.4/include:/gnu/store/3nxgh1pmqg44f0ccg16ny4fs81mmafvq-pixman-0.40.0/include:/gnu/store/0kc479whbavx0drhvivahdppr2xmlcyb-mesa-21.2.4/include:/gnu/store/k2xykbwy7z5czrn1xf52fy1x9wdmbr9z-libpciaccess-0.16/include:/gnu/store/0rqgwbhbbpgnn7xygv7am1ljlzfpyb7q-atk-2.36.0/include:/gnu/store/y6bj01dx23smg7lf1jifql2a1hgmy9s4-glibmm-2.64.5/include:/gnu/store/g9lfd19jck8rpxh8wmjbk8rdfcpsh7im-cairo-1.16.0/include:/gnu/store/55wynb8361fq3p7alr8ii4z17fhw44fr-libsigc++-3.0.6/include:/gnu/store/gwsy836sazxn8gr0my9kcgjl971f5d4q-libsigc++-2.9.3/include:/gnu/store/l4zh3hgnykfrm0mlqzhf5bg2g5minkqs-glib-2.70.0/include:/gnu/store/if7y9430fim7v0bxdzqhy3yjgsjl2whd-wayland-1.19.0/include:/gnu/store/zcb10k8l85b4vwgr9s5kl7qwl6hchx37-pango-1.48.10/include:/gnu/store/1kyfwib4r2sxfyvknfq4r5y5zqc4yddk-libxrender-0.9.10/include:/gnu/store/3dr3qqf6y1lppnshpn3v666z6998nzda-libxrandr-1.5.2/include:/gnu/store/4qqz2mrmw92d6yn09fljjn9wpy075qgf-libxkbcommon-1.3.0/include:/gnu/store/k3cyvfg33cfviiyv176jbg0yw1ipgq4l-libxinerama-1.1.4/include:/gnu/store/36lapwm1w5vi2vcpvxdrj468w0rqmjsr-libxi-1.7.10/include:/gnu/store/yh0pa3cm02qq6a4qxm60hin2qzfcvf8p-libxfixes-6.0.0/include:/gnu/store/zqg1vg42ympnp5398g1p61aqnfn20jyk-libxext-1.3.4/include:/gnu/store/q9n2gkcxx99qrfmh4xdq744qim4cc9rn-libxdamage-1.1.5/include:/gnu/store/mlpma06sa580l8l5mizx5bvm663i0wsk-libxcursor-1.2.0/include:/gnu/store/md29ch9fzxf5712vh42kn6rzw90pmdzy-libxcomposite-0.4.5/include:/gnu/store/xhl2apl68gqkkcqx7c4l78c82l9g5z09-libx11-1.7.2/include:/gnu/store/k1d80vmiaixyqi5lrjqi18r5i9qhhaj1-libepoxy-1.5.5/include:/gnu/store/dhfmlvc8iyfs7c86nm6magglr835idpg-libcloudproviders-minimal-0.3.1/include:/gnu/store/j4ndfdhyzl2az6hifgfh5fwwfhp87ykl-librsvg-2.50.7/include:/gnu/store/375858dr3cqbwry58xcgc0776205p0mf-freetype-2.10.4/include:/gnu/store/379xr5pkxprcamhlcbqz9nghj90qxw86-fontconfig-minimal-2.13.94/include:/gnu/store/0h3ami2ijmyvkc63hk5sqsdh3qkrrcv0-fribidi-1.0.9/include:/gnu/store/sxp3lfbnyqzdq7m87qc23yaq1invxa14-at-spi2-atk-2.38.0/include:/gnu/store/99a2njzz22dkzd8pz75fsi5nbgv9ww0x-linux-libre-headers-5.10.35/include:/gnu/store/5kyiwkbmwif4c36sv3qd252c08sb5ipr-libxxf86vm-1.1.4/include:/gnu/store/pblw05r4v2xz72cccv2mg5bh4vaxjrqr-libxshmfence-1.3/include:/gnu/store/h9mqw1kn1vs6jqzafaybi1gc846r148i-libvdpau-1.4/include:/gnu/store/xfb3dwr8qj17yqn0lys6bxwl4xvrmnxa-libdrm-2.4.107/include:/gnu/store/pzdnx43bkzpf8ka6hisgs72q6b9xzjf6-libxcb-1.14/include:/gnu/store/brpl5kly3c64ah2y9v3fgbwl32641c0f-libpng-1.6.37/include:/gnu/store/j623gzkdxbiaa04kv8gg6ca8c1fhqhfp-libxft-2.3.3/include:/gnu/store/nrpykryznfzz28gr45lmnfv7a4d9150r-libthai-0.1.28/include:/gnu/store/i7vlvvpr0bf1vzsp994340dcp3izwd95-harfbuzz-2.8.2/include:/gnu/store/p1ydkidsr8xkr8ymymzy3lhy2ajwpmiy-gdk-pixbuf-2.42.4/include:/gnu/store/s0w7szfsajdy6cnrz2w7z4h5spyl4aaj-expat-2.4.1/include:/gnu/store/1g2f2gy9mpnkl2w37j1vqslxakzlr8g8-at-spi2-core-2.40.0/include:/gnu/store/xfbpzv3m5pyhd4pk079v9fhqlp47143s-libxdmcp-1.1.3/include:/gnu/store/ka95pg02g2xv2a6bf56w7daghz3fk2xz-libxau-1.0.9/include:/gnu/store/xkfcl7pxgblc52hwzq5294r0m7fv53bq-libdatrie-0.2.13/include:/gnu/store/7sik9fp2ffvnr7l01s423x4r5pn75rf9-icu4c-69.1/include:/gnu/store/x0ixwynndmgzwjijhhzk703cfac8ygjd-graphite2-1.3.13/include:/gnu/store/24r1mvps1i27831g3z7kq3ylajyq69g0-libxtst-1.2.3/include:/gnu/store/a68mx8v3ibbw8igmbfl29xc3r8qacb2n-dbus-1.12.20/include' environment variable `CPLUS_INCLUDE_PATH' set to `/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/include:/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/include:/gnu/store/fzzl2j23cjjr2srfwxbnbh5jq78vr42f-xorg-server-1.20.10/include:/gnu/store/ma0zpvl77bsbdqzwchv8zj3504a85id6-atkmm-2.28.1/include:/gnu/store/0szh0b2fc08m8d7sphg3v9rkk526dxym-cairomm-1.14.2/include:/gnu/store/j1lfwcmmp1g5sy2m8g1glvzk834dv48r-glibmm-2.68.0/include:/gnu/store/aj3jcqff1l4g7fzsqa6y1yjbqiayyrgj-gtk+-3.24.30/include:/gnu/store/8pz417xcywz8s52pf0sjry8nm62v0zdf-pangomm-2.46.0/include:/gnu/store/w6zv2mz56wyxr471q38a3cmzm4iqimy8-bzip2-1.0.8/include:/gnu/store/72kpdqplq4nc87fm7ch47kxy3nlkzsyx-xz-5.2.5/include:/gnu/store/jazwfsj2v41yih2yzw5nydqgdz1hgfm4-file-5.39/include:/gnu/store/v45pjc1yqmy59j9ff913p3ywn9qk4lqx-gawk-5.1.0/include:/gnu/store/l8kxrs01lll3pzjrd590p45l8k045q6q-make-4.3/include:/gnu/store/6mqcv52gwn2dnbislgv9k99525mzmrrs-binutils-2.37/include:/gnu/store/vakvgvrb839igv16jkif4lmx11d25jqb-gcc-10.3.0/include/c++:/gnu/store/vakvgvrb839igv16jkif4lmx11d25jqb-gcc-10.3.0/include:/gnu/store/2fk1gz2s7ppdicynscra9b19byrrr866-glibc-2.33/include:/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/include:/gnu/store/2i0zpa5w320y8m4zbqk1va8vs6dbawv0-zlib-1.2.11/include:/gnu/store/vpps8gpd7xzj630ixalx7a5gc3bhbk1p-util-linux-2.37.1-lib/include:/gnu/store/g1klcqy022aybasx0p6xbk0kxyxnfxzs-pcre-8.45/include:/gnu/store/hbw4pf3plhab5kqyfpczl3mm0wr9rb39-libffi-3.3/include:/gnu/store/w6hgiyz99wlipjl93967li2z80vfl3gw-xorgproto-2021.4/include:/gnu/store/3nxgh1pmqg44f0ccg16ny4fs81mmafvq-pixman-0.40.0/include:/gnu/store/0kc479whbavx0drhvivahdppr2xmlcyb-mesa-21.2.4/include:/gnu/store/k2xykbwy7z5czrn1xf52fy1x9wdmbr9z-libpciaccess-0.16/include:/gnu/store/0rqgwbhbbpgnn7xygv7am1ljlzfpyb7q-atk-2.36.0/include:/gnu/store/y6bj01dx23smg7lf1jifql2a1hgmy9s4-glibmm-2.64.5/include:/gnu/store/g9lfd19jck8rpxh8wmjbk8rdfcpsh7im-cairo-1.16.0/include:/gnu/store/55wynb8361fq3p7alr8ii4z17fhw44fr-libsigc++-3.0.6/include:/gnu/store/gwsy836sazxn8gr0my9kcgjl971f5d4q-libsigc++-2.9.3/include:/gnu/store/l4zh3hgnykfrm0mlqzhf5bg2g5minkqs-glib-2.70.0/include:/gnu/store/if7y9430fim7v0bxdzqhy3yjgsjl2whd-wayland-1.19.0/include:/gnu/store/zcb10k8l85b4vwgr9s5kl7qwl6hchx37-pango-1.48.10/include:/gnu/store/1kyfwib4r2sxfyvknfq4r5y5zqc4yddk-libxrender-0.9.10/include:/gnu/store/3dr3qqf6y1lppnshpn3v666z6998nzda-libxrandr-1.5.2/include:/gnu/store/4qqz2mrmw92d6yn09fljjn9wpy075qgf-libxkbcommon-1.3.0/include:/gnu/store/k3cyvfg33cfviiyv176jbg0yw1ipgq4l-libxinerama-1.1.4/include:/gnu/store/36lapwm1w5vi2vcpvxdrj468w0rqmjsr-libxi-1.7.10/include:/gnu/store/yh0pa3cm02qq6a4qxm60hin2qzfcvf8p-libxfixes-6.0.0/include:/gnu/store/zqg1vg42ympnp5398g1p61aqnfn20jyk-libxext-1.3.4/include:/gnu/store/q9n2gkcxx99qrfmh4xdq744qim4cc9rn-libxdamage-1.1.5/include:/gnu/store/mlpma06sa580l8l5mizx5bvm663i0wsk-libxcursor-1.2.0/include:/gnu/store/md29ch9fzxf5712vh42kn6rzw90pmdzy-libxcomposite-0.4.5/include:/gnu/store/xhl2apl68gqkkcqx7c4l78c82l9g5z09-libx11-1.7.2/include:/gnu/store/k1d80vmiaixyqi5lrjqi18r5i9qhhaj1-libepoxy-1.5.5/include:/gnu/store/dhfmlvc8iyfs7c86nm6magglr835idpg-libcloudproviders-minimal-0.3.1/include:/gnu/store/j4ndfdhyzl2az6hifgfh5fwwfhp87ykl-librsvg-2.50.7/include:/gnu/store/375858dr3cqbwry58xcgc0776205p0mf-freetype-2.10.4/include:/gnu/store/379xr5pkxprcamhlcbqz9nghj90qxw86-fontconfig-minimal-2.13.94/include:/gnu/store/0h3ami2ijmyvkc63hk5sqsdh3qkrrcv0-fribidi-1.0.9/include:/gnu/store/sxp3lfbnyqzdq7m87qc23yaq1invxa14-at-spi2-atk-2.38.0/include:/gnu/store/99a2njzz22dkzd8pz75fsi5nbgv9ww0x-linux-libre-headers-5.10...skipping... gtkmm-3.24.4/untracked/gtk/gtkmm/treemodelsort.h gtkmm-3.24.4/untracked/gtk/gtkmm/treepath.cc gtkmm-3.24.4/untracked/gtk/gtkmm/treepath.h gtkmm-3.24.4/untracked/gtk/gtkmm/treerowreference.cc gtkmm-3.24.4/untracked/gtk/gtkmm/treerowreference.h gtkmm-3.24.4/untracked/gtk/gtkmm/treeselection.cc gtkmm-3.24.4/untracked/gtk/gtkmm/treeselection.h gtkmm-3.24.4/untracked/gtk/gtkmm/treesortable.cc gtkmm-3.24.4/untracked/gtk/gtkmm/treesortable.h gtkmm-3.24.4/untracked/gtk/gtkmm/treestore.cc gtkmm-3.24.4/untracked/gtk/gtkmm/treestore.h gtkmm-3.24.4/untracked/gtk/gtkmm/treeview.cc gtkmm-3.24.4/untracked/gtk/gtkmm/treeview.h gtkmm-3.24.4/untracked/gtk/gtkmm/treeviewcolumn.cc gtkmm-3.24.4/untracked/gtk/gtkmm/treeviewcolumn.h gtkmm-3.24.4/untracked/gtk/gtkmm/uimanager.cc gtkmm-3.24.4/untracked/gtk/gtkmm/uimanager.h gtkmm-3.24.4/untracked/gtk/gtkmm/viewport.cc gtkmm-3.24.4/untracked/gtk/gtkmm/viewport.h gtkmm-3.24.4/untracked/gtk/gtkmm/volumebutton.cc gtkmm-3.24.4/untracked/gtk/gtkmm/volumebutton.h gtkmm-3.24.4/untracked/gtk/gtkmm/widget.cc gtkmm-3.24.4/untracked/gtk/gtkmm/widget.h gtkmm-3.24.4/untracked/gtk/gtkmm/widgetpath.cc gtkmm-3.24.4/untracked/gtk/gtkmm/widgetpath.h gtkmm-3.24.4/untracked/gtk/gtkmm/window.cc gtkmm-3.24.4/untracked/gtk/gtkmm/window.h gtkmm-3.24.4/untracked/gtk/gtkmm/windowgroup.cc gtkmm-3.24.4/untracked/gtk/gtkmm/windowgroup.h gtkmm-3.24.4/untracked/gtk/gtkmm/wrap_init.cc phase `unpack' succeeded after 0.9 seconds starting phase `generate-gdk-pixbuf-loaders-cache-file' GDK_PIXBUF_MODULE_FILE set to `/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache' phase `generate-gdk-pixbuf-loaders-cache-file' succeeded after 0.2 seconds starting phase `patch-usr-bin-file' phase `patch-usr-bin-file' succeeded after 0.0 seconds starting phase `patch-source-shebangs' patch-shebang: ./autogen.sh: changing `/bin/sh' to `/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/bin/sh' patch-shebang: ./tools/dummy-header.py: changing `/usr/bin/env python3' to `/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3' patch-shebang: ./tools/gen_scripts/gdk_generate_docs.sh: changing `/bin/bash' to `/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/bin/bash' patch-shebang: ./tools/gen_scripts/gdk_generate_enums.sh: changing `/bin/bash' to `/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/bin/bash' patch-shebang: ./tools/gen_scripts/gdk_generate_extra_defs.sh: changing `/bin/bash' to `/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/bin/bash' patch-shebang: ./tools/gen_scripts/gdk_generate_methods.sh: changing `/bin/bash' to `/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/bin/bash' patch-shebang: ./tools/gen_scripts/generate_docs_and_defs.sh: changing `/bin/bash' to `/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/bin/bash' patch-shebang: ./tools/gen_scripts/gtk_generate_docs.sh: changing `/bin/bash' to `/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/bin/bash' patch-shebang: ./tools/gen_scripts/gtk_generate_enums.sh: changing `/bin/bash' to `/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/bin/bash' patch-shebang: ./tools/gen_scripts/gtk_generate_extra_defs.sh: changing `/bin/bash' to `/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/bin/bash' patch-shebang: ./tools/gen_scripts/gtk_generate_methods.sh: changing `/bin/bash' to `/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/bin/bash' patch-shebang: ./tools/gen_scripts/init_generate.sh: changing `/bin/bash' to `/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/bin/bash' patch-shebang: ./untracked/build_scripts/check-dllexport-usage.py: changing `/usr/bin/env python3' to `/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3' patch-shebang: ./untracked/build_scripts/dist-build-scripts.py: changing `/usr/bin/env python3' to `/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3' patch-shebang: ./untracked/build_scripts/dist-changelog.py: changing `/usr/bin/env python3' to `/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3' patch-shebang: ./untracked/build_scripts/doc-reference.py: changing `/usr/bin/env python3' to `/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3' patch-shebang: ./untracked/build_scripts/generate-binding.py: changing `/usr/bin/env python3' to `/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3' phase `patch-source-shebangs' succeeded after 0.2 seconds starting phase `configure' Traceback (most recent call last): File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/mesonmain.py", line 138, in run return options.run_func(options) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/msetup.py", line 294, in run app.generate() File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/msetup.py", line 185, in generate self._generate(env) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/msetup.py", line 229, in _generate intr.run() File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreter/interpreter.py", line 2484, in run super().run() File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 150, in run self.evaluate_codeblock(self.ast, start=1) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 175, in evaluate_codeblock raise e File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 168, in evaluate_codeblock self.evaluate_statement(cur) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 181, in evaluate_statement return self.function_call(cur) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 456, in function_call res = func(node, func_args, kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 713, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 115, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 276, in wrapper return f(*nargs, **wrapped_kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreter/interpreter.py", line 1969, in func_subdir self.evaluate_codeblock(codeblock) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 175, in evaluate_codeblock raise e File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 168, in evaluate_codeblock self.evaluate_statement(cur) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 191, in evaluate_statement return self.evaluate_if(cur) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 274, in evaluate_if self.evaluate_codeblock(i.block) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 175, in evaluate_codeblock raise e File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 168, in evaluate_codeblock self.evaluate_statement(cur) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 183, in evaluate_statement self.assignment(cur) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 568, in assignment value = self.evaluate_statement(node.value) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 185, in evaluate_statement return self.method_call(cur) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 484, in method_call res = obj.method_call(method_name, args, kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreter/interpreterobjects.py", line 754, in method_call ret = method(state, args, kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 713, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/interpreterbase/decorators.py", line 115, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/modules/gnome.py", line 292, in compile_resources target_c = GResourceTarget(name, state.subdir, state.subproject, kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/modules/__init__.py", line 202, in __init__ super().__init__(name, subdir, subproject, kwargs) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/build.py", line 2330, in __init__ self.process_kwargs(kwargs, backend) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/build.py", line 2441, in process_kwargs if isinstance(kwargs['install_dir'], list): KeyError: 'install_dir' The Meson build system Version: 0.60.0 Source dir: /tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4 Build dir: /tmp/guix-build-gtkmm-3.24.4.drv-0/build Build type: native build Project name: gtkmm Project version: 3.24.4 C compiler for the host machine: gcc (gcc 10.3.0 "gcc (GCC) 10.3.0") C linker for the host machine: gcc ld.bfd 2.37 C++ compiler for the host machine: c++ (gcc 10.3.0 "c++ (GCC) 10.3.0") C++ linker for the host machine: c++ ld.bfd 2.37 Host machine cpu family: x86_64 Host machine cpu: x86_64 Program python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Found pkg-config: /gnu/store/wc7lqi6kgki5qzr01g3gvriwdadjiwpc-pkg-config-0.29.2/bin/pkg-config (0.29.2) Run-time dependency gtk+-3.0 found: YES 3.24.30 Run-time dependency cairomm-1.0 found: YES 1.14.2 Run-time dependency pangomm-1.4 found: YES 2.46.0 Run-time dependency gdk-pixbuf-2.0 found: YES 2.42.4 Run-time dependency atkmm-1.6 found: YES 2.28.1 Run-time dependency epoxy found: YES 1.5.5 Run-time dependency glibmm-2.4 found: YES 2.64.5 Run-time dependency giomm-2.4 found: YES 2.64.5 Run-time dependency gtk+-unix-print-3.0 found: YES 3.24.30 Program mm-common-get found: YES (/gnu/store/jgjk0xss7qw8fj0zz4hn8ai9dnq7vlbi-mm-common-1.0.3/bin/mm-common-get) Program m4 found: YES (/gnu/store/4xvaqcjyyrw6y1fwm3drl87xrz1vsln9-m4-1.4.18/bin/m4) Program perl found: YES (/gnu/store/k18as85v9s0z66w40wg9sym4c5qz03l2-perl-5.34.0/bin/perl) Program doxygen found: YES (/gnu/store/79lhh65z70qzwb0x4flgy1n4z05ypr4f-doxygen-1.9.1/bin/doxygen) Program dot found: YES (/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/bin/dot) Program xsltproc found: YES (/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/bin/xsltproc) Compiler for C++ supports arguments -Wall: YES ../gtkmm-3.24.4/meson.build:307: WARNING: Consider using the built-in warning_level option instead of using "-Wall". Library glibmm_generate_extra_defs-2.4 found: YES Configuring gdkmm-3.0.pc using configuration Configuring gdkmm-3.0-uninstalled.pc using configuration Configuring gdkmmconfig.h using configuration Configuring gdkmm.rc using configuration Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Configuring gtkmm-3.0.pc using configuration Configuring gtkmm-3.0-uninstalled.pc using configuration Configuring gtkmmconfig.h using configuration Configuring gtkmm.rc using configuration Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Found pkg-config: /gnu/store/wc7lqi6kgki5qzr01g3gvriwdadjiwpc-pkg-config-0.29.2/bin/pkg-config (0.29.2) Program glib-compile-resources found: YES (/gnu/store/w7a78mbizznxgykmqiia3l0bdyjpn675-glib-2.70.0-bin/bin/glib-compile-resources) error: in phase 'configure': uncaught exception: %exception #<&invoke-error program: "meson" arguments: ("--prefix=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4" "--buildtype=debugoptimized" "-Dc_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dcpp_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dbuild-documentation=true" "/tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4") exit-status: 2 term-signal: #f stop-signal: #f> phase `configure' failed after 1.2 seconds command "meson" "--prefix=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4" "--buildtype=debugoptimized" "-Dc_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dcpp_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dbuild-documentation=true" "/tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4" failed with status 2 mcournoyer@raisin ~/src/guix-core-updates-next [env]$ less /var/log/guix/drvs/rp/4pmx13wi8ahw781myiryxqb5r7mv33-gtkmm-3.24.4.drv WARNING: (guile-user): imported module (guix build utils) overrides core binding `delete' starting phase `set-SOURCE-DATE-EPOCH' phase `set-SOURCE-DATE-EPOCH' succeeded after 0.0 seconds starting phase `set-paths' environment variable `PATH' set to `/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/bin:/gnu/store/2vcx1im63fsm3w7yfwgq4az0jg87qvng-ninja-1.10.2/bin:/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/bin:/gnu/store/79lhh65z70qzwb0x4flgy1n4z05ypr4f-doxygen-1.9.1/bin:/gnu/store/w7a78mbizznxgykmqiia3l0bdyjpn675-glib-2.70.0-bin/bin:/gnu/store/4xvaqcjyyrw6y1fwm3drl87xrz1vsln9-m4-1.4.18/bin:/gnu/store/jgjk0xss7qw8fj0zz4hn8ai9dnq7vlbi-mm-common-1.0.3/bin:/gnu/store/k18as85v9s0z66w40wg9sym4c5qz03l2-perl-5.34.0/bin:/gnu/store/wc7lqi6kgki5qzr01g3gvriwdadjiwpc-pkg-config-0.29.2/bin:/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/bin:/gnu/store/fzzl2j23cjjr2srfwxbnbh5jq78vr42f-xorg-server-1.20.10/bin:/gnu/store/ikc2qn1h260f8mdhjz2cwndv2i7n753z-tar-1.34/bin:/gnu/store/v5l2251ck0r4n3w2rjw3l5dzyqsb9zj1-gzip-1.10/bin:/gnu/store/w6zv2mz56wyxr471q38a3cmzm4iqimy8-bzip2-1.0.8/bin:/gnu/store/72kpdqplq4nc87fm7ch47kxy3nlkzsyx-xz-5.2.5/bin:/gnu/store/jazwfsj2v41yih2yzw5nydqgdz1hgfm4-file-5.39/bin:/gnu/store/s49sxmz9g4xmzz222cay9k04ziy3qgmj-diffutils-3.8/bin:/gnu/store/m96snvbl92ivkd32giqh5f3d21bc2n5x-patch-2.7.6/bin:/gnu/store/l8l2y2dlya5rs9hfypmcb4saay7iwn0q-findutils-4.8.0/bin:/gnu/store/v45pjc1yqmy59j9ff913p3ywn9qk4lqx-gawk-5.1.0/bin:/gnu/store/7cddr79rydhc1m4hxr921mq17pz1jj3z-sed-4.8/bin:/gnu/store/ldkm5jwql0qsrfh3ax6rljjsrk0jzv7z-grep-3.6/bin:/gnu/store/25gv43v5rm05i26z39ajrd6nsxa5r461-coreutils-8.32/bin:/gnu/store/l8kxrs01lll3pzjrd590p45l8k045q6q-make-4.3/bin:/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/bin:/gnu/store/k452f0r5bk6n0cbsf5ndxbp5qcf6bpfw-ld-wrapper-0/bin:/gnu/store/6mqcv52gwn2dnbislgv9k99525mzmrrs-binutils-2.37/bin:/gnu/store/vakvgvrb839igv16jkif4lmx11d25jqb-gcc-10.3.0/bin:/gnu/store/2fk1gz2s7ppdicynscra9b19byrrr866-glibc-2.33/bin:/gnu/store/2fk1gz2s7ppdicynscra9b19byrrr866-glibc-2.33/sbin:/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin:/gnu/store/g9lfd19jck8rpxh8wmjbk8rdfcpsh7im-cairo-1.16.0/bin:/gnu/store/if7y9430fim7v0bxdzqhy3yjgsjl2whd-wayland-1.19.0/bin:/gnu/store/zcb10k8l85b4vwgr9s5kl7qwl6hchx37-pango-1.48.10/bin:/gnu/store/4qqz2mrmw92d6yn09fljjn9wpy075qgf-libxkbcommon-1.3.0/bin:/gnu/store/j4ndfdhyzl2az6hifgfh5fwwfhp87ykl-librsvg-2.50.7/bin:/gnu/store/375858dr3cqbwry58xcgc0776205p0mf-freetype-2.10.4/bin:/gnu/store/379xr5pkxprcamhlcbqz9nghj90qxw86-fontconfig-minimal-2.13.94/bin:/gnu/store/0h3ami2ijmyvkc63hk5sqsdh3qkrrcv0-fribidi-1.0.9/bin:/gnu/store/brpl5kly3c64ah2y9v3fgbwl32641c0f-libpng-1.6.37/bin:/gnu/store/p1ydkidsr8xkr8ymymzy3lhy2ajwpmiy-gdk-pixbuf-2.42.4/bin:/gnu/store/s0w7szfsajdy6cnrz2w7z4h5spyl4aaj-expat-2.4.1/bin:/gnu/store/xkfcl7pxgblc52hwzq5294r0m7fv53bq-libdatrie-0.2.13/bin:/gnu/store/7sik9fp2ffvnr7l01s423x4r5pn75rf9-icu4c-69.1/bin:/gnu/store/7sik9fp2ffvnr7l01s423x4r5pn75rf9-icu4c-69.1/sbin:/gnu/store/x0ixwynndmgzwjijhhzk703cfac8ygjd-graphite2-1.3.13/bin:/gnu/store/rj72k5d3kaigjvyyx58q7hbn8x9aslff-shared-mime-info-1.15/bin:/gnu/store/a68mx8v3ibbw8igmbfl29xc3r8qacb2n-dbus-1.12.20/bin' environment variable `XDG_DATA_DIRS' set to `/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/share:/gnu/store/2vcx1im63fsm3w7yfwgq4az0jg87qvng-ninja-1.10.2/share:/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/share:/gnu/store/79lhh65z70qzwb0x4flgy1n4z05ypr4f-doxygen-1.9.1/share:/gnu/store/4xvaqcjyyrw6y1fwm3drl87xrz1vsln9-m4-1.4.18/share:/gnu/store/jgjk0xss7qw8fj0zz4hn8ai9dnq7vlbi-mm-common-1.0.3/share:/gnu/store/k18as85v9s0z66w40wg9sym4c5qz03l2-perl-5.34.0/share:/gnu/store/wc7lqi6kgki5qzr01g3gvriwdadjiwpc-pkg-config-0.29.2/share:/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/share:/gnu/store/fzzl2j23cjjr2srfwxbnbh5jq78vr42f-xorg-server-1.20.10/share:/gnu/store/ma0zpvl77bsbdqzwchv8zj3504a85id6-atkmm-2.28.1/share:/gnu/store/0szh0b2fc08m8d7sphg3v9rkk526dxym-cairomm-1.14.2/share:/gnu/store/j1lfwcmmp1g5sy2m8g1glvzk834dv48r-glibmm-2.68.0/share:/gnu/store/aj3jcqff1l4g7fzsqa6y1yjbqiayyrgj-gtk+-3.24.30/share:/gnu/store/8pz417xcywz8s52pf0sjry8nm62v0zdf-pangomm-2.46.0/share:/gnu/store/ikc2qn1h260f8mdhjz2cwndv2i7n753z-tar-1.34/share:/gnu/store/v5l2251ck0r4n3w2rjw3l5dzyqsb9zj1-gzip-1.10/share:/gnu/store/w6zv2mz56wyxr471q38a3cmzm4iqimy8-bzip2-1.0.8/share:/gnu/store/72kpdqplq4nc87fm7ch47kxy3nlkzsyx-xz-5.2.5/share:/gnu/store/jazwfsj2v41yih2yzw5nydqgdz1hgfm4-file-5.39/share:/gnu/store/s49sxmz9g4xmzz222cay9k04ziy3qgmj-diffutils-3.8/share:/gnu/store/m96snvbl92ivkd32giqh5f3d21bc2n5x-patch-2.7.6/share:/gnu/store/l8l2y2dlya5rs9hfypmcb4saay7iwn0q-findutils-4.8.0/share:/gnu/store/v45pjc1yqmy59j9ff913p3ywn9qk4lqx-gawk-5.1.0/share:/gnu/store/7cddr79rydhc1m4hxr921mq17pz1jj3z-sed-4.8/share:/gnu/store/ldkm5jwql0qsrfh3ax6rljjsrk0jzv7z-grep-3.6/share:/gnu/store/25gv43v5rm05i26z39ajrd6nsxa5r461-coreutils-8.32/share:/gnu/store/l8kxrs01lll3pzjrd590p45l8k045q6q-make-4.3/share:/gnu/store/vx6vfbmmazvfi7vp8xyjn2mcyylvw9gn-bash-minimal-5.1.8/share:/gnu/store/6mqcv52gwn2dnbislgv9k99525mzmrrs-binutils-2.37/share:/gnu/store/vakvgvrb839igv16jkif4lmx11d25jqb-gcc-10.3.0/share:/gnu/store/2fk1gz2s7ppdicynscra9b19byrrr866-glibc-2.33/share:/gnu/store/3ywv7s8d38rgcq7ljmc1s084358a2m3h-glibc-2.33-static/share:/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/share:/gnu/store/2i0zpa5w320y8m4zbqk1va8vs6dbawv0-zlib-1.2.11/share:/gnu/store/vpps8gpd7xzj630ixalx7a5gc3bhbk1p-util-linux-2.37.1-lib/share:/gnu/store/g1klcqy022aybasx0p6xbk0kxyxnfxzs-pcre-8.45/share:/gnu/store/hbw4pf3plhab5kqyfpczl3mm0wr9rb39-libffi-3.3/share:/gnu/store/w6hgiyz99wlipjl93967li2z80vfl3gw-xorgproto-2021.4/share:/gnu/store/3nxgh1pmqg44f0ccg16ny4fs81mmafvq-pixman-0.40.0/share:/gnu/store/0kc479whbavx0drhvivahdppr2xmlcyb-mesa-21.2.4/share:/gnu/store/k2xykbwy7z5czrn1xf52fy1x9wdmbr9z-libpciaccess-0.16/share:/gnu/store/0rqgwbhbbpgnn7xygv7am1ljlzfpyb7q-atk-2.36.0/share:/gnu/store/y6bj01dx23smg7lf1jifql2a1hgmy9s4-glibmm-2.64.5/share:/gnu/store/g9lfd19jck8rpxh8wmjbk8rdfcpsh7im-cairo-1.16.0/share:/gnu/store/55wynb8361fq3p7alr8ii4z17fhw44fr-libsigc++-3.0.6/share:/gnu/store/gwsy836sazxn8gr0my9kcgjl971f5d4q-libsigc++-2.9.3/share:/gnu/store/l4zh3hgnykfrm0mlqzhf5bg2g5minkqs-glib-2.70.0/share:/gnu/store/2iy5hrrd581myawb2njjrsxz6zmz6wfm-wayland-protocols-1.23/share:/gnu/store/if7y9430fim7v0bxdzqhy3yjgsjl2whd-wayland-1.19.0/share:/gnu/store/zcb10k8l85b4vwgr9s5kl7qwl6hchx37-pango-1.48.10/share:/gnu/store/1kyfwib4r2sxfyvknfq4r5y5zqc4yddk-libxrender-0.9.10/share:/gnu/store/3dr3qqf6y1lppnshpn3v666z6998nzda-libxrandr-1.5.2/share:/gnu/store/4qqz2mrmw92d6yn09fljjn9wpy075qgf-libxkbcommon-1.3.0/share:/gnu/store/k3cyvfg33cfviiyv176jbg0yw1ipgq4l-libxinerama-1.1.4/share:/gnu/store/36lapwm1w5vi2vcpvxdrj468w0rqmjsr-libxi-1.7.10/share:/gnu/store/yh0pa3cm02qq6a4qxm60hin2qzfcvf8p-libxfixes-6.0.0/share:/gnu/store/zqg1vg42ympnp5398g1p61aqnfn20jyk-libxext-1.3.4/share:/gnu/store/q9n2gkcxx99qrfmh4xdq744qim4cc9rn-libxdamage-1.1.5/share:/gnu/store/mlpma06sa580l8l5mizx5bvm663i0wsk-libxcursor-1.2.0/share:/gnu/store/md29ch9fzxf5712vh42kn6rzw90pmdzy-libxcomposite-0.4.5/share:/gnu/store/xhl2apl68gqkkcqx7c4l78c82l9g5z09-libx11-1.7.2/share:/gnu/store/j4ndfdhyzl2az6hifgfh5fwwfhp87ykl-librsvg-2.50.7/share:/gnu/store/375858dr3cqbwry58xcgc0776205p0mf-freetype-2.10.4/share:/gnu/store/379xr5pkxprcamhlcbqz9nghj90qxw86-fontconfig-minimal-2.13.94/share:/gnu/store/0h3ami2ijmyvkc63hk5sqsdh3qkrrcv0-fribidi-1.0.9/share:/gnu/store/99a2njzz22dkzd8pz75fsi5nbgv9ww0x-linux-libre-headers-5.10.35/share:/gnu/store/39lk5jq66zvsk8r5yfrgmdwdi61gv5xd-util-macros-1.19.3/share:/gnu/store/5kyiwkbmwif4c36sv3qd252c08sb5ipr-libxxf86vm-1.1.4/share:/gnu/store/pblw05r4v2xz72cccv2mg5bh4vaxjrqr-libxshmfence-1.3/share:/gnu/store/xfb3dwr8qj17yqn0lys6bxwl4xvrmnxa-libdrm-2.4.107/share:/gnu/store/pzdnx43bkzpf8ka6hisgs72q6b9xzjf6-libxcb-1.14/share:/gnu/store/brpl5kly3c64ah2y9v3fgbwl32641c0f-libpng-1.6.37/share:/gnu/store/j623gzkdxbiaa04kv8gg6ca8c1fhqhfp-libxft-2.3.3/share:/gnu/store/nrpykryznfzz28gr45lmnfv7a4d9150r-libthai-0.1.28/share:/gnu/store/i7vlvvpr0bf1vzsp994340dcp3izwd95-harfbuzz-2.8.2/share:/gnu/store/p1ydkidsr8xkr8ymymzy3lhy2ajwpmiy-gdk-pixbuf-2.42.4/share:/gnu/store/s0w7szfsajdy6cnrz2w7z4h5spyl4aaj-expat-2.4.1/share:/gnu/store/1g2f2gy9mpnkl2w37j1vqslxakzlr8g8-at-spi2-core-2.40.0/share:/gnu/store/xfbpzv3m5pyhd4pk079v9fhqlp47143s-libxdmcp-1.1.3/share:/gnu/store/ka95pg02g2xv2a6bf56w7daghz3fk2xz-libxau-1.0.9/share:/gnu/store/8r97pw4h31vkkks40ysnlb53sr2cqi9y-libpthread-stubs-0.4/share:/gnu/store/xkfcl7pxgblc52hwzq5294r0m7fv53bq-libdatrie-0.2.13/share:/gnu/store/7sik9fp2ffvnr7l01s423x4r5pn75rf9-icu4c-69.1/share:/gnu/store/x0ixwynndmgzwjijhhzk703cfac8ygjd-graphite2-1.3.13/share:/gnu/store/rj72k5d3kaigjvyyx58q7hbn8x9aslff-shared-mime-info-1.15/share:/gnu/store/24r1mvps1i27831g3z7kq3ylajyq69g0-libxtst-1.2.3/share:/gnu/store/a68mx8v3ibbw8igmbfl29xc3r8qacb2n-dbus-1.12.20/share' environment variable `GIO_EXTRA_MODULES' unset environment variable `PERL5LIB' set to `/gnu/store/k18as85v9s0z66w40wg9sym4c5qz03l2-perl-5.34.0/lib/perl5/site_perl' environment variable `PKG_CONFIG_PATH' set to `/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/lib/pkgconfig:/gnu/store/jgjk0xss7qw8fj0zz4hn8ai9dnq7vlbi-mm-common-1.0.3/share/pkgconfig:/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/lib/pkgconfig:/gnu/store/fzzl2j23cjjr2srfwxbnbh5jq78vr42f-xorg-server-1.20.10/lib/pkgconfig:/gnu/store/ma0zpvl77bsbdqzwchv8zj3504a85id6-atkmm-2.28.1/lib/pkgconfig:/gnu/store/0szh0b2fc08m8d7sphg3v9rkk526dxym-cairomm-1.14.2/lib/pkgconfig:/gnu/store/j1lfwcmmp1g5sy2m8g1glvzk834dv48r-glibmm-2.68.0/lib/pkgconfig:/gnu/store/aj3jcqff1l4g7fzsqa6y1yjbqiayyrgj-gtk+-3.24.30/lib/pkgconfig:/gnu/store/8pz417xcywz8s52pf0sjry8nm62v0zdf-pangomm-2.46.0/lib/pkgconfig:/gnu/store/72kpdqplq4nc87fm7ch47kxy3nlkzsyx-xz-5.2.5/lib/pkgconfig:/gnu/store/jazwfsj2v41yih2yzw5nydqgdz1hgfm4-file-5.39/lib/pkgconfig:/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/lib/pkgconfig:/gnu/store/2i0zpa5w320y8m4zbqk1va8vs6dbawv0-zlib-1.2.11/lib/pkgconfig:/gnu/store/vpps8gpd7xzj630ixalx7a5gc3bhbk1p-util-linux-2.37.1-lib/lib/pkgconfig:/gnu/store/g1klcqy022aybasx0p6xbk0kxyxnfxzs-pcre-8.45/lib/pkgconfig:/gnu/store/hbw4pf3plhab5kqyfpczl3mm0wr9rb39-libffi-3.3/lib/pkgconfig:/gnu/store/w6hgiyz99wlipjl93967li2z80vfl3gw-xorgproto-2021.4/share/pkgconfig:/gnu/store/3nxgh1pmqg44f0ccg16ny4fs81mmafvq-pixman-0.40.0/lib/pkgconfig:/gnu/store/0kc479whbavx0drhvivahdppr2xmlcyb-mesa-21.2.4/lib/pkgconfig:/gnu/store/k2xykbwy7z5czrn1xf52fy1x9wdmbr9z-libpciaccess-0.16/lib/pkgconfig:/gnu/store/0rqgwbhbbpgnn7xygv7am1ljlzfpyb7q-atk-2.36.0/lib/pkgconfig:/gnu/store/y6bj01dx23smg7lf1jifql2a1hgmy9s4-glibmm-2.64.5/lib/pkgconfig:/gnu/store/g9lfd19jck8rpxh8wmjbk8rdfcpsh7im-cairo-1.16.0/lib/pkgconfig:/gnu/store/55wynb8361fq3p7alr8ii4z17fhw44fr-libsigc++-3.0.6/lib/pkgconfig:/gnu/store/gwsy836sazxn8gr0my9kcgjl971f5d4q-libsigc++-2.9.3/lib/pkgconfig:/gnu/store/l4zh3hgnykfrm0mlqzhf5bg2g5minkqs-glib-2.70.0/lib/pkgconfig:/gnu/store/2iy5hrrd581myawb2njjrsxz6zmz6wfm-wayland-protocols-1.23/share/pkgconfig:/gnu/store/if7y9430fim7v0bxdzqhy3yjgsjl2whd-wayland-1.19.0/lib/pkgconfig:/gnu/store/zcb10k8l85b4vwgr9s5kl7qwl6hchx37-pango-1.48.10/lib/pkgconfig:/gnu/store/1kyfwib4r2sxfyvknfq4r5y5zqc4yddk-libxrender-0.9.10/lib/pkgconfig:/gnu/store/3dr3qqf6y1lppnshpn3v666z6998nzda-libxrandr-1.5.2/lib/pkgconfig:/gnu/store/4qqz2mrmw92d6yn09fljjn9wpy075qgf-libxkbcommon-1.3.0/lib/pkgconfig:/gnu/store/k3cyvfg33cfviiyv176jbg0yw1ipgq4l-libxinerama-1.1.4/lib/pkgconfig:/gnu/store/36lapwm1w5vi2vcpvxdrj468w0rqmjsr-libxi-1.7.10/lib/pkgconfig:/gnu/store/yh0pa3cm02qq6a4qxm60hin2qzfcvf8p-libxfixes-6.0.0/lib/pkgconfig:/gnu/store/zqg1vg42ympnp5398g1p61aqnfn20jyk-libxext-1.3.4/lib/pkgconfig:/gnu/store/q9n2gkcxx99qrfmh4xdq744qim4cc9rn-libxdamage-1.1.5/lib/pkgconfig:/gnu/store/mlpma06sa580l8l5mizx5bvm663i0wsk-libxcursor-1.2.0/lib/pkgconfig:/gnu/store/md29ch9fzxf5712vh42kn6rzw90pmdzy-libxcomposite-0.4.5/lib/pkgconfig:/gnu/store/xhl2apl68gqkkcqx7c4l78c82l9g5z09-libx11-1.7.2/lib/pkgconfig:/gnu/store/k1d80vmiaixyqi5lrjqi18r5i9qhhaj1-libepoxy-1.5.5/lib/pkgconfig:/gnu/store/dhfmlvc8iyfs7c86nm6magglr835idpg-libcloudproviders-minimal-0.3.1/lib/pkgconfig:/gnu/store/j4ndfdhyzl2az6hifgfh5fwwfhp87ykl-librsvg-2.50.7/lib/pkgconfig:/gnu/store/375858dr3cqbwry58xcgc0776205p0mf-freetype-2.10.4/lib/pkgconfig:/gnu/store/379xr5pkxprcamhlcbqz9nghj90qxw86-fontconfig-minimal-2.13.94/lib/pkgconfig:/gnu/store/0h3ami2ijmyvkc63hk5sqsdh3qkrrcv0-fribidi-1.0.9/lib/pkgconfig:/gnu/store/sxp3lfbnyqzdq7m87qc23yaq1invxa14-at-spi2-atk-2.38.0/lib/pkgconfig:/gnu/store/39lk5jq66zvsk8r5yfrgmdwdi61gv5xd-util-macros-1.19.3/lib/pkgconfig:/gnu/store/5kyiwkbmwif4c36sv3qd252c08sb5ipr-libxxf86vm-1.1.4/lib/pkgconfig:/gnu/store/pblw05r4v2xz72cccv2mg5bh4vaxjrqr-libxshmfence-1.3/lib/pkgconfig:/gnu/store/h9mqw1kn1vs6jqzafaybi1gc846r148i-libvdpau-1.4/lib/pkgconfig:/gnu/store/xfb3dwr8qj17yqn0lys6bxwl4xvrmnxa-libdrm-2.4.107/lib/pkgconfig:/gnu/store/pzdnx43bkzpf8ka6hisgs72q6b9xzjf6-libxcb-1.14/lib/pkgconfig:/gnu/store/brpl5kly3c64ah2y9v3fgbwl32641c0f-libpng-1.6.37/lib/pkgconfig:/gnu/store/j623gzkdxbiaa04kv8gg6ca8c1fhqhfp-libxft-2.3.3/lib/pkgconfig:/gnu/store/nrpykryznfzz28gr45lmnfv7a4d9150r-libthai-0.1.28/lib/pkgconfig:/gnu/store/i7vlvvpr0bf1vzsp994340dcp3izwd95-harfbuzz-2.8.2/lib/pkgconfig:/gnu/store/p1ydkidsr8xkr8ymymzy3lhy2ajwpmiy-gdk-pixbuf-2.42.4/lib/pkgconfig:/gnu/store/s0w7szfsajdy6cnrz2w7z4h5spyl4aaj-expat-2.4.1/lib/pkgconfig:/gnu/store/1g2f2gy9mpnkl2w37j1vqslxakzlr8g8-at-spi2-core-2.40.0/lib/pkgconfig:/gnu/store/xfbpzv3m5pyhd4pk079v9fhqlp47143s-libxdmcp-1.1.3/lib/pkgconfig:/gnu/store/ka95pg02g2xv2a6bf56w7daghz3fk2xz-libxau-1.0.9/lib/pkgconfig:/gnu/store/8r97pw4h31vkkks40ysnlb53sr2cqi9y-libpthread-stubs-0.4/lib/pkgconfig:/gnu/store/xkfcl7pxgblc52hwzq5294r0m7fv53bq-libdatrie-0.2.13/lib/pkgconfig:/gnu/store/7sik9fp2ffvnr7l01s423x4r5pn75rf9-icu4c-69.1/lib/pkgconfig:/gnu/store/x0ixwynndmgzwjijhhzk703cfac8ygjd-graphite2-1.3.13/lib/pkgconfig:/gnu/store/rj72k5d3kaigjvyyx58q7hbn8x9aslff-shared-mime-info-1.15/share/pkgconfig:/gnu/store/24r1mvps1i27831g3z7kq3ylajyq69g0-libxtst-1.2.3/lib/pkgconfig:/gnu/store/a68mx8v3ibbw8igmbfl29xc3r8qacb2n-dbus-1.12.20/lib/pkgconfig' environment variable `GUIX_GTK3_PATH' set to `/gnu/store/aj3jcqff1l4g7fzsqa6y1yjbqiayyrgj-gtk+-3.24.30/lib/gtk-3.0' environment variable `BASH_LOADABLES_PATH' unset environment variable `C_INCLUDE_PATH' set to `/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/include:/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/include:/gnu/store/fzzl2j23cjjr2srfwxbnbh5jq78vr42f-xorg-server-1.20.10/include:/gnu/store/ma0zpvl77bsbdqzwchv8zj3504a85id6-atkmm-2.28.1/include:/gnu/store/0szh0b2fc08m8d7sphg3v9rkk526dxym-cairomm-1.14.2/include:/gnu/store/j1lfwcmmp1g5sy2m8g1glvzk834dv48r-glibmm-2.68.0/include:/gnu/store/aj3jcqff1l4g7fzsqa6y1yjbqiayyrgj-gtk+-3.24.30/include:/gnu/store/8pz417xcywz8s52pf0sjry8nm62v0zdf-pangomm-2.46.0/include:/gnu/store/w6zv2mz56wyxr471q38a3cmzm4iqimy8-bzip2-1.0.8/include:/gnu/store/72kpdqplq4nc87fm7ch47kxy3nlkzsyx-xz-5.2.5/include:/gnu/store/jazwfsj2v41yih2yzw5nydqgdz1hgfm4-file-5.39/include:/gnu/store/v45pjc1yqmy59j9ff913p3ywn9qk4lqx-gawk-5.1.0/include:/gnu/store/l8kxrs01lll3pzjrd590p45l8k045q6q-make-4.3/include:/gnu/store/6mqcv52gwn2dnbislgv9k99525mzmrrs-binutils-2.37/include:/gnu/store/vakvgvrb839igv16jkif4lmx11d25jqb-gcc-10.3.0/include:/gnu/store/2fk1gz2s7ppdicynscra9b19byrrr866-glibc-2.33/include:/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/include:/gnu/store/2i0zpa5w320y8m4zbqk1va8vs6dbawv0-zlib-1.2.11/include:/gnu/store/vpps8gpd7xzj630ixalx7a5gc3bhbk1p-util-linux-2.37.1-lib/include:/gnu/store/g1klcqy022aybasx0p6xbk0kxyxnfxzs-pcre-8.45/include:/gnu/store/hbw4pf3plhab5kqyfpczl3mm0wr9rb39-libffi-3.3/include:/gnu/store/w6hgiyz99wlipjl93967li2z80vfl3gw-xorgproto-2021.4/include:/gnu/store/3nxgh1pmqg44f0ccg16ny4fs81mmafvq-pixman-0.40.0/include:/gnu/store/0kc479whbavx0drhvivahdppr2xmlcyb-mesa-21.2.4/include:/gnu/store/k2xykbwy7z5czrn1xf52fy1x9wdmbr9z-libpciaccess-0.16/include:/gnu/store/0rqgwbhbbpgnn7xygv7am1ljlzfpyb7q-atk-2.36.0/include:/gnu/store/y6bj01dx23smg7lf1jifql2a1hgmy9s4-glibmm-2.64.5/include:/gnu/store/g9lfd19jck8rpxh8wmjbk8rdfcpsh7im-cairo-1.16.0/include:/gnu/store/55wynb8361fq3p7alr8ii4z17fhw44fr-libsigc++-3.0.6/include:/gnu/store/gwsy836sazxn8gr0my9kcgjl971f5d4q-libsigc++-2.9.3/include:/gnu/store/l4zh3hgnykfrm0mlqzhf5bg2g5minkqs-glib-2.70.0/include:/gnu/store/if7y9430fim7v0bxdzqhy3yjgsjl2whd-wayland-1.19.0/include:/gnu/store/zcb10k8l85b4vwgr9s5kl7qwl6hchx37-pango-1.48.10/include:/gnu/store/1kyfwib4r2sxfyvknfq4r5y5zqc4yddk-libxrender-0.9.10/include:/gnu/store/3dr3qqf6y1lppnshpn3v666z6998nzda-libxrandr-1.5.2/include:/gnu/store/4qqz2mrmw92d6yn09fljjn9wpy075qgf-libxkbcommon-1.3.0/include:/gnu/store/k3cyvfg33cfviiyv176jbg0yw1ipgq4l-libxinerama-1.1.4/include:/gnu/store/36lapwm1w5vi2vcpvxdrj468w0rqmjsr-libxi-1.7.10/include:/gnu/store/yh0pa3cm02qq6a4qxm60hin2qzfcvf8p-libxfixes-6.0.0/include:/gnu/store/zqg1vg42ympnp5398g1p61aqnfn20jyk-libxext-1.3.4/include:/gnu/store/q9n2gkcxx99qrfmh4xdq744qim4cc9rn-libxdamage-1.1.5/include:/gnu/store/mlpma06sa580l8l5mizx5bvm663i0wsk-libxcursor-1.2.0/include:/gnu/store/md29ch9fzxf5712vh42kn6rzw90pmdzy-libxcomposite-0.4.5/include:/gnu/store/xhl2apl68gqkkcqx7c4l78c82l9g5z09-libx11-1.7.2/include:/gnu/store/k1d80vmiaixyqi5lrjqi18r5i9qhhaj1-libepoxy-1.5.5/include:/gnu/store/dhfmlvc8iyfs7c86nm6magglr835idpg-libcloudproviders-minimal-0.3.1/include:/gnu/store/j4ndfdhyzl2az6hifgfh5fwwfhp87ykl-librsvg-2.50.7/include:/gnu/store/375858dr3cqbwry58xcgc0776205p0mf-freetype-2.10.4/include:/gnu/store/379xr5pkxprcamhlcbqz9nghj90qxw86-fontconfig-minimal-2.13.94/include:/gnu/store/0h3ami2ijmyvkc63hk5sqsdh3qkrrcv0-fribidi-1.0.9/include:/gnu/store/sxp3lfbnyqzdq7m87qc23yaq1invxa14-at-spi2-atk-2.38.0/include:/gnu/store/99a2njzz22dkzd8pz75fsi5nbgv9ww0x-linux-libre-headers-5.10.35/include:/gnu/store/5kyiwkbmwif4c36sv3qd252c08sb5ipr-libxxf86vm-1.1.4/include:/gnu/store/pblw05r4v2xz72cccv2mg5bh4vaxjrqr-libxshmfence-1.3/include:/gnu/store/h9mqw1kn1vs6jqzafaybi1gc846r148i-libvdpau-1.4/include:/gnu/store/xfb3dwr8qj17yqn0lys6bxwl4xvrmnxa-libdrm-2.4.107/include:/gnu/store/pzdnx43bkzpf8ka6hisgs72q6b9xzjf6-libxcb-1.14/include:/gnu/store/brpl5kly3c64ah2y9v3fgbwl32641c0f-libpng-1.6.37/include:/gnu/store/j623gzkdxbiaa04kv8gg6ca8c1fhqhfp-libxft-2.3.3/include:/gnu/store/nrpykryznfzz28gr45lmnfv7a4d9150r-libthai-0.1.28/include:/gnu/store/i7vlvvpr0bf1vzsp994340dcp3izwd95-harfbuzz-2.8.2/include:/gnu/store/p1ydkidsr8xkr8ymymzy3lhy2ajwpmiy-gdk-pixbuf-2.42.4/include:/gnu/store/s0w7szfsajdy6cnrz2w7z4h5spyl4aaj-expat-2.4.1/include:/gnu/store/1g2f2gy9mpnkl2w37j1vqslxakzlr8g8-at-spi2-core-2.40.0/include:/gnu/store/xfbpzv3m5pyhd4pk079v9fhqlp47143s-libxdmcp-1.1.3/include:/gnu/store/ka95pg02g2xv2a6bf56w7daghz3fk2xz-libxau-1.0.9/include:/gnu/store/xkfcl7pxgblc52hwzq5294r0m7fv53bq-libdatrie-0.2.13/include:/gnu/store/7sik9fp2ffvnr7l01s423x4r5pn75rf9-icu4c-69.1/include:/gnu/store/x0ixwynndmgzwjijhhzk703cfac8ygjd-graphite2-1.3.13/include:/gnu/store/24r1mvps1i27831g3z7kq3ylajyq69g0-libxtst-1.2.3/include:/gnu/store/a68mx8v3ibbw8igmbfl29xc3r8qacb2n-dbus-1.12.20/include' environment variable `CPLUS_INCLUDE_PATH' set to `/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/include:/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/include:/gnu/store/fzzl2j23cjjr2srfwxbnbh5jq78vr42f-xorg-server-1.20.10/include:/gnu/store/ma0zpvl77bsbdqzwchv8zj3504a85id6-atkmm-2.28.1/include:/gnu/store/0szh0b2fc08m8d7sphg3v9rkk526dxym-cairomm-1.14.2/include:/gnu/store/j1lfwcmmp1g5sy2m8g1glvzk834dv48r-glibmm-2.68.0/include:/gnu/store/aj3jcqff1l4g7fzsqa6y1yjbqiayyrgj-gtk+-3.24.30/include:/gnu/store/8pz417xcywz8s52pf0sjry8nm62v0zdf-pangomm-2.46.0/include:/gnu/store/w6zv2mz56wyxr471q38a3cmzm4iqimy8-bzip2-1.0.8/include:/gnu/store/72kpdqplq4nc87fm7ch47kxy3nlkzsyx-xz-5.2.5/include:/gnu/store/jazwfsj2v41yih2yzw5nydqgdz1hgfm4-file-5.39/include:/gnu/store/v45pjc1yqmy59j9ff913p3ywn9qk4lqx-gawk-5.1.0/include:/gnu/store/l8kxrs01lll3pzjrd590p45l8k045q6q-make-4.3/include:/gnu/store/6mqcv52gwn2dnbislgv9k99525mzmrrs-binutils-2.37/include:/gnu/store/vakvgvrb839igv16jkif4lmx11d25jqb-gcc-10.3.0/include/c++:/gnu/store/vakvgvrb839igv16jkif4lmx11d25jqb-gcc-10.3.0/include:/gnu/store/2fk1gz2s7ppdicynscra9b19byrrr866-glibc-2.33/include:/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/include:/gnu/store/2i0zpa5w320y8m4zbqk1va8vs6dbawv0-zlib-1.2.11/include:/gnu/store/vpps8gpd7xzj630ixalx7a5gc3bhbk1p-util-linux-2.37.1-lib/include:/gnu/store/g1klcqy022aybasx0p6xbk0kxyxnfxzs-pcre-8.45/include:/gnu/store/hbw4pf3plhab5kqyfpczl3mm0wr9rb39-libffi-3.3/include:/gnu/store/w6hgiyz99wlipjl93967li2z80vfl3gw-xorgproto-2021.4/include:/gnu/store/3nxgh1pmqg44f0ccg16ny4fs81mmafvq-pixman-0.40.0/include:/gnu/store/0kc479whbavx0drhvivahdppr2xmlcyb-mesa-21.2.4/include:/gnu/store/k2xykbwy7z5czrn1xf52fy1x9wdmbr9z-libpciaccess-0.16/include:/gnu/store/0rqgwbhbbpgnn7xygv7am1ljlzfpyb7q-atk-2.36.0/include:/gnu/store/y6bj01dx23smg7lf1jifql2a1hgmy9s4-glibmm-2.64.5/include:/gnu/store/g9lfd19jck8rpxh8wmjbk8rdfcpsh7im-cairo-1.16.0/include:/gnu/store/55wynb8361fq3p7alr8ii4z17fhw44fr-libsigc++-3.0.6/include:/gnu/store/gwsy836sazxn8gr0my9kcgjl971f5d4q-libsigc++-2.9.3/include:/gnu/store/l4zh3hgnykfrm0mlqzhf5bg2g5minkqs-glib-2.70.0/include:/gnu/store/if7y9430fim7v0bxdzqhy3yjgsjl2whd-wayland-1.19.0/include:/gnu/store/zcb10k8l85b4vwgr9s5kl7qwl6hchx37-pango-1.48.10/include:/gnu/store/1kyfwib4r2sxfyvknfq4r5y5zqc4yddk-libxrender-0.9.10/include:/gnu/store/3dr3qqf6y1lppnshpn3v666z6998nzda-libxrandr-1.5.2/include:/gnu/store/4qqz2mrmw92d6yn09fljjn9wpy075qgf-libxkbcommon-1.3.0/include:/gnu/store/k3cyvfg33cfviiyv176jbg0yw1ipgq4l-libxinerama-1.1.4/include:/gnu/store/36lapwm1w5vi2vcpvxdrj468w0rqmjsr-libxi-1.7.10/include:/gnu/store/yh0pa3cm02qq6a4qxm60hin2qzfcvf8p-libxfixes-6.0.0/include:/gnu/store/zqg1vg42ympnp5398g1p61aqnfn20jyk-libxext-1.3.4/include:/gnu/store/q9n2gkcxx99qrfmh4xdq744qim4cc9rn-libxdamage-1.1.5/include:/gnu/store/mlpma06sa580l8l5mizx5bvm663i0wsk-libxcursor-1.2.0/include:/gnu/store/md29ch9fzxf5712vh42kn6rzw90pmdzy-libxcomposite-0.4.5/include:/gnu/store/xhl2apl68gqkkcqx7c4l78c82l9g5z09-libx11-1.7.2/include:/gnu/store/k1d80vmiaixyqi5lrjqi18r5i9qhhaj1-libepoxy-1.5.5/include:/gnu/store/dhfmlvc8iyfs7c86nm6magglr835idpg-libcloudproviders-minimal-0.3.1/include:/gnu/store/j4ndfdhyzl2az6hifgfh5fwwfhp87ykl-librsvg-2.50.7/include:/gnu/store/375858dr3cqbwry58xcgc0776205p0mf-freetype-2.10.4/include:/gnu/store/379xr5pkxprcamhlcbqz9nghj90qxw86-fontconfig-minimal-2.13.94/include:/gnu/store/0h3ami2ijmyvkc63hk5sqsdh3qkrrcv0-fribidi-1.0.9/include:/gnu/store/sxp3lfbnyqzdq7m87qc23yaq1invxa14-at-spi2-atk-2.38.0/include:/gnu/store/99a2njzz22dkzd8pz75fsi5nbgv9ww0x-linux-libre-headers-5.10.35/include:/gnu/store/5kyiwkbmwif4c36sv3qd252c08sb5ipr-libxxf86vm-1.1.4/include:/gnu/store/pblw05r4v2xz72cccv2mg5bh4vaxjrqr-libxshmfence-1.3/include:/gnu/store/h9mqw1kn1vs6jqzafaybi1gc846r148i-libvdpau-1.4/include:/gnu/store/xfb3dwr8qj17yqn0lys6bxwl4xvrmnxa-libdrm-2.4.107/include:/gnu/store/pzdnx43bkzpf8ka6hisgs72q6b9xzjf6-libxcb-1.14/include:/gnu/store/brpl5kly3c64ah2y9v3fgbwl32641c0f-libpng-1.6.37/include:/gnu/store/j623gzkdxbiaa04kv8gg6ca8c1fhqhfp-libxft-2.3.3/include:/gnu/store/nrpykryznfzz28gr45lmnfv7a4d9150r-libthai-0.1.28/include:/gnu/store/i7vlvvpr0bf1vzsp994340dcp3izwd95-harfbuzz-2.8.2/include:/gnu/store/p1ydkidsr8xkr8ymymzy3lhy2ajwpmiy-gdk-pixbuf-2.42.4/include:/gnu/store/s0w7szfsajdy6cnrz2w7z4h5spyl4aaj-expat-2.4.1/include:/gnu/store/1g2f2gy9mpnkl2w37j1vqslxakzlr8g8-at-spi2-core-2.40.0/include:/gnu/store/xfbpzv3m5pyhd4pk079v9fhqlp47143s-libxdmcp-1.1.3/include:/gnu/store/ka95pg02g2xv2a6bf56w7daghz3fk2xz-libxau-1.0.9/include:/gnu/store/xkfcl7pxgblc52hwzq5294r0m7fv53bq-libdatrie-0.2.13/include:/gnu/store/7sik9fp2ffvnr7l01s423x4r5pn75rf9-icu4c-69.1/include:/gnu/store/x0ixwynndmgzwjijhhzk703cfac8ygjd-graphite2-1.3.13/include:/gnu/store/24r1mvps1i27831g3z7kq3ylajyq69g0-libxtst-1.2.3/include:/gnu/store/a68mx8v3ibbw8igmbfl29xc3r8qacb2n-dbus-1.12.20/include' environment variable `LIBRARY_PATH' set to `/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib:/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/lib:/gnu/store/k18as85v9s0z66w40wg9sym4c5qz03l2-perl-5.34.0/lib:/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/lib:/gnu/store/fzzl2j23cjjr2srfwxbnbh5jq78vr42f-xorg-server-1.20.10/lib:/gnu/store/ma0zpvl77bsbdqzwchv8zj3504a85id6-atkmm-2.28.1/lib:/gnu/store/0szh0b2fc08m8d7sphg3v9rkk526dxym-cairomm-1.14.2/lib:/gnu/store/j1lfwcmmp1g5sy2m8g1glvzk834dv48r-glibmm-2.68.0/lib:/gnu/store/aj3jcqff1l4g7fzsqa6y1yjbqiayyrgj-gtk+-3.24.30/lib:/gnu/store/8pz417xcywz8s52pf0sjry8nm62v0zdf-pangomm-2.46.0/lib:/gnu/store/w6zv2mz56wyxr471q38a3cmzm4iqimy8-bzip2-1.0.8/lib:/gnu/store/72kpdqplq4nc87fm7ch47kxy3nlkzsyx-xz-5.2.5/lib:/gnu/store/jazwfsj2v41yih2yzw5nydqgdz1hgfm4-file-5.39/lib:/gnu/store/v45pjc1yqmy59j9ff913p3ywn9qk4lqx-gawk-5.1.0/lib:/gnu/store/6mqcv52gwn2dnbislgv9k99525mzmrrs-binutils-2.37/lib:/gnu/store/2fk1gz2s7ppdicynscra9b19byrrr866-glibc-2.33/lib:/gnu/store/3ywv7s8d38rgcq7ljmc1s084358a2m3h-glibc-2.33-static/lib:/gnu/store/0brdikxqk59hdr47qabcm3sya001d8vf-glibc-utf8-locales-2.33/lib:/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/lib:/gnu/store/2i0zpa5w320y8m4zbqk1va8vs6dbawv0-zlib-1.2.11/lib:/gnu/store/vpps8gpd7xzj630ixalx7a5gc3bhbk1p-util-linux-2.37.1-lib/lib:/gnu/store/g1klcqy022aybasx0p6xbk0kxyxnfxzs-pcre-8.45/lib:/gnu/store/hbw4pf3plhab5kqyfpczl3mm0wr9rb39-libffi-3.3/lib:/gnu/store/3nxgh1pmqg44f0ccg16ny4fs81mmafvq-pixman-0.40.0/lib:/gnu/store/0kc479whbavx0drhvivahdppr2xmlcyb-mesa-21.2.4/lib:/gnu/store/k2xykbwy7z5czrn1xf52fy1x9wdmbr9z-libpciaccess-0.16/lib:/gnu/store/0rqgwbhbbpgnn7xygv7am1ljlzfpyb7q-atk-2.36.0/lib:/gnu/store/y6bj01dx23smg7lf1jifql2a1hgmy9s4-glibmm-2.64.5/lib:/gnu/store/g9lfd19jck8rpxh8wmjbk8rdfcpsh7im-cairo-1.16.0/lib:/gnu/store/55wynb8361fq3p7alr8ii4z17fhw44fr-libsigc++-3.0.6/lib:/gnu/store/gwsy836sazxn8gr0my9kcgjl971f5d4q-libsigc++-2.9.3/lib:/gnu/store/l4zh3hgnykfrm0mlqzhf5bg2g5minkqs-glib-2.70.0/lib:/gnu/store/if7y9430fim7v0bxdzqhy3yjgsjl2whd-wayland-1.19.0/lib:/gnu/store/zcb10k8l85b4vwgr9s5kl7qwl6hchx37-pango-1.48.10/lib:/gnu/store/1kyfwib4r2sxfyvknfq4r5y5zqc4yddk-libxrender-0.9.10/lib:/gnu/store/3dr3qqf6y1lppnshpn3v666z6998nzda-libxrandr-1.5.2/lib:/gnu/store/4qqz2mrmw92d6yn09fljjn9wpy075qgf-libxkbcommon-1.3.0/lib:/gnu/store/k3cyvfg33cfviiyv176jbg0yw1ipgq4l-libxinerama-1.1.4/lib:/gnu/store/36lapwm1w5vi2vcpvxdrj468w0rqmjsr-libxi-1.7.10/lib:/gnu/store/yh0pa3cm02qq6a4qxm60hin2qzfcvf8p-libxfixes-6.0.0/lib:/gnu/store/zqg1vg42ympnp5398g1p61aqnfn20jyk-libxext-1.3.4/lib:/gnu/store/q9n2gkcxx99qrfmh4xdq744qim4cc9rn-libxdamage-1.1.5/lib:/gnu/store/mlpma06sa580l8l5mizx5bvm663i0wsk-libxcursor-1.2.0/lib:/gnu/store/md29ch9fzxf5712vh42kn6rzw90pmdzy-libxcomposite-0.4.5/lib:/gnu/store/xhl2apl68gqkkcqx7c4l78c82l9g5z09-libx11-1.7.2/lib:/gnu/store/k1d80vmiaixyqi5lrjqi18r5i9qhhaj1-libepoxy-1.5.5/lib:/gnu/store/dhfmlvc8iyfs7c86nm6magglr835idpg-libcloudproviders-minimal-0.3.1/lib:/gnu/store/j4ndfdhyzl2az6hifgfh5fwwfhp87ykl-librsvg-2.50.7/lib:/gnu/store/375858dr3cqbwry58xcgc0776205p0mf-freetype-2.10.4/lib:/gnu/store/379xr5pkxprcamhlcbqz9nghj90qxw86-fontconfig-minimal-2.13.94/lib:/gnu/store/0h3ami2ijmyvkc63hk5sqsdh3qkrrcv0-fribidi-1.0.9/lib:/gnu/store/sxp3lfbnyqzdq7m87qc23yaq1invxa14-at-spi2-atk-2.38.0/lib:/gnu/store/39lk5jq66zvsk8r5yfrgmdwdi61gv5xd-util-macros-1.19.3/lib:/gnu/store/5kyiwkbmwif4c36sv3qd252c08sb5ipr-libxxf86vm-1.1.4/lib:/gnu/store/pblw05r4v2xz72cccv2mg5bh4vaxjrqr-libxshmfence-1.3/lib:/gnu/store/h9mqw1kn1vs6jqzafaybi1gc846r148i-libvdpau-1.4/lib:/gnu/store/xfb3dwr8qj17yqn0lys6bxwl4xvrmnxa-libdrm-2.4.107/lib:/gnu/store/pzdnx43bkzpf8ka6hisgs72q6b9xzjf6-libxcb-1.14/lib:/gnu/store/brpl5kly3c64ah2y9v3fgbwl32641c0f-libpng-1.6.37/lib:/gnu/store/j623gzkdxbiaa04kv8gg6ca8c1fhqhfp-libxft-2.3.3/lib:/gnu/store/nrpykryznfzz28gr45lmnfv7a4d9150r-libthai-0.1.28/lib:/gnu/store/i7vlvvpr0bf1vzsp994340dcp3izwd95-harfbuzz-2.8.2/lib:/gnu/store/p1ydkidsr8xkr8ymymzy3lhy2ajwpmiy-gdk-pixbuf-2.42.4/lib:/gnu/store/s0w7szfsajdy6cnrz2w7z4h5spyl4aaj-expat-2.4.1/lib:/gnu/store/1g2f2gy9mpnkl2w37j1vqslxakzlr8g8-at-spi2-core-2.40.0/lib:/gnu/store/xfbpzv3m5pyhd4pk079v9fhqlp47143s-libxdmcp-1.1.3/lib:/gnu/store/ka95pg02g2xv2a6bf56w7daghz3fk2xz-libxau-1.0.9/lib:/gnu/store/8r97pw4h31vkkks40ysnlb53sr2cqi9y-libpthread-stubs-0.4/lib:/gnu/store/xkfcl7pxgblc52hwzq5294r0m7fv53bq-libdatrie-0.2.13/lib:/gnu/store/7sik9fp2ffvnr7l01s423x4r5pn75rf9-icu4c-69.1/lib:/gnu/store/x0ixwynndmgzwjijhhzk703cfac8ygjd-graphite2-1.3.13/lib:/gnu/store/24r1mvps1i27831g3z7kq3ylajyq69g0-libxtst-1.2.3/lib:/gnu/store/a68mx8v3ibbw8igmbfl29xc3r8qacb2n-dbus-1.12.20/lib' environment variable `GUIX_LOCPATH' set to `/gnu/store/0brdikxqk59hdr47qabcm3sya001d8vf-glibc-utf8-locales-2.33/lib/locale' environment variable `GUIX_PYTHONPATH' set to `/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages:/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/lib/python3.9/site-packages' environment variable `PYTHONTZPATH' unset environment variable `GDK_PIXBUF_MODULE_FILE' set to `/gnu/store/aj3jcqff1l4g7fzsqa6y1yjbqiayyrgj-gtk+-3.24.30/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache' phase `set-paths' succeeded after 0.0 seconds starting phase `install-locale' using 'en_US.utf8' locale for category "LC_ALL" phase `install-locale' succeeded after 0.0 seconds starting phase `unpack' gtkmm-3.24.4/ [....] gtkmm-3.24.4/untracked/gtk/gtkmm/celllayout.h gtkmm-3.24.4/untracked/gtk/gtkmm/cellrenderer.cc ...skipping... self.process_kwargs(kwargs, backend) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/build.py", line 2441, in process_kwargs if isinstance(kwargs['install_dir'], list): KeyError: 'install_dir' The Meson build system Version: 0.60.0 Source dir: /tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4 Build dir: /tmp/guix-build-gtkmm-3.24.4.drv-0/build Build type: native build Project name: gtkmm Project version: 3.24.4 C compiler for the host machine: gcc (gcc 10.3.0 "gcc (GCC) 10.3.0") C linker for the host machine: gcc ld.bfd 2.37 C++ compiler for the host machine: c++ (gcc 10.3.0 "c++ (GCC) 10.3.0") C++ linker for the host machine: c++ ld.bfd 2.37 Host machine cpu family: x86_64 Host machine cpu: x86_64 Program python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Found pkg-config: /gnu/store/wc7lqi6kgki5qzr01g3gvriwdadjiwpc-pkg-config-0.29.2/bin/pkg-config (0.29.2) Run-time dependency gtk+-3.0 found: YES 3.24.30 Run-time dependency cairomm-1.0 found: YES 1.14.2 Run-time dependency pangomm-1.4 found: YES 2.46.0 Run-time dependency gdk-pixbuf-2.0 found: YES 2.42.4 Run-time dependency atkmm-1.6 found: YES 2.28.1 Run-time dependency epoxy found: YES 1.5.5 Run-time dependency glibmm-2.4 found: YES 2.64.5 Run-time dependency giomm-2.4 found: YES 2.64.5 Run-time dependency gtk+-unix-print-3.0 found: YES 3.24.30 Program mm-common-get found: YES (/gnu/store/jgjk0xss7qw8fj0zz4hn8ai9dnq7vlbi-mm-common-1.0.3/bin/mm-common-get) Program m4 found: YES (/gnu/store/4xvaqcjyyrw6y1fwm3drl87xrz1vsln9-m4-1.4.18/bin/m4) Program perl found: YES (/gnu/store/k18as85v9s0z66w40wg9sym4c5qz03l2-perl-5.34.0/bin/perl) Program doxygen found: YES (/gnu/store/79lhh65z70qzwb0x4flgy1n4z05ypr4f-doxygen-1.9.1/bin/doxygen) Program dot found: YES (/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/bin/dot) Program xsltproc found: YES (/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/bin/xsltproc) Compiler for C++ supports arguments -Wall: YES ../gtkmm-3.24.4/meson.build:307: WARNING: Consider using the built-in warning_level option instead of using "-Wall". Library glibmm_generate_extra_defs-2.4 found: YES Configuring gdkmm-3.0.pc using configuration Configuring gdkmm-3.0-uninstalled.pc using configuration Configuring gdkmmconfig.h using configuration Configuring gdkmm.rc using configuration Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Configuring gtkmm-3.0.pc using configuration Configuring gtkmm-3.0-uninstalled.pc using configuration Configuring gtkmmconfig.h using configuration Configuring gtkmm.rc using configuration Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Found pkg-config: /gnu/store/wc7lqi6kgki5qzr01g3gvriwdadjiwpc-pkg-config-0.29.2/bin/pkg-config (0.29.2) Program glib-compile-resources found: YES (/gnu/store/w7a78mbizznxgykmqiia3l0bdyjpn675-glib-2.70.0-bin/bin/glib-compile-resources) error: in phase 'configure': uncaught exception: %exception #<&invoke-error program: "meson" arguments: ("--prefix=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4" "--buildtype=debugoptimized" "-Dc_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dcpp_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dbuild-documentation=true" "/tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4") exit-status: 2 term-signal: #f stop-signal: #f> phase `configure' failed after 1.2 seconds command "meson" "--prefix=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4" "--buildtype=debugoptimized" "-Dc_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dcpp_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dbuild-documentation=true" "/tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4" failed with status 2 ...skipping... self.process_kwargs(kwargs, backend) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/build.py", line 2441, in process_kwargs if isinstance(kwargs['install_dir'], list): KeyError: 'install_dir' The Meson build system Version: 0.60.0 Source dir: /tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4 Build dir: /tmp/guix-build-gtkmm-3.24.4.drv-0/build Build type: native build Project name: gtkmm Project version: 3.24.4 C compiler for the host machine: gcc (gcc 10.3.0 "gcc (GCC) 10.3.0") C linker for the host machine: gcc ld.bfd 2.37 C++ compiler for the host machine: c++ (gcc 10.3.0 "c++ (GCC) 10.3.0") C++ linker for the host machine: c++ ld.bfd 2.37 Host machine cpu family: x86_64 Host machine cpu: x86_64 Program python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Found pkg-config: /gnu/store/wc7lqi6kgki5qzr01g3gvriwdadjiwpc-pkg-config-0.29.2/bin/pkg-config (0.29.2) Run-time dependency gtk+-3.0 found: YES 3.24.30 Run-time dependency cairomm-1.0 found: YES 1.14.2 Run-time dependency pangomm-1.4 found: YES 2.46.0 Run-time dependency gdk-pixbuf-2.0 found: YES 2.42.4 Run-time dependency atkmm-1.6 found: YES 2.28.1 Run-time dependency epoxy found: YES 1.5.5 Run-time dependency glibmm-2.4 found: YES 2.64.5 Run-time dependency giomm-2.4 found: YES 2.64.5 Run-time dependency gtk+-unix-print-3.0 found: YES 3.24.30 Program mm-common-get found: YES (/gnu/store/jgjk0xss7qw8fj0zz4hn8ai9dnq7vlbi-mm-common-1.0.3/bin/mm-common-get) Program m4 found: YES (/gnu/store/4xvaqcjyyrw6y1fwm3drl87xrz1vsln9-m4-1.4.18/bin/m4) Program perl found: YES (/gnu/store/k18as85v9s0z66w40wg9sym4c5qz03l2-perl-5.34.0/bin/perl) Program doxygen found: YES (/gnu/store/79lhh65z70qzwb0x4flgy1n4z05ypr4f-doxygen-1.9.1/bin/doxygen) Program dot found: YES (/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/bin/dot) Program xsltproc found: YES (/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/bin/xsltproc) Compiler for C++ supports arguments -Wall: YES ../gtkmm-3.24.4/meson.build:307: WARNING: Consider using the built-in warning_level option instead of using "-Wall". Library glibmm_generate_extra_defs-2.4 found: YES Configuring gdkmm-3.0.pc using configuration Configuring gdkmm-3.0-uninstalled.pc using configuration Configuring gdkmmconfig.h using configuration Configuring gdkmm.rc using configuration Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Configuring gtkmm-3.0.pc using configuration Configuring gtkmm-3.0-uninstalled.pc using configuration Configuring gtkmmconfig.h using configuration Configuring gtkmm.rc using configuration Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Found pkg-config: /gnu/store/wc7lqi6kgki5qzr01g3gvriwdadjiwpc-pkg-config-0.29.2/bin/pkg-config (0.29.2) Program glib-compile-resources found: YES (/gnu/store/w7a78mbizznxgykmqiia3l0bdyjpn675-glib-2.70.0-bin/bin/glib-compile-resources) error: in phase 'configure': uncaught exception: %exception #<&invoke-error program: "meson" arguments: ("--prefix=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4" "--buildtype=debugoptimized" "-Dc_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dcpp_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dbuild-documentation=true" "/tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4") exit-status: 2 term-signal: #f stop-signal: #f> phase `configure' failed after 1.2 seconds command "meson" "--prefix=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4" "--buildtype=debugoptimized" "-Dc_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dcpp_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dbuild-documentation=true" "/tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4" failed with status 2 ...skipping... self.process_kwargs(kwargs, backend) File "/gnu/store/iajwhaqi5ah00d80k1frh2ylfbpk92nc-meson-0.60.0/lib/python3.9/site-packages/mesonbuild/build.py", line 2441, in process_kwargs if isinstance(kwargs['install_dir'], list): KeyError: 'install_dir' The Meson build system Version: 0.60.0 Source dir: /tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4 Build dir: /tmp/guix-build-gtkmm-3.24.4.drv-0/build Build type: native build Project name: gtkmm Project version: 3.24.4 C compiler for the host machine: gcc (gcc 10.3.0 "gcc (GCC) 10.3.0") C linker for the host machine: gcc ld.bfd 2.37 C++ compiler for the host machine: c++ (gcc 10.3.0 "c++ (GCC) 10.3.0") C++ linker for the host machine: c++ ld.bfd 2.37 Host machine cpu family: x86_64 Host machine cpu: x86_64 Program python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Found pkg-config: /gnu/store/wc7lqi6kgki5qzr01g3gvriwdadjiwpc-pkg-config-0.29.2/bin/pkg-config (0.29.2) Run-time dependency gtk+-3.0 found: YES 3.24.30 Run-time dependency cairomm-1.0 found: YES 1.14.2 Run-time dependency pangomm-1.4 found: YES 2.46.0 Run-time dependency gdk-pixbuf-2.0 found: YES 2.42.4 Run-time dependency atkmm-1.6 found: YES 2.28.1 Run-time dependency epoxy found: YES 1.5.5 Run-time dependency glibmm-2.4 found: YES 2.64.5 Run-time dependency giomm-2.4 found: YES 2.64.5 Run-time dependency gtk+-unix-print-3.0 found: YES 3.24.30 Program mm-common-get found: YES (/gnu/store/jgjk0xss7qw8fj0zz4hn8ai9dnq7vlbi-mm-common-1.0.3/bin/mm-common-get) Program m4 found: YES (/gnu/store/4xvaqcjyyrw6y1fwm3drl87xrz1vsln9-m4-1.4.18/bin/m4) Program perl found: YES (/gnu/store/k18as85v9s0z66w40wg9sym4c5qz03l2-perl-5.34.0/bin/perl) Program doxygen found: YES (/gnu/store/79lhh65z70qzwb0x4flgy1n4z05ypr4f-doxygen-1.9.1/bin/doxygen) Program dot found: YES (/gnu/store/a4b3bc2rm9lqyd00vwz16p2ycfva62fk-graphviz-2.49.0/bin/dot) Program xsltproc found: YES (/gnu/store/546xz3wbs1zriz48vz2kxyfjyyqbmgjh-libxslt-1.1.34/bin/xsltproc) Compiler for C++ supports arguments -Wall: YES ../gtkmm-3.24.4/meson.build:307: WARNING: Consider using the built-in warning_level option instead of using "-Wall". Library glibmm_generate_extra_defs-2.4 found: YES Configuring gdkmm-3.0.pc using configuration Configuring gdkmm-3.0-uninstalled.pc using configuration Configuring gdkmmconfig.h using configuration Configuring gdkmm.rc using configuration Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Configuring gtkmm-3.0.pc using configuration Configuring gtkmm-3.0-uninstalled.pc using configuration Configuring gtkmmconfig.h using configuration Configuring gtkmm.rc using configuration Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Program /gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3 found: YES (/gnu/store/qygy1q98ikvapa3gnmhsq92dmnc60ffd-python-3.9.6/bin/python3) Found pkg-config: /gnu/store/wc7lqi6kgki5qzr01g3gvriwdadjiwpc-pkg-config-0.29.2/bin/pkg-config (0.29.2) Program glib-compile-resources found: YES (/gnu/store/w7a78mbizznxgykmqiia3l0bdyjpn675-glib-2.70.0-bin/bin/glib-compile-resources) error: in phase 'configure': uncaught exception: %exception #<&invoke-error program: "meson" arguments: ("--prefix=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4" "--buildtype=debugoptimized" "-Dc_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dcpp_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dbuild-documentation=true" "/tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4") exit-status: 2 term-signal: #f stop-signal: #f> phase `configure' failed after 1.2 seconds command "meson" "--prefix=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4" "--buildtype=debugoptimized" "-Dc_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dcpp_link_args=-Wl,-rpath=/gnu/store/s926zb4xrnnasc7iipnbyp9k0fnlsain-gtkmm-3.24.4/lib" "-Dbuild-documentation=true" "/tmp/guix-build-gtkmm-3.24.4.drv-0/gtkmm-3.24.4" failed with status 2 ``` @Apteryks that seems to be another case that will need to be fixed. @dcbaker I grepped all places we instantiate CustomTarget() class, but we did not think about its subclasses we have for the gnome module...
2021-10-28T17:55:23Z
[]
[]
Traceback (most recent call last): File "/home/hadess/Projects/jhbuild/meson/mesonbuild/mesonmain.py", line 228, in run return options.run_func(options) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/msetup.py", line 290, in run app.generate() File "/home/hadess/Projects/jhbuild/meson/mesonbuild/msetup.py", line 181, in generate self._generate(env) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/msetup.py", line 225, in _generate intr.run() File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreter/interpreter.py", line 2456, in run super().run() File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 165, in run self.evaluate_codeblock(self.ast, start=1) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 190, in evaluate_codeblock raise e File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 183, in evaluate_codeblock self.evaluate_statement(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 196, in evaluate_statement return self.function_call(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 82, in wrapper res = f(self, node) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 629, in function_call return func(node, func_args, kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 697, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 114, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 275, in wrapper return f(*nargs, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreter/interpreter.py", line 1941, in func_subdir self.evaluate_codeblock(codeblock) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 190, in evaluate_codeblock raise e File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 183, in evaluate_codeblock self.evaluate_statement(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 198, in evaluate_statement self.assignment(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 848, in assignment value = self.evaluate_statement(node.value) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 200, in evaluate_statement return self.method_call(cur) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/interpreterbase.py", line 666, in method_call return self._holderify(obj.method_call(method_name, args, kwargs)) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreter/interpreterobjects.py", line 751, in method_call ret = method(state, args, kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/interpreterbase/decorators.py", line 114, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/modules/gnome.py", line 1669, in genmarshal header = build.CustomTarget(output + '_h', state.subdir, state.subproject, custom_kwargs) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/build.py", line 2317, in __init__ self.process_kwargs(kwargs, backend) File "/home/hadess/Projects/jhbuild/meson/mesonbuild/build.py", line 2426, in process_kwargs if isinstance(kwargs['install_dir'], list): KeyError: 'install_dir'
9,612
mesonbuild/meson
mesonbuild__meson-9523
d23ae8b58e73665d6418137446b259a2666af345
diff --git a/mesonbuild/build.py b/mesonbuild/build.py --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -2457,7 +2457,7 @@ def process_kwargs(self, kwargs, backend): if not isinstance(self.install, bool): raise InvalidArguments('"install" must be boolean.') if self.install: - if 'install_dir' not in kwargs: + if not kwargs.get('install_dir', False): raise InvalidArguments('"install_dir" must be specified ' 'when installing a target')
custom_target: install:true without install_dir crashes **Describe the bug** When defining a `custom_target` with `install:true`, `meson build` will crash. If `install_dir` is provided, build works as expected. Traceback: ``` Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/mesonbuild/mesonmain.py", line 138, in run return options.run_func(options) File "/usr/local/lib/python3.8/dist-packages/mesonbuild/msetup.py", line 294, in run app.generate() File "/usr/local/lib/python3.8/dist-packages/mesonbuild/msetup.py", line 185, in generate self._generate(env) File "/usr/local/lib/python3.8/dist-packages/mesonbuild/msetup.py", line 247, in _generate intr.backend.generate() File "/usr/local/lib/python3.8/dist-packages/mesonbuild/backend/ninjabackend.py", line 557, in generate self.generate_install() File "/usr/local/lib/python3.8/dist-packages/mesonbuild/backend/ninjabackend.py", line 1120, in generate_install self.create_install_data_files() File "/usr/local/lib/python3.8/dist-packages/mesonbuild/backend/backends.py", line 1495, in create_install_data_files pickle.dump(self.create_install_data(), ofile) File "/usr/local/lib/python3.8/dist-packages/mesonbuild/backend/backends.py", line 1483, in create_install_data self.generate_target_install(d) File "/usr/local/lib/python3.8/dist-packages/mesonbuild/backend/backends.py", line 1627, in generate_target_install dir_name = os.path.join('{prefix}', outdir) File "/usr/lib/python3.8/posixpath.py", line 90, in join genericpath._check_arg_types('join', a, *p) File "/usr/lib/python3.8/genericpath.py", line 152, in _check_arg_types raise TypeError(f'{funcname}() argument must be str, bytes, or ' TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType' ``` **To Reproduce** ```meson project('test') custom_target( output: 'bug.txt', install: true, capture: true, command: ['echo', 'foobar'] ) ``` **Expected behavior** Either an error of some sort ("install:true requires install_dir to be set") or default fallback (`install_dir: '.'` ??) **system parameters** * Native build * Ubuntu 20.04 * Python 3.8.10 * Using the commit at time of bug report: d23ae8b58e73665d6418137446b259a2666af345 * Ninja 1.10.0
This happens because some code, but not all code, is migrated to use typed_kwargs. And the CustomTarget implementation just emits the relevant error if install_dir is not in the kwargs, but it might be passed and not truthy. Seems like a simple solution.
2021-11-03T01:08:17Z
[]
[]
Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/mesonbuild/mesonmain.py", line 138, in run return options.run_func(options) File "/usr/local/lib/python3.8/dist-packages/mesonbuild/msetup.py", line 294, in run app.generate() File "/usr/local/lib/python3.8/dist-packages/mesonbuild/msetup.py", line 185, in generate self._generate(env) File "/usr/local/lib/python3.8/dist-packages/mesonbuild/msetup.py", line 247, in _generate intr.backend.generate() File "/usr/local/lib/python3.8/dist-packages/mesonbuild/backend/ninjabackend.py", line 557, in generate self.generate_install() File "/usr/local/lib/python3.8/dist-packages/mesonbuild/backend/ninjabackend.py", line 1120, in generate_install self.create_install_data_files() File "/usr/local/lib/python3.8/dist-packages/mesonbuild/backend/backends.py", line 1495, in create_install_data_files pickle.dump(self.create_install_data(), ofile) File "/usr/local/lib/python3.8/dist-packages/mesonbuild/backend/backends.py", line 1483, in create_install_data self.generate_target_install(d) File "/usr/local/lib/python3.8/dist-packages/mesonbuild/backend/backends.py", line 1627, in generate_target_install dir_name = os.path.join('{prefix}', outdir) File "/usr/lib/python3.8/posixpath.py", line 90, in join genericpath._check_arg_types('join', a, *p) File "/usr/lib/python3.8/genericpath.py", line 152, in _check_arg_types raise TypeError(f'{funcname}() argument must be str, bytes, or ' TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'
9,614
mesonbuild/meson
mesonbuild__meson-9577
cad109607d441ad7a2a5ae83aae3a3159d6bfeda
diff --git a/packaging/createmsi.py b/packaging/createmsi.py --- a/packaging/createmsi.py +++ b/packaging/createmsi.py @@ -124,11 +124,19 @@ def __init__(self): self.final_output = f'meson-{self.version}-64.msi' self.staging_dirs = ['dist', 'dist2'] self.progfile_dir = 'ProgramFiles64Folder' - redist_glob = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Redist\\MSVC\\v*\\MergeModules\\Microsoft_VC142_CRT_x64.msm' - trials = glob(redist_glob) - if len(trials) != 1: - sys.exit('Could not find unique MSM setup:' + '\n'.join(trials)) - self.redist_path = trials[0] + redist_globs = ['C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Redist\\MSVC\\v*\\MergeModules\\Microsoft_VC142_CRT_x64.msm', + 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Preview\\VC\\Redist\\MSVC\\v*\\MergeModules\\Microsoft_VC143_CRT_x64.msm'] + redist_path = None + for g in redist_globs: + trials = glob(g) + if len(trials) > 1: + sys.exit('MSM glob matched multiple entries:' + '\n'.join(trials)) + if len(trials) == 1: + redist_path = trials[0] + break + if redist_path is None: + sys.exit('No MSMs found.') + self.redist_path = redist_path self.component_num = 0 self.feature_properties = { self.staging_dirs[0]: { @@ -173,8 +181,6 @@ def build_dist(self): pyinstaller_tmpdir] for m in modules: pyinst_cmd += ['--hidden-import', m] - # https://github.com/pyinstaller/pyinstaller/issues/5693 - pyinst_cmd += ['--exclude-module', '_bootlocale'] pyinst_cmd += ['meson.py'] subprocess.check_call(pyinst_cmd) shutil.move(pyinstaller_tmpdir + '/meson', main_stage)
Missing _bootlocale in Windows MSI in meson 0.60.1 When trying to configure any project with meson 0.60.1 on Windows installed from the provided Release MSI, I receive the following error: ``` The Meson build system Version: 0.60.1 Source dir: C:\src\etx\src Build dir: C:\src\etx\vbuild2 Build type: native build Project name: project Project version: undefined Traceback (most recent call last): File "mesonbuild\mesonmain.py", line 138, in run File "mesonbuild\msetup.py", line 294, in run File "mesonbuild\msetup.py", line 185, in generate File "mesonbuild\msetup.py", line 207, in _generate File "mesonbuild\interpreter\interpreter.py", line 297, in __init__ File "mesonbuild\interpreterbase\interpreterbase.py", line 118, in parse_project File "mesonbuild\interpreterbase\interpreterbase.py", line 173, in evaluate_codeblock File "mesonbuild\interpreterbase\interpreterbase.py", line 166, in evaluate_codeblock File "mesonbuild\interpreterbase\interpreterbase.py", line 179, in evaluate_statement File "mesonbuild\interpreterbase\interpreterbase.py", line 454, in function_call File "mesonbuild\interpreterbase\decorators.py", line 115, in wrapped File "mesonbuild\interpreterbase\decorators.py", line 276, in wrapper File "mesonbuild\interpreter\interpreter.py", line 1130, in func_project File "mesonbuild\interpreter\interpreter.py", line 1257, in add_languages File "mesonbuild\interpreter\interpreter.py", line 1295, in add_languages_for File "mesonbuild\compilers\detect.py", line 215, in detect_compiler_for File "mesonbuild\compilers\detect.py", line 212, in compiler_from_language File "mesonbuild\compilers\detect.py", line 623, in detect_c_compiler File "mesonbuild\compilers\detect.py", line 403, in _detect_c_or_cpp_compiler File "mesonbuild\mesonlib\universal.py", line 1385, in Popen_safe File "locale.py", line 628, in getpreferredencoding ModuleNotFoundError: No module named '_bootlocale' ``` This happens both with and without --backend=vs. Discovered while testing vs2022, but I don't think the VS version matters as meson does not reach that part of the configuration (and vs2022 works fine with ninja in 0.60.0). This is a regression from the 0.60.0 Release MSI.
Same for me: When trying out the basic example found on the meson tutorial page, when running the meson builddir command. I get the following error: ModuleNotFoundError: No module named '_bootlocale'. The output: The Meson build system Version: 0.60.1 Source dir: C:\LEFTOUT\meson_local_target_test_build Build dir: C:\LEFTOUT\meson_local_target_test_build\builddir Build type: native build Project name: meson_local_target_test Project version: 1.0 Traceback (most recent call last): File "mesonbuild\mesonmain.py", line 138, in run File "mesonbuild\msetup.py", line 294, in run File "mesonbuild\msetup.py", line 185, in generate File "mesonbuild\msetup.py", line 207, in _generate File "mesonbuild\interpreter\interpreter.py", line 297, in __init__ File "mesonbuild\interpreterbase\interpreterbase.py", line 118, in parse_project File "mesonbuild\interpreterbase\interpreterbase.py", line 173, in evaluate_codeblock File "mesonbuild\interpreterbase\interpreterbase.py", line 166, in evaluate_codeblock File "mesonbuild\interpreterbase\interpreterbase.py", line 179, in evaluate_statement File "mesonbuild\interpreterbase\interpreterbase.py", line 454, in function_call File "mesonbuild\interpreterbase\decorators.py", line 115, in wrapped File "mesonbuild\interpreterbase\decorators.py", line 276, in wrapper File "mesonbuild\interpreter\interpreter.py", line 1130, in func_project File "mesonbuild\interpreter\interpreter.py", line 1257, in add_languages File "mesonbuild\interpreter\interpreter.py", line 1295, in add_languages_for File "mesonbuild\compilers\detect.py", line 215, in detect_compiler_for File "mesonbuild\compilers\detect.py", line 212, in compiler_from_language File "mesonbuild\compilers\detect.py", line 623, in detect_c_compiler File "mesonbuild\compilers\detect.py", line 403, in _detect_c_or_cpp_compiler File "mesonbuild\mesonlib\universal.py", line 1385, in Popen_safe File "locale.py", line 628, in getpreferredencoding ModuleNotFoundError: No module named '_bootlocale' Python version: Python 3.10.0 OS Name: Microsoft Windows 10 Pro OS Version: 10.0.19041 N/A Build 19041 Have the same problem '+' I created a test version with a fix. Could someone try if [this](https://www.dropbox.com/s/ptghny2cjzgyzru/meson-0.60.1.1-64.msi?dl=0) works for them? Thanks for creating a fix! I am fine with testing, however I am uncomfortable with downloading an .exe from a dropbox link. If you create a pull request and point me to it I am happy to test it from there. @jpakkane - _bootlocale issue fixed for me, thank you!
2021-11-15T17:14:37Z
[]
[]
Traceback (most recent call last): File "mesonbuild\mesonmain.py", line 138, in run File "mesonbuild\msetup.py", line 294, in run File "mesonbuild\msetup.py", line 185, in generate File "mesonbuild\msetup.py", line 207, in _generate File "mesonbuild\interpreter\interpreter.py", line 297, in __init__ File "mesonbuild\interpreterbase\interpreterbase.py", line 118, in parse_project File "mesonbuild\interpreterbase\interpreterbase.py", line 173, in evaluate_codeblock File "mesonbuild\interpreterbase\interpreterbase.py", line 166, in evaluate_codeblock File "mesonbuild\interpreterbase\interpreterbase.py", line 179, in evaluate_statement File "mesonbuild\interpreterbase\interpreterbase.py", line 454, in function_call File "mesonbuild\interpreterbase\decorators.py", line 115, in wrapped File "mesonbuild\interpreterbase\decorators.py", line 276, in wrapper File "mesonbuild\interpreter\interpreter.py", line 1130, in func_project File "mesonbuild\interpreter\interpreter.py", line 1257, in add_languages File "mesonbuild\interpreter\interpreter.py", line 1295, in add_languages_for File "mesonbuild\compilers\detect.py", line 215, in detect_compiler_for File "mesonbuild\compilers\detect.py", line 212, in compiler_from_language File "mesonbuild\compilers\detect.py", line 623, in detect_c_compiler File "mesonbuild\compilers\detect.py", line 403, in _detect_c_or_cpp_compiler File "mesonbuild\mesonlib\universal.py", line 1385, in Popen_safe File "locale.py", line 628, in getpreferredencoding ModuleNotFoundError: No module named '_bootlocale'
9,621
mesonbuild/meson
mesonbuild__meson-9799
09f03a8424a5ab45bbf251e5edd6341c6503f8e1
diff --git a/mesonbuild/modules/rpm.py b/mesonbuild/modules/rpm.py deleted file mode 100644 --- a/mesonbuild/modules/rpm.py +++ /dev/null @@ -1,186 +0,0 @@ -# Copyright 2015 The Meson development team - -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -'''This module provides helper functions for RPM related -functionality such as generating template RPM spec file.''' - -from .. import build -from .. import compilers -import datetime -from .. import mlog -from . import GirTarget, TypelibTarget -from . import ExtensionModule -from ..interpreterbase import noKwargs - -import os - -class RPMModule(ExtensionModule): - def __init__(self, interpreter): - super().__init__(interpreter) - self.methods.update({ - 'generate_spec_template': self.generate_spec_template, - }) - - @noKwargs - def generate_spec_template(self, state, args, kwargs): - required_compilers = self.__get_required_compilers(state) - proj = state.project_name.replace(' ', '_').replace('\t', '_') - so_installed = False - devel_subpkg = False - files = set() - files_devel = set() - to_delete = set() - for target in state.targets.values(): - if isinstance(target, build.Executable) and target.need_install: - files.add('%%{_bindir}/%s' % target.get_filename()) - elif isinstance(target, build.SharedLibrary) and target.need_install: - files.add('%%{_libdir}/%s' % target.get_filename()) - for alias in target.get_aliases(): - if alias.endswith('.so'): - files_devel.add('%%{_libdir}/%s' % alias) - else: - files.add('%%{_libdir}/%s' % alias) - so_installed = True - elif isinstance(target, build.StaticLibrary) and target.need_install: - to_delete.add('%%{buildroot}%%{_libdir}/%s' % target.get_filename()) - mlog.warning('removing', mlog.bold(target.get_filename()), - 'from package because packaging static libs not recommended') - elif isinstance(target, GirTarget) and target.should_install(): - files_devel.add('%%{_datadir}/gir-1.0/%s' % target.get_filename()[0]) - elif isinstance(target, TypelibTarget) and target.should_install(): - files.add('%%{_libdir}/girepository-1.0/%s' % target.get_filename()[0]) - for header in state.headers: - if header.get_install_subdir(): - files_devel.add('%%{_includedir}/%s/' % header.get_install_subdir()) - else: - for hdr_src in header.get_sources(): - files_devel.add('%%{_includedir}/%s' % hdr_src) - for man in state.man: - for man_file in man.get_sources(): - if man.locale: - files.add('%%{_mandir}/%s/man%u/%s.*' % (man.locale, int(man_file.split('.')[-1]), man_file)) - else: - files.add('%%{_mandir}/man%u/%s.*' % (int(man_file.split('.')[-1]), man_file)) - if files_devel: - devel_subpkg = True - - filename = os.path.join(state.environment.get_build_dir(), - '%s.spec' % proj) - with open(filename, 'w+', encoding='utf-8') as fn: - fn.write('Name: %s\n' % proj) - fn.write('Version: # FIXME\n') - fn.write('Release: 1%{?dist}\n') - fn.write('Summary: # FIXME\n') - fn.write('License: # FIXME\n') - fn.write('\n') - fn.write('Source0: %{name}-%{version}.tar.xz # FIXME\n') - fn.write('\n') - fn.write('BuildRequires: meson\n') - for compiler in required_compilers: - fn.write('BuildRequires: %s\n' % compiler) - for dep in state.environment.coredata.deps.host: - fn.write('BuildRequires: pkgconfig(%s)\n' % dep[0]) -# ext_libs and ext_progs have been removed from coredata so the following code -# no longer works. It is kept as a reminder of the idea should anyone wish -# to re-implement it. -# -# for lib in state.environment.coredata.ext_libs.values(): -# name = lib.get_name() -# fn.write('BuildRequires: {} # FIXME\n'.format(name)) -# mlog.warning('replace', mlog.bold(name), 'with the real package.', -# 'You can use following command to find package which ' -# 'contains this lib:', -# mlog.bold("dnf provides '*/lib{}.so'".format(name))) -# for prog in state.environment.coredata.ext_progs.values(): -# if not prog.found(): -# fn.write('BuildRequires: %%{_bindir}/%s # FIXME\n' % -# prog.get_name()) -# else: -# fn.write('BuildRequires: {}\n'.format(prog.get_path())) - fn.write('\n') - fn.write('%description\n') - fn.write('\n') - if devel_subpkg: - fn.write('%package devel\n') - fn.write('Summary: Development files for %{name}\n') - fn.write('Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}{version}-%{release}\n') - fn.write('\n') - fn.write('%description devel\n') - fn.write('Development files for %{name}.\n') - fn.write('\n') - fn.write('%prep\n') - fn.write('%autosetup\n') - fn.write('\n') - fn.write('%build\n') - fn.write('%meson\n') - fn.write('%meson_build\n') - fn.write('\n') - fn.write('%install\n') - fn.write('%meson_install\n') - if to_delete: - fn.write('rm -vf %s\n' % ' '.join(to_delete)) - fn.write('\n') - fn.write('%check\n') - fn.write('%meson_test\n') - fn.write('\n') - fn.write('%files\n') - for f in files: - fn.write('%s\n' % f) - fn.write('\n') - if devel_subpkg: - fn.write('%files devel\n') - for f in files_devel: - fn.write('%s\n' % f) - fn.write('\n') - if so_installed: - fn.write('%post -p /sbin/ldconfig\n') - fn.write('%postun -p /sbin/ldconfig\n') - fn.write('\n') - fn.write('%changelog\n') - fn.write('* %s meson <[email protected]> - \n' % - datetime.date.today().strftime('%a %b %d %Y')) - fn.write('- \n') - fn.write('\n') - mlog.log('RPM spec template written to %s.spec.\n' % proj) - - def __get_required_compilers(self, state): - required_compilers = set() - for compiler in state.environment.coredata.compilers.host.values(): - # Elbrus has one 'lcc' package for every compiler - if isinstance(compiler, compilers.GnuCCompiler): - required_compilers.add('gcc') - elif isinstance(compiler, compilers.GnuCPPCompiler): - required_compilers.add('gcc-c++') - elif isinstance(compiler, compilers.ElbrusCCompiler): - required_compilers.add('lcc') - elif isinstance(compiler, compilers.ElbrusCPPCompiler): - required_compilers.add('lcc') - elif isinstance(compiler, compilers.ElbrusFortranCompiler): - required_compilers.add('lcc') - elif isinstance(compiler, compilers.ValaCompiler): - required_compilers.add('vala') - elif isinstance(compiler, compilers.GnuFortranCompiler): - required_compilers.add('gcc-gfortran') - elif isinstance(compiler, compilers.GnuObjCCompiler): - required_compilers.add('gcc-objc') - elif compiler == compilers.GnuObjCPPCompiler: - required_compilers.add('gcc-objc++') - else: - mlog.log('RPM spec file not created, generation not allowed for:', - mlog.bold(compiler.get_id())) - return required_compilers - - -def initialize(*args, **kwargs): - return RPMModule(*args, **kwargs)
fix(rpm): remove unnecessary index in loop Discovered this error while attempting to build swaync ``` Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/mesonbuild/mesonmain.py", line 228, in run return options.run_func(options) File "/usr/lib/python3.10/site-packages/mesonbuild/msetup.py", line 281, in run app.generate() File "/usr/lib/python3.10/site-packages/mesonbuild/msetup.py", line 184, in generate self._generate(env) File "/usr/lib/python3.10/site-packages/mesonbuild/msetup.py", line 223, in _generate intr.run() File "/usr/lib/python3.10/site-packages/mesonbuild/interpreter/interpreter.py", line 2476, in run super().run() File "/usr/lib/python3.10/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 132, in run self.evaluate_codeblock(self.ast, start=1) File "/usr/lib/python3.10/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 157, in evaluate_codeblock raise e File "/usr/lib/python3.10/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 150, in evaluate_codeblock self.evaluate_statement(cur) File "/usr/lib/python3.10/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 167, in evaluate_statement return self.method_call(cur) File "/usr/lib/python3.10/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 598, in method_call return self._holderify(obj.method_call(method_name, args, kwargs)) File "/usr/lib/python3.10/site-packages/mesonbuild/interpreter/interpreterobjects.py", line 766, in method_call ret = method(state, args, kwargs) File "/usr/lib/python3.10/site-packages/mesonbuild/interpreterbase/decorators.py", line 55, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/lib/python3.10/site-packages/mesonbuild/modules/rpm.py", line 93, in generate_spec_template fn.write('BuildRequires: pkgconfig(%s)\n' % dep[0]) TypeError: not all arguments converted during string formatting ``` looks like some time ago it was broken (when .host was added to .deps)
The rpm module periodically breaks for 3 years at a time and no one notices. :/ The only swaync I can find is https://github.com/ErikReider/SwayNotificationCenter and it doesn't use this module... how do I test the change? > The rpm module periodically breaks for 3 years at a time and no one notices. :/ > > The only swaync I can find is https://github.com/ErikReider/SwayNotificationCenter and it doesn't use this module... how do I test the change? Originally swaync not uses rpm module, I've manually added ``` rpm = import('rpm') rpm.generate_spec_template() ``` to meson.build This PR needs some more work, i've noticed that output pkgconfig format is invalid. I'll do it this weekend Ah yes, this will just pass a tuple and you end up with ``` BuildRequires: pkgconfig(('name', 'gio-2.0')) BuildRequires: pkgconfig(('name', 'gtk+-3.0')) BuildRequires: pkgconfig(('name', 'json-glib-1.0')) BuildRequires: pkgconfig(('name', 'libhandy-1')) BuildRequires: pkgconfig(('name', 'gtk-layer-shell-0')) BuildRequires: pkgconfig(('name', 'bash-completion')) BuildRequires: pkgconfig(('name', 'fish')) ``` It gets worse if you consider that some of those dependencies can have methods or modules specified, and may not actually be of type pkgconfig at all -- e.g. a custom dependency type in `mesonbuild/dependencies/*.py` can be of type `system` and do find_library lookups, or type `cmake` and run a dummy cmake project to search for the dependency, or be powered by `/usr/bin/foo-config`... I am not even sure what the status of this module is. @ignatenkobrain, are you still maintaining it and verifying that it works and/or behaves as expected? # [Codecov](https://codecov.io/gh/mesonbuild/meson/pull/9763?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) Report > Merging [#9763](https://codecov.io/gh/mesonbuild/meson/pull/9763?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (065f706) into [master](https://codecov.io/gh/mesonbuild/meson/commit/37b122b87e716f5a4e909db12a7793d162c599bb?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) (37b122b) will **increase** coverage by `0.55%`. > The diff coverage is `0.00%`. [![Impacted file tree graph](https://codecov.io/gh/mesonbuild/meson/pull/9763/graphs/tree.svg?width=650&height=150&src=pr&token=BplKwTJqLg&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None)](https://codecov.io/gh/mesonbuild/meson/pull/9763?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) ```diff @@ Coverage Diff @@ ## master #9763 +/- ## ========================================== + Coverage 66.58% 67.14% +0.55% ========================================== Files 404 404 Lines 85773 85773 Branches 18919 18919 ========================================== + Hits 57115 57593 +478 + Misses 24113 23651 -462 + Partials 4545 4529 -16 ``` | [Impacted Files](https://codecov.io/gh/mesonbuild/meson/pull/9763?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | Coverage Δ | | |---|---|---| | [mesonbuild/modules/rpm.py](https://codecov.io/gh/mesonbuild/meson/pull/9763/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-bWVzb25idWlsZC9tb2R1bGVzL3JwbS5weQ==) | `0.00% <0.00%> (ø)` | | | [mesonbuild/scripts/vcstagger.py](https://codecov.io/gh/mesonbuild/meson/pull/9763/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-bWVzb25idWlsZC9zY3JpcHRzL3Zjc3RhZ2dlci5weQ==) | `87.50% <0.00%> (-4.17%)` | :arrow_down: | | [mesonbuild/minstall.py](https://codecov.io/gh/mesonbuild/meson/pull/9763/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-bWVzb25idWlsZC9taW5zdGFsbC5weQ==) | `67.15% <0.00%> (-0.37%)` | :arrow_down: | | [mesonbuild/dependencies/dev.py](https://codecov.io/gh/mesonbuild/meson/pull/9763/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-bWVzb25idWlsZC9kZXBlbmRlbmNpZXMvZGV2LnB5) | `67.16% <0.00%> (-0.30%)` | :arrow_down: | | [mesonbuild/dependencies/base.py](https://codecov.io/gh/mesonbuild/meson/pull/9763/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-bWVzb25idWlsZC9kZXBlbmRlbmNpZXMvYmFzZS5weQ==) | `85.07% <0.00%> (-0.30%)` | :arrow_down: | | [mesonbuild/interpreter/interpreter.py](https://codecov.io/gh/mesonbuild/meson/pull/9763/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-bWVzb25idWlsZC9pbnRlcnByZXRlci9pbnRlcnByZXRlci5weQ==) | `83.10% <0.00%> (+0.16%)` | :arrow_up: | | [mesonbuild/cmake/interpreter.py](https://codecov.io/gh/mesonbuild/meson/pull/9763/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-bWVzb25idWlsZC9jbWFrZS9pbnRlcnByZXRlci5weQ==) | `83.35% <0.00%> (+0.22%)` | :arrow_up: | | [mesonbuild/modules/gnome.py](https://codecov.io/gh/mesonbuild/meson/pull/9763/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-bWVzb25idWlsZC9tb2R1bGVzL2dub21lLnB5) | `77.72% <0.00%> (+0.29%)` | :arrow_up: | | [mesonbuild/coredata.py](https://codecov.io/gh/mesonbuild/meson/pull/9763/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-bWVzb25idWlsZC9jb3JlZGF0YS5weQ==) | `83.74% <0.00%> (+0.36%)` | :arrow_up: | | [mesonbuild/mesonlib/universal.py](https://codecov.io/gh/mesonbuild/meson/pull/9763/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None#diff-bWVzb25idWlsZC9tZXNvbmxpYi91bml2ZXJzYWwucHk=) | `81.37% <0.00%> (+0.39%)` | :arrow_up: | | ... and [24 more](https://codecov.io/gh/mesonbuild/meson/pull/9763/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) | | ------ [Continue to review full report at Codecov](https://codecov.io/gh/mesonbuild/meson/pull/9763?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://codecov.io/gh/mesonbuild/meson/pull/9763?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). Last update [37b122b...065f706](https://codecov.io/gh/mesonbuild/meson/pull/9763?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).
2022-01-10T02:24:47Z
[]
[]
Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/mesonbuild/mesonmain.py", line 228, in run return options.run_func(options) File "/usr/lib/python3.10/site-packages/mesonbuild/msetup.py", line 281, in run app.generate() File "/usr/lib/python3.10/site-packages/mesonbuild/msetup.py", line 184, in generate self._generate(env) File "/usr/lib/python3.10/site-packages/mesonbuild/msetup.py", line 223, in _generate intr.run() File "/usr/lib/python3.10/site-packages/mesonbuild/interpreter/interpreter.py", line 2476, in run super().run() File "/usr/lib/python3.10/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 132, in run self.evaluate_codeblock(self.ast, start=1) File "/usr/lib/python3.10/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 157, in evaluate_codeblock raise e File "/usr/lib/python3.10/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 150, in evaluate_codeblock self.evaluate_statement(cur) File "/usr/lib/python3.10/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 167, in evaluate_statement return self.method_call(cur) File "/usr/lib/python3.10/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 598, in method_call return self._holderify(obj.method_call(method_name, args, kwargs)) File "/usr/lib/python3.10/site-packages/mesonbuild/interpreter/interpreterobjects.py", line 766, in method_call ret = method(state, args, kwargs) File "/usr/lib/python3.10/site-packages/mesonbuild/interpreterbase/decorators.py", line 55, in wrapped return f(*wrapped_args, **wrapped_kwargs) File "/usr/lib/python3.10/site-packages/mesonbuild/modules/rpm.py", line 93, in generate_spec_template fn.write('BuildRequires: pkgconfig(%s)\n' % dep[0]) TypeError: not all arguments converted during string formatting
9,640
mesonbuild/meson
mesonbuild__meson-9859
2a992526045b702a8ab72968c98fef9f9e189d2b
diff --git a/mesonbuild/mcompile.py b/mesonbuild/mcompile.py --- a/mesonbuild/mcompile.py +++ b/mesonbuild/mcompile.py @@ -322,20 +322,18 @@ def add_arguments(parser: 'argparse.ArgumentParser') -> None: ) def run(options: 'argparse.Namespace') -> int: - cdata = coredata.load(options.wd) bdir = Path(options.wd) - buildfile = bdir / 'meson-private' / 'build.dat' - if not buildfile.is_file(): - raise MesonException(f'Directory {options.wd!r} does not seem to be a Meson build directory.') + validate_builddir(bdir) + if options.targets and options.clean: + raise MesonException('`TARGET` and `--clean` can\'t be used simultaneously') + + cdata = coredata.load(options.wd) b = build.load(options.wd) setup_vsenv(b.need_vsenv) cmd = [] # type: T.List[str] env = None # type: T.Optional[T.Dict[str, str]] - if options.targets and options.clean: - raise MesonException('`TARGET` and `--clean` can\'t be used simultaneously') - backend = cdata.get_option(mesonlib.OptionKey('backend')) assert isinstance(backend, str) if backend == 'ninja':
FileNotFoundError: [Errno 2] No such file or directory: '/home/me/test01/meson-private/coredata.dat' **Describe the bug** Calling `meson compile` outside of a build directory (or without `-C builddir`) shows a traceback since 0.60. **To Reproduce** ``` $ mkdir test01 && cd test01 && python3 -m venv venv && source venv/bin/activate && pip3 install meson==0.59.4 && rehash && meson --version && meson compile Collecting meson==0.59.4 Using cached meson-0.59.4-py3-none-any.whl (823 kB) Installing collected packages: meson Successfully installed meson-0.59.4 WARNING: You are using pip version 21.2.3; however, version 21.3.1 is available. You should consider upgrading via the '/home/me/test01/venv/bin/python3 -m pip install --upgrade pip' command. 0.59.4 ERROR: Current directory is not a meson build directory: `/home/me/test01`. Please specify a valid build dir or change the working directory to it. It is also possible that the build directory was generated with an old meson version. Please regenerate it in this case. zsh: exit 1 meson compile ``` ``` $ mkdir test02 && cd test02 && python3 -m venv venv && source venv/bin/activate && pip3 install meson==0.60.1 && rehash && meson --version && meson compile Collecting meson==0.60.1 Using cached meson-0.60.1-py3-none-any.whl (837 kB) Installing collected packages: meson Successfully installed meson-0.60.1 WARNING: You are using pip version 21.2.3; however, version 21.3.1 is available. You should consider upgrading via the '/home/me/test02/venv/bin/python3 -m pip install --upgrade pip' command. 0.60.1 Traceback (most recent call last): File "/home/me/test02/venv/lib64/python3.10/site-packages/mesonbuild/mesonmain.py", line 138, in run return options.run_func(options) File "/home/me/test02/venv/lib64/python3.10/site-packages/mesonbuild/mcompile.py", line 324, in run cdata = coredata.load(options.wd) File "/home/me/test02/venv/lib64/python3.10/site-packages/mesonbuild/coredata.py", line 1030, in load with open(filename, 'rb') as f: FileNotFoundError: [Errno 2] No such file or directory: '/home/me/test02/meson-private/coredata.dat' zsh: exit 2 meson compile ``` **Expected behavior** Same error message as in 0.59. **system parameters** * Is this a [cross build](https://mesonbuild.com/Cross-compilation.html) or just a plain native build (for the same computer)? * what operating system? Fedora Linux 35 * what Python version are you using? Python 3.10.0 * what `meson --version`? 0.59.4/0.60.1 * what `ninja --version` if it's a Ninja build? 1.10.2
FYI: Bisected to commit: abaa980436f53100041bd5535589bb1c42019bd6 I can confirm this is still an issue on Meson 0.61.1 (running on Mac). However, passing `-C <builddir>` is an effective workaround. > However, passing `-C <builddir>` is an effective workaround. It's not a workaround. As the original report notes, the bug here is that this is *supposed* to error out, with an informative error message rather than a traceback. That informative error message literally tells you to specify a builddir.
2022-01-21T19:28:31Z
[]
[]
Traceback (most recent call last): File "/home/me/test02/venv/lib64/python3.10/site-packages/mesonbuild/mesonmain.py", line 138, in run return options.run_func(options) File "/home/me/test02/venv/lib64/python3.10/site-packages/mesonbuild/mcompile.py", line 324, in run cdata = coredata.load(options.wd) File "/home/me/test02/venv/lib64/python3.10/site-packages/mesonbuild/coredata.py", line 1030, in load with open(filename, 'rb') as f: FileNotFoundError: [Errno 2] No such file or directory: '/home/me/test02/meson-private/coredata.dat'
9,645
numpy/numpy
numpy__numpy-10031
abbf4155a0b068520138245b67c34a034a52c42a
diff --git a/numpy/f2py/cb_rules.py b/numpy/f2py/cb_rules.py --- a/numpy/f2py/cb_rules.py +++ b/numpy/f2py/cb_rules.py @@ -367,11 +367,15 @@ 'pyobjfrom': [{debugcapi: '\tfprintf(stderr,"debug-capi:cb:#varname#\\n");'}, {isintent_c: """\ \tif (#name#_nofargs>capi_i) { -\t\tPyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,#rank#,#varname_i#_Dims,#atype#,NULL,(char*)#varname_i#,0,NPY_ARRAY_CARRAY,NULL); /*XXX: Hmm, what will destroy this array??? */ +\t\tint itemsize_ = #atype# == NPY_STRING ? 1 : 0; +\t\t/*XXX: Hmm, what will destroy this array??? */ +\t\tPyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,#rank#,#varname_i#_Dims,#atype#,NULL,(char*)#varname_i#,itemsize_,NPY_ARRAY_CARRAY,NULL); """, l_not(isintent_c): """\ \tif (#name#_nofargs>capi_i) { -\t\tPyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,#rank#,#varname_i#_Dims,#atype#,NULL,(char*)#varname_i#,0,NPY_ARRAY_FARRAY,NULL); /*XXX: Hmm, what will destroy this array??? */ +\t\tint itemsize_ = #atype# == NPY_STRING ? 1 : 0; +\t\t/*XXX: Hmm, what will destroy this array??? */ +\t\tPyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,#rank#,#varname_i#_Dims,#atype#,NULL,(char*)#varname_i#,itemsize_,NPY_ARRAY_FARRAY,NULL); """, }, """
Issue with f2py in Numpy 1.13 when character arrays appear in a callback function There is an issue with f2py in Numpy 1.13 when character arrays appear in a callback function. The following example works with Numpy 1.12 but not in 1.13: ``` #! /usr/bin/env python from __future__ import print_function import numpy from subprocess import call # # build extension from FORTRAN source # source = """ subroutine func_with_callback(callBack, cu, lencu) implicit none integer :: lencu character*8 cu(lencu) external callBack print *,'Lencu:', lencu print *,'Calling callback...' call callBack(cu, lencu) print *,'Back in fortran...' end subroutine func_with_callback """ with open("callback.f", "w") as src_file: src_file.write(source) rc = call("f2py callback.f -m callback -h callback.pyf".split()) if rc: quit() rc = call("f2py -c callback.pyf callback.f".split()) if rc: quit() # # define callback function # def callBack(cu, lencu): print ('In callback:', cu) # # call library function with callback # from callback import func_with_callback print(func_with_callback.__doc__) print("\nNumpy Version:", numpy.__version__, "\n") cu = numpy.zeros((1, 8), 'c') func_with_callback(callBack, cu) ``` ================ Numpy Version: 1.12.1 Lencu: 1 Calling callback... In callback: [['' '' '' '' '' '' '' '']] Back in fortran... ================ Numpy Version: 1.13.3 Lencu: 1 Calling callback... Call-back cb_callback_in_func_with_callback__user__routines failed. Traceback (most recent call last): File "test_callback.py", line 57, in <module> func_with_callback(callBack, cu) ValueError: data type must provide an itemsize
The problem came in with a618b4e1, #8948. The proximate cause is this code in the generated source: ``` if (cb_callBack_in_func_with_callback__user__routines_nofargs>capi_i) { PyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,2,cu_Dims,NPY_STRING,NULL,(char*)cu,0,NPY_ARRAY_CARRAY,NULL); /*XXX: Hmm, what will destroy this array??? */ ```
2017-11-15T21:01:35Z
[]
[]
Traceback (most recent call last): File "test_callback.py", line 57, in <module> func_with_callback(callBack, cu) ValueError: data type must provide an itemsize
9,657
numpy/numpy
numpy__numpy-10046
3fa0096a0689ea5ede1bee63cea16f1c0ce40953
diff --git a/numpy/f2py/cb_rules.py b/numpy/f2py/cb_rules.py --- a/numpy/f2py/cb_rules.py +++ b/numpy/f2py/cb_rules.py @@ -367,11 +367,15 @@ 'pyobjfrom': [{debugcapi: '\tfprintf(stderr,"debug-capi:cb:#varname#\\n");'}, {isintent_c: """\ \tif (#name#_nofargs>capi_i) { -\t\tPyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,#rank#,#varname_i#_Dims,#atype#,NULL,(char*)#varname_i#,0,NPY_ARRAY_CARRAY,NULL); /*XXX: Hmm, what will destroy this array??? */ +\t\tint itemsize_ = #atype# == NPY_STRING ? 1 : 0; +\t\t/*XXX: Hmm, what will destroy this array??? */ +\t\tPyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,#rank#,#varname_i#_Dims,#atype#,NULL,(char*)#varname_i#,itemsize_,NPY_ARRAY_CARRAY,NULL); """, l_not(isintent_c): """\ \tif (#name#_nofargs>capi_i) { -\t\tPyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,#rank#,#varname_i#_Dims,#atype#,NULL,(char*)#varname_i#,0,NPY_ARRAY_FARRAY,NULL); /*XXX: Hmm, what will destroy this array??? */ +\t\tint itemsize_ = #atype# == NPY_STRING ? 1 : 0; +\t\t/*XXX: Hmm, what will destroy this array??? */ +\t\tPyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,#rank#,#varname_i#_Dims,#atype#,NULL,(char*)#varname_i#,itemsize_,NPY_ARRAY_FARRAY,NULL); """, }, """
Issue with f2py in Numpy 1.13 when character arrays appear in a callback function There is an issue with f2py in Numpy 1.13 when character arrays appear in a callback function. The following example works with Numpy 1.12 but not in 1.13: ``` #! /usr/bin/env python from __future__ import print_function import numpy from subprocess import call # # build extension from FORTRAN source # source = """ subroutine func_with_callback(callBack, cu, lencu) implicit none integer :: lencu character*8 cu(lencu) external callBack print *,'Lencu:', lencu print *,'Calling callback...' call callBack(cu, lencu) print *,'Back in fortran...' end subroutine func_with_callback """ with open("callback.f", "w") as src_file: src_file.write(source) rc = call("f2py callback.f -m callback -h callback.pyf".split()) if rc: quit() rc = call("f2py -c callback.pyf callback.f".split()) if rc: quit() # # define callback function # def callBack(cu, lencu): print ('In callback:', cu) # # call library function with callback # from callback import func_with_callback print(func_with_callback.__doc__) print("\nNumpy Version:", numpy.__version__, "\n") cu = numpy.zeros((1, 8), 'c') func_with_callback(callBack, cu) ``` ================ Numpy Version: 1.12.1 Lencu: 1 Calling callback... In callback: [['' '' '' '' '' '' '' '']] Back in fortran... ================ Numpy Version: 1.13.3 Lencu: 1 Calling callback... Call-back cb_callback_in_func_with_callback__user__routines failed. Traceback (most recent call last): File "test_callback.py", line 57, in <module> func_with_callback(callBack, cu) ValueError: data type must provide an itemsize
The problem came in with a618b4e1, #8948. The proximate cause is this code in the generated source: ``` if (cb_callBack_in_func_with_callback__user__routines_nofargs>capi_i) { PyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,2,cu_Dims,NPY_STRING,NULL,(char*)cu,0,NPY_ARRAY_CARRAY,NULL); /*XXX: Hmm, what will destroy this array??? */ ```
2017-11-18T01:45:39Z
[]
[]
Traceback (most recent call last): File "test_callback.py", line 57, in <module> func_with_callback(callBack, cu) ValueError: data type must provide an itemsize
9,660
numpy/numpy
numpy__numpy-10164
82deb85915b40e19060186f47396328fcaa85b8f
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -448,9 +448,9 @@ def _array2string(a, options, separator=' ', prefix=""): # skip over array( next_line_prefix += " "*len(prefix) - lst = _formatArray(a, format_function, a.ndim, options['linewidth'], + lst = _formatArray(a, format_function, options['linewidth'], next_line_prefix, separator, options['edgeitems'], - summary_insert, options['legacy'])[:-1] + summary_insert, options['legacy']) return lst @@ -616,14 +616,14 @@ def array2string(a, max_line_width=None, precision=None, def _extendLine(s, line, word, max_line_len, next_line_prefix): - if len(line.rstrip()) + len(word.rstrip()) >= max_line_len: + if len((line + word).rstrip()) > max_line_len: s += line.rstrip() + "\n" line = next_line_prefix line += word return s, line -def _formatArray(a, format_function, rank, max_line_len, next_line_prefix, +def _formatArray(a, format_function, max_line_len, next_line_prefix, separator, edge_items, summary_insert, legacy): """formatArray is designed for two modes of operation: @@ -632,71 +632,81 @@ def _formatArray(a, format_function, rank, max_line_len, next_line_prefix, 2. Summarized output """ - if rank == 0: - return format_function(a[()]) + '\n' + def recurser(index, hanging_indent): + """ + By using this local function, we don't need to recurse with all the + arguments. Since this function is not created recursively, the cost is + not significant + """ + axis = len(index) + axes_left = a.ndim - axis - show_summary = summary_insert and 2*edge_items < len(a) + if axes_left == 0: + return format_function(a[index]) - if show_summary: - leading_items = edge_items - trailing_items = edge_items - else: - leading_items = 0 - trailing_items = len(a) - - if rank == 1: - s = "" - line = next_line_prefix - for i in range(leading_items): - word = format_function(a[i]) + separator - s, line = _extendLine(s, line, word, max_line_len, next_line_prefix) + # when recursing, add a space to align with the [ added + next_hanging_indent = hanging_indent + ' ' + a_len = a.shape[axis] + show_summary = summary_insert and 2*edge_items < a_len if show_summary: - if legacy == '1.13': - word = summary_insert + ", " - else: - word = summary_insert + separator - s, line = _extendLine(s, line, word, max_line_len, next_line_prefix) + leading_items = edge_items + trailing_items = edge_items + else: + leading_items = 0 + trailing_items = a_len + + # stringify the array with the hanging indent on the first line too + s = '' + + # last axis (rows) - wrap elements if they would not fit on one line + if axes_left == 1: + line = hanging_indent + for i in range(leading_items): + word = recurser(index + (i,), next_hanging_indent) + separator + s, line = _extendLine(s, line, word, max_line_len, hanging_indent) + + if show_summary: + if legacy == '1.13': + word = summary_insert + ", " + else: + word = summary_insert + separator + s, line = _extendLine(s, line, word, max_line_len, hanging_indent) + + for i in range(trailing_items, 1, -1): + word = recurser(index + (-i,), next_hanging_indent) + separator + s, line = _extendLine(s, line, word, max_line_len, hanging_indent) + + word = recurser(index + (-1,), next_hanging_indent) + s, line = _extendLine(s, line, word, max_line_len, hanging_indent) + s += line + + # other axes - insert newlines between rows + else: + s = '' + line_sep = separator.rstrip() + '\n'*(axes_left - 1) - for i in range(trailing_items, 1, -1): - word = format_function(a[-i]) + separator - s, line = _extendLine(s, line, word, max_line_len, next_line_prefix) + for i in range(leading_items): + s += hanging_indent + recurser(index + (i,), next_hanging_indent) + line_sep - word = format_function(a[-1]) - s, line = _extendLine(s, line, word, max_line_len, next_line_prefix) - s += line + "]\n" - s = '[' + s[len(next_line_prefix):] - else: - s = '[' - line_sep = separator.rstrip() + '\n'*(rank - 1) - for i in range(leading_items): - if i > 0: - s += next_line_prefix - s += _formatArray(a[i], format_function, rank-1, max_line_len, - " " + next_line_prefix, separator, edge_items, - summary_insert, legacy) - s = s.rstrip() + line_sep + if show_summary: + if legacy == '1.13': + # trailing space, fixed number of newlines, and fixed separator + s += hanging_indent + summary_insert + ", \n" + else: + s += hanging_indent + summary_insert + line_sep - if show_summary: - if legacy == '1.13': - # trailing space, fixed number of newlines, and fixed separator - s += next_line_prefix + summary_insert + ", \n" - else: - s += next_line_prefix + summary_insert + line_sep - - for i in range(trailing_items, 1, -1): - if leading_items or i != trailing_items: - s += next_line_prefix - s += _formatArray(a[-i], format_function, rank-1, max_line_len, - " " + next_line_prefix, separator, edge_items, - summary_insert, legacy) - s = s.rstrip() + line_sep - if leading_items or trailing_items > 1: - s += next_line_prefix - s += _formatArray(a[-1], format_function, rank-1, max_line_len, - " " + next_line_prefix, separator, edge_items, - summary_insert, legacy).rstrip()+']\n' - return s + for i in range(trailing_items, 1, -1): + s += hanging_indent + recurser(index + (-i,), next_hanging_indent) + line_sep + + s += hanging_indent + recurser(index + (-1,), next_hanging_indent) + + # remove the hanging indent, and wrap in [] + s = '[' + s[len(hanging_indent):] + ']' + return s + + # invoke the recursive part with an initial index and prefix + return recurser(index=(), hanging_indent=next_line_prefix) class FloatingFormat(object): diff --git a/numpy/matrixlib/defmatrix.py b/numpy/matrixlib/defmatrix.py --- a/numpy/matrixlib/defmatrix.py +++ b/numpy/matrixlib/defmatrix.py @@ -328,19 +328,6 @@ def __ipow__(self, other): def __rpow__(self, other): return NotImplemented - def __repr__(self): - s = repr(self.__array__()).replace('array', 'matrix') - # now, 'matrix' has 6 letters, and 'array' 5, so the columns don't - # line up anymore. We need to add a space. - l = s.splitlines() - for i in range(1, len(l)): - if l[i]: - l[i] = ' ' + l[i] - return '\n'.join(l) - - def __str__(self): - return str(self.__array__()) - def _align(self, axis): """A convenience function for operations that need to preserve axis orientation.
np.array_repr fails on np.matrix objects Cause of #5875: ```python >>> np.array_repr(np.eye(2).view(np.matrix)) Traceback (most recent call last): File "<pyshell#52>", line 1, in <module> np.array_repr(np.matrix(np.eye(2))) File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\numeric.py", line 1807, in array_repr ', ', "array(") File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 447, in array2string separator, prefix, formatter=formatter) File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 325, in _array2string _summaryEdgeItems, summary_insert)[:-1] File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 519, in _formatArray summary_insert) File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 496, in _formatArray word = format_function(a[-1]) File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 598, in __call__ if isnan(x): ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() ``` Spot the `x[i].shape == x.shape[1:]` fallacy...
At some point we should deprecate matrices and be done with them. After all, the most likely users are newbies and they should be encouraged to use Python 3.5 and later now that there is the `@` operator. We had consensus way-back-when to at least add a big warning to the docs, though I don't think it ever happened. At this point we might well be able to add an actual `DeprecationWarning`, though I don't think we can set a schedule for removing them. Maybe we should try. > At some point we should deprecate matrices and be done with them. After yet another nasty matrix corner case, I had an angry search of issues in the hope that there was one titled "Finally deprecate np.matrix". I was dissapointed... Linked issue can probably be closed in favor of this one, anyway Ugh, @rgommers is right, I forgot about `scipy.sparse`.
2017-12-06T09:21:43Z
[]
[]
Traceback (most recent call last): File "<pyshell#52>", line 1, in <module> np.array_repr(np.matrix(np.eye(2))) File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\numeric.py", line 1807, in array_repr ', ', "array(") File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 447, in array2string separator, prefix, formatter=formatter) File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 325, in _array2string _summaryEdgeItems, summary_insert)[:-1] File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 519, in _formatArray summary_insert) File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 496, in _formatArray word = format_function(a[-1]) File "C:\Program Files\Python 3.5\lib\site-packages\numpy\core\arrayprint.py", line 598, in __call__ if isnan(x): ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
9,665
numpy/numpy
numpy__numpy-10352
8a772dd80929aa556c6c01b9025f3c1da0666938
diff --git a/numpy/core/einsumfunc.py b/numpy/core/einsumfunc.py --- a/numpy/core/einsumfunc.py +++ b/numpy/core/einsumfunc.py @@ -706,10 +706,13 @@ def einsum_path(*operands, **kwargs): for cnum, char in enumerate(term): dim = sh[cnum] if char in dimension_dict.keys(): - if dimension_dict[char] != dim: - raise ValueError("Size of label '%s' for operand %d does " - "not match previous terms." - % (char, tnum)) + # For broadcasting cases we always want the largest dim size + if dimension_dict[char] == 1: + dimension_dict[char] = dim + elif dim not in (1, dimension_dict[char]): + raise ValueError("Size of label '%s' for operand %d (%d) " + "does not match previous terms (%d)." + % (char, tnum, dimension_dict[char], dim)) else: dimension_dict[char] = dim @@ -1101,13 +1104,22 @@ def einsum(*operands, **kwargs): if specified_out and ((num + 1) == len(contraction_list)): handle_out = True - # Call tensordot + # Handle broadcasting vs BLAS cases if blas: - # Checks have already been handled input_str, results_index = einsum_str.split('->') input_left, input_right = input_str.split(',') - + if 1 in tmp_operands[0] or 1 in tmp_operands[1]: + left_dims = {dim: size for dim, size in + zip(input_left, tmp_operands[0].shape)} + right_dims = {dim: size for dim, size in + zip(input_right, tmp_operands[1].shape)} + # If dims do not match we are broadcasting, BLAS off + if any(left_dims[ind] != right_dims[ind] for ind in idx_rm): + blas = False + + # Call tensordot if still possible + if blas: tensor_result = input_left + input_right for s in idx_rm: tensor_result = tensor_result.replace(s, "")
einsum broadcast regression (with optimize=True) In numpy 1.13.3, it was possible to execute the following snippet without errors, while in 1.14.0 this happens: ```python In [1]: import numpy as np In [2]: a = np.ones((10,2)) In [3]: b = np.ones((1,2)) In [4]: np.einsum('t...i,ti->t...', a, b) Traceback (most recent call last): File "<ipython-input-4-fa62d1d882f9>", line 1, in <module> np.einsum('t...i,ti->t...', a, b) File "/usr/local/lib/python2.7/dist-packages/numpy/core/einsumfunc.py", line 1087, in einsum einsum_call=True) File "/usr/local/lib/python2.7/dist-packages/numpy/core/einsumfunc.py", line 710, in einsum_path "not match previous terms.", char, tnum) ValueError: ("Size of label '%s' for operand %d does not match previous terms.", 't', 1) ``` However `optimize=False` solves the problem: ```python In [5]: np.einsum('t...i,ti->t...', a, b, optimize=False) Out[5]: array([2., 2., 2., 2., 2., 2., 2., 2., 2., 2.]) ``` Is this intended behavior and the user is now responsible to explicitly disable optimization or is this a bug?
Both? `optimize=True` was made the default, but it shouldn't be causing errors. @dgasmith Another one ;) Seems we failed to format the error message correctly either This hit at least one user of astropy (though not our tests, annoyingly!). The following breaks (but works with `optimize=False`): ``` np.einsum('...ij,j...->i...', np.eye(3)[np.newaxis], np.array([[1., 1.], [2., 2.], [3., 3.]])) ```
2018-01-09T19:44:27Z
[]
[]
Traceback (most recent call last): File "<ipython-input-4-fa62d1d882f9>", line 1, in <module> np.einsum('t...i,ti->t...', a, b) File "/usr/local/lib/python2.7/dist-packages/numpy/core/einsumfunc.py", line 1087, in einsum einsum_call=True) File "/usr/local/lib/python2.7/dist-packages/numpy/core/einsumfunc.py", line 710, in einsum_path "not match previous terms.", char, tnum) ValueError: ("Size of label '%s' for operand %d does not match previous terms.", 't', 1)
9,667
numpy/numpy
numpy__numpy-10559
7e980b5b1d3a46826c9666f0d977470179169057
diff --git a/numpy/core/einsumfunc.py b/numpy/core/einsumfunc.py --- a/numpy/core/einsumfunc.py +++ b/numpy/core/einsumfunc.py @@ -706,10 +706,13 @@ def einsum_path(*operands, **kwargs): for cnum, char in enumerate(term): dim = sh[cnum] if char in dimension_dict.keys(): - if dimension_dict[char] != dim: - raise ValueError("Size of label '%s' for operand %d does " - "not match previous terms." - % (char, tnum)) + # For broadcasting cases we always want the largest dim size + if dimension_dict[char] == 1: + dimension_dict[char] = dim + elif dim not in (1, dimension_dict[char]): + raise ValueError("Size of label '%s' for operand %d (%d) " + "does not match previous terms (%d)." + % (char, tnum, dimension_dict[char], dim)) else: dimension_dict[char] = dim @@ -1101,13 +1104,22 @@ def einsum(*operands, **kwargs): if specified_out and ((num + 1) == len(contraction_list)): handle_out = True - # Call tensordot + # Handle broadcasting vs BLAS cases if blas: - # Checks have already been handled input_str, results_index = einsum_str.split('->') input_left, input_right = input_str.split(',') - + if 1 in tmp_operands[0] or 1 in tmp_operands[1]: + left_dims = {dim: size for dim, size in + zip(input_left, tmp_operands[0].shape)} + right_dims = {dim: size for dim, size in + zip(input_right, tmp_operands[1].shape)} + # If dims do not match we are broadcasting, BLAS off + if any(left_dims[ind] != right_dims[ind] for ind in idx_rm): + blas = False + + # Call tensordot if still possible + if blas: tensor_result = input_left + input_right for s in idx_rm: tensor_result = tensor_result.replace(s, "")
einsum broadcast regression (with optimize=True) In numpy 1.13.3, it was possible to execute the following snippet without errors, while in 1.14.0 this happens: ```python In [1]: import numpy as np In [2]: a = np.ones((10,2)) In [3]: b = np.ones((1,2)) In [4]: np.einsum('t...i,ti->t...', a, b) Traceback (most recent call last): File "<ipython-input-4-fa62d1d882f9>", line 1, in <module> np.einsum('t...i,ti->t...', a, b) File "/usr/local/lib/python2.7/dist-packages/numpy/core/einsumfunc.py", line 1087, in einsum einsum_call=True) File "/usr/local/lib/python2.7/dist-packages/numpy/core/einsumfunc.py", line 710, in einsum_path "not match previous terms.", char, tnum) ValueError: ("Size of label '%s' for operand %d does not match previous terms.", 't', 1) ``` However `optimize=False` solves the problem: ```python In [5]: np.einsum('t...i,ti->t...', a, b, optimize=False) Out[5]: array([2., 2., 2., 2., 2., 2., 2., 2., 2., 2.]) ``` Is this intended behavior and the user is now responsible to explicitly disable optimization or is this a bug?
Both? `optimize=True` was made the default, but it shouldn't be causing errors. @dgasmith Another one ;) Seems we failed to format the error message correctly either This hit at least one user of astropy (though not our tests, annoyingly!). The following breaks (but works with `optimize=False`): ``` np.einsum('...ij,j...->i...', np.eye(3)[np.newaxis], np.array([[1., 1.], [2., 2.], [3., 3.]])) ```
2018-02-09T16:40:50Z
[]
[]
Traceback (most recent call last): File "<ipython-input-4-fa62d1d882f9>", line 1, in <module> np.einsum('t...i,ti->t...', a, b) File "/usr/local/lib/python2.7/dist-packages/numpy/core/einsumfunc.py", line 1087, in einsum einsum_call=True) File "/usr/local/lib/python2.7/dist-packages/numpy/core/einsumfunc.py", line 710, in einsum_path "not match previous terms.", char, tnum) ValueError: ("Size of label '%s' for operand %d does not match previous terms.", 't', 1)
9,686
numpy/numpy
numpy__numpy-10946
09048a0e053e97078cad1d3070ff23580ef13562
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -647,6 +647,9 @@ def array2string(a, max_line_width=None, precision=None, options.update(overrides) if options['legacy'] == '1.13': + if style is np._NoValue: + style = repr + if a.shape == () and not a.dtype.names: return style(a.item()) elif style is not np._NoValue:
Legacy 1.13 printing broken for 0d arrays Code to trigger the error: ```python >>> import numpy as np >>> np.__version__ '1.14.2' >>> np.array2string(np.array(1.0)) '1.' >>> np.set_printoptions(legacy='1.13') >>> np.array2string(np.array(1.0)) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "[...]/numpy/core/arrayprint.py", line 616, in array2string return style(a.item()) TypeError: object() takes no parameters ``` Same error with 1.14.1 and 1.14.0. Since `style` is just an alias for `np._NoValue` the code effectively calls (or instantiates, depending on the code version) `_NoValue(1.0)`, which is not valid. I saw that there was a recent change in `_globals.py` that makes `_NoValue` an instance instead of a class, but it has no `__call__`, so unless I'm missing something, it won't work either.
Yep, this is a bug. Thoughts @ahaldane? Can we really afford a fourth 1.14.x release? There are a few other nits that could go in to a 1.14.3. Maybe I can try making a release as @charris suggested...
2018-04-21T19:12:42Z
[]
[]
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "[...]/numpy/core/arrayprint.py", line 616, in array2string return style(a.item()) TypeError: object() takes no parameters
9,711
numpy/numpy
numpy__numpy-10947
c79fa6c18d9248d68b001d38dae68e420621b344
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -612,6 +612,9 @@ def array2string(a, max_line_width=None, precision=None, options.update(overrides) if options['legacy'] == '1.13': + if style is np._NoValue: + style = repr + if a.shape == () and not a.dtype.names: return style(a.item()) elif style is not np._NoValue:
Legacy 1.13 printing broken for 0d arrays Code to trigger the error: ```python >>> import numpy as np >>> np.__version__ '1.14.2' >>> np.array2string(np.array(1.0)) '1.' >>> np.set_printoptions(legacy='1.13') >>> np.array2string(np.array(1.0)) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "[...]/numpy/core/arrayprint.py", line 616, in array2string return style(a.item()) TypeError: object() takes no parameters ``` Same error with 1.14.1 and 1.14.0. Since `style` is just an alias for `np._NoValue` the code effectively calls (or instantiates, depending on the code version) `_NoValue(1.0)`, which is not valid. I saw that there was a recent change in `_globals.py` that makes `_NoValue` an instance instead of a class, but it has no `__call__`, so unless I'm missing something, it won't work either.
Yep, this is a bug. Thoughts @ahaldane? Can we really afford a fourth 1.14.x release? There are a few other nits that could go in to a 1.14.3. Maybe I can try making a release as @charris suggested...
2018-04-21T19:16:10Z
[]
[]
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "[...]/numpy/core/arrayprint.py", line 616, in array2string return style(a.item()) TypeError: object() takes no parameters
9,712
numpy/numpy
numpy__numpy-11200
9e2dd688acffbe949cfd615f43cb79fa3ceeb231
diff --git a/numpy/lib/_iotools.py b/numpy/lib/_iotools.py --- a/numpy/lib/_iotools.py +++ b/numpy/lib/_iotools.py @@ -205,7 +205,11 @@ def autostrip(self, method): # def __init__(self, delimiter=None, comments='#', autostrip=True, encoding=None): + delimiter = _decode_line(delimiter) + comments = _decode_line(comments) + self.comments = comments + # Delimiter is a character if (delimiter is None) or isinstance(delimiter, basestring): delimiter = delimiter or None
recfromtext bytes delimiter I had existing code that uses BytesIO and a byte delimiter. It worked in <=1.13 and breaks after. The code works if the delimiter is switched to a string. All tests were performed with Python 3.6.5 from Anaconda. The failure can be reproduced using the excerpt below. Fails using 1.14.0, 1.14.1, and 1.14.2 ``` python -c "import numpy as np; import io; print(np.version.version); data = np.recfromtxt(io.BytesIO(b'SPC:MW\nNO:30\nNO2:36'), delimiter=b':', dtype = ['S3', 'f4']); print(data)" 1.14.2 Traceback (most recent call last): File "<string>", line 1, in <module> File "/work/ROMO/anaconda3/envs/testnp113/lib/python3.6/site-packages/numpy/lib/npyio.py", line 2230, in recfromtxt output = genfromtxt(fname, **kwargs) File "/work/ROMO/anaconda3/envs/testnp113/lib/python3.6/site-packages/numpy/lib/npyio.py", line 2116, in genfromtxt rows = np.array(data, dtype=[('', _) for _ in dtype_flat]) ValueError: could not assign tuple of length 1 to structure with 2 fields. ``` Passes with 1.13.3 ``` python -c "import numpy as np; import io; print(np.version.version); data = np.recfromtxt(io.BytesIO(b'SPC:MW\nNO:30\nNO2:36'), delimiter=b':', dtype = ['S3', 'f4']); print(data)" 1.13.3 [(b'SPC', nan) (b'NO', 30.) (b'NO2', 36.)] ```
Quite likely caused by #10054. In particular, it seems like the delimiter is not being processed properly: In 1.13 when `split` is called on `SPC:MW\n` it results in `('SPC', 'MW')`, but in 1.14 it is `(SPC:MW\n,'')`. I didn't see what the exact problem is, but I think it has something to do withthe `isinstance(delimiter, basestring)` check in `LineSplitter.__init__`. @juliantaylor Thoughts? I'm taking another look. It's definiely a LineSplitter bytes issue. ```python >>> np.__version__ '1.15.0.dev0+6721890' >>> from numpy.lib._iotools import LineSplitter >>> LineSplitter(delimiter=':')(b'SPC:MW') ['SPC', 'MW'] >>> LineSplitter(delimiter=b':')(b'SPC:MW') ['SPC:MW'] ``` So we used to support bytes objects as the delimiter in 1.13, but now we don't. It happens because `isinstance(b":", basestring)` is `False`. I need to refresh myself on what `numpy.compat.basestring` is supposed to do. Right now is is just `str` (not `(str, bytes)`). It looks like a lot of code in `npyio` now assumes strings instead of bytes, eg all the string literals used there as arguments to `strip` and `split`, after #10054. Maybe it is our intention to no longer support bytes? OK, sorry for the noise, I just read #10054 properly. I think the fix is quite simple: The delimiter needs to be encoded as latin1 if it is bytes. There is even a new docstring that says this happens, but it seems it wasn't implemented. I'll give a shot at a fix.
2018-05-30T18:46:57Z
[]
[]
Traceback (most recent call last): File "<string>", line 1, in <module> File "/work/ROMO/anaconda3/envs/testnp113/lib/python3.6/site-packages/numpy/lib/npyio.py", line 2230, in recfromtxt output = genfromtxt(fname, **kwargs) File "/work/ROMO/anaconda3/envs/testnp113/lib/python3.6/site-packages/numpy/lib/npyio.py", line 2116, in genfromtxt rows = np.array(data, dtype=[('', _) for _ in dtype_flat]) ValueError: could not assign tuple of length 1 to structure with 2 fields.
9,720
numpy/numpy
numpy__numpy-11203
c49b7e33aec94bf5b60bc6d2c935e26655375bfc
diff --git a/numpy/lib/_iotools.py b/numpy/lib/_iotools.py --- a/numpy/lib/_iotools.py +++ b/numpy/lib/_iotools.py @@ -205,7 +205,11 @@ def autostrip(self, method): # def __init__(self, delimiter=None, comments='#', autostrip=True, encoding=None): + delimiter = _decode_line(delimiter) + comments = _decode_line(comments) + self.comments = comments + # Delimiter is a character if (delimiter is None) or isinstance(delimiter, basestring): delimiter = delimiter or None
recfromtext bytes delimiter I had existing code that uses BytesIO and a byte delimiter. It worked in <=1.13 and breaks after. The code works if the delimiter is switched to a string. All tests were performed with Python 3.6.5 from Anaconda. The failure can be reproduced using the excerpt below. Fails using 1.14.0, 1.14.1, and 1.14.2 ``` python -c "import numpy as np; import io; print(np.version.version); data = np.recfromtxt(io.BytesIO(b'SPC:MW\nNO:30\nNO2:36'), delimiter=b':', dtype = ['S3', 'f4']); print(data)" 1.14.2 Traceback (most recent call last): File "<string>", line 1, in <module> File "/work/ROMO/anaconda3/envs/testnp113/lib/python3.6/site-packages/numpy/lib/npyio.py", line 2230, in recfromtxt output = genfromtxt(fname, **kwargs) File "/work/ROMO/anaconda3/envs/testnp113/lib/python3.6/site-packages/numpy/lib/npyio.py", line 2116, in genfromtxt rows = np.array(data, dtype=[('', _) for _ in dtype_flat]) ValueError: could not assign tuple of length 1 to structure with 2 fields. ``` Passes with 1.13.3 ``` python -c "import numpy as np; import io; print(np.version.version); data = np.recfromtxt(io.BytesIO(b'SPC:MW\nNO:30\nNO2:36'), delimiter=b':', dtype = ['S3', 'f4']); print(data)" 1.13.3 [(b'SPC', nan) (b'NO', 30.) (b'NO2', 36.)] ```
Quite likely caused by #10054. In particular, it seems like the delimiter is not being processed properly: In 1.13 when `split` is called on `SPC:MW\n` it results in `('SPC', 'MW')`, but in 1.14 it is `(SPC:MW\n,'')`. I didn't see what the exact problem is, but I think it has something to do withthe `isinstance(delimiter, basestring)` check in `LineSplitter.__init__`. @juliantaylor Thoughts? I'm taking another look. It's definiely a LineSplitter bytes issue. ```python >>> np.__version__ '1.15.0.dev0+6721890' >>> from numpy.lib._iotools import LineSplitter >>> LineSplitter(delimiter=':')(b'SPC:MW') ['SPC', 'MW'] >>> LineSplitter(delimiter=b':')(b'SPC:MW') ['SPC:MW'] ``` So we used to support bytes objects as the delimiter in 1.13, but now we don't. It happens because `isinstance(b":", basestring)` is `False`. I need to refresh myself on what `numpy.compat.basestring` is supposed to do. Right now is is just `str` (not `(str, bytes)`). It looks like a lot of code in `npyio` now assumes strings instead of bytes, eg all the string literals used there as arguments to `strip` and `split`, after #10054. Maybe it is our intention to no longer support bytes? OK, sorry for the noise, I just read #10054 properly. I think the fix is quite simple: The delimiter needs to be encoded as latin1 if it is bytes. There is even a new docstring that says this happens, but it seems it wasn't implemented. I'll give a shot at a fix.
2018-05-31T01:01:36Z
[]
[]
Traceback (most recent call last): File "<string>", line 1, in <module> File "/work/ROMO/anaconda3/envs/testnp113/lib/python3.6/site-packages/numpy/lib/npyio.py", line 2230, in recfromtxt output = genfromtxt(fname, **kwargs) File "/work/ROMO/anaconda3/envs/testnp113/lib/python3.6/site-packages/numpy/lib/npyio.py", line 2116, in genfromtxt rows = np.array(data, dtype=[('', _) for _ in dtype_flat]) ValueError: could not assign tuple of length 1 to structure with 2 fields.
9,721
numpy/numpy
numpy__numpy-11708
c0b4340c698c486e459a0a2c80706c78329c64fc
diff --git a/numpy/lib/_datasource.py b/numpy/lib/_datasource.py --- a/numpy/lib/_datasource.py +++ b/numpy/lib/_datasource.py @@ -37,6 +37,7 @@ import os import sys +import warnings import shutil import io @@ -85,9 +86,10 @@ def _python2_bz2open(fn, mode, encoding, newline): if "t" in mode: # BZ2File is missing necessary functions for TextIOWrapper - raise ValueError("bz2 text files not supported in python2") - else: - return bz2.BZ2File(fn, mode) + warnings.warn("Assuming latin1 encoding for bz2 text file in Python2", + RuntimeWarning, stacklevel=5) + mode = mode.replace("t", "") + return bz2.BZ2File(fn, mode) def _python2_gzipopen(fn, mode, encoding, newline): """ Wrapper to open gzip in text mode.
np.loadtxt no longer loads bz2 files in python2 I have been using `np.loadtxt()` to happily load `txt.bz2` files for many years. I recently upgraded to numpy 1.14.2, and I noticed that it no longer seems possible to load a `txt.bz2` file using python2. Was this intensional, or some sort of bug? ``` Traceback (most recent call last): File "/Users/danhickstein/Documents/GitHub/PyAbel-DH/examples/example_all_O2.py", line 41, in <module> IM = np.loadtxt('data/O2-ANU1024.txt.bz2') File "/anaconda2/lib/python2.7/site-packages/numpy/lib/npyio.py", line 917, in loadtxt fh = np.lib._datasource.open(fname, 'rt', encoding=encoding) File "/anaconda2/lib/python2.7/site-packages/numpy/lib/_datasource.py", line 260, in open return ds.open(path, mode, encoding=encoding, newline=newline) File "/anaconda2/lib/python2.7/site-packages/numpy/lib/_datasource.py", line 614, in open encoding=encoding, newline=newline) File "/anaconda2/lib/python2.7/site-packages/numpy/lib/_datasource.py", line 88, in _python2_bz2open raise ValueError("bz2 text files not supported in python2") ValueError: bz2 text files not supported in python2 ```
It was intended and was part of extending encoding to text files in #4208. The problem is the `mode='rt'` in the call, might try passing `encoding='bytes'` in `loadtxt`. I think we should be able to fake it in Python 2 by assuming ascii/latin1 files if we raise a warning to that effect. @juliantaylor Thoughts? The issue is that the python2 bzip2 module is lacking functions to be used in a `TextIOWrapper ` so we can use standard encoding handling. gzip has similar issues but it is only missing one single simple function (read1) which we sort of patch in but for bzip2 I considered it too much. Maybe throwing an error is a bit harsh, one could indeed just enforce the bzip 2 textfiles to be latin1 and hope for the best during decoding. @juliantaylor The simple thing would be to just open the file with a warning about latin1. An alternative would be to include the python3 compatible version available on PyPI https://pypi.org/project/bz2file/#files, it has an Apache License Version 2, which I think is OK. The file is pure Python.
2018-08-10T20:12:59Z
[]
[]
Traceback (most recent call last): File "/Users/danhickstein/Documents/GitHub/PyAbel-DH/examples/example_all_O2.py", line 41, in <module> IM = np.loadtxt('data/O2-ANU1024.txt.bz2') File "/anaconda2/lib/python2.7/site-packages/numpy/lib/npyio.py", line 917, in loadtxt fh = np.lib._datasource.open(fname, 'rt', encoding=encoding) File "/anaconda2/lib/python2.7/site-packages/numpy/lib/_datasource.py", line 260, in open return ds.open(path, mode, encoding=encoding, newline=newline) File "/anaconda2/lib/python2.7/site-packages/numpy/lib/_datasource.py", line 614, in open encoding=encoding, newline=newline) File "/anaconda2/lib/python2.7/site-packages/numpy/lib/_datasource.py", line 88, in _python2_bz2open raise ValueError("bz2 text files not supported in python2") ValueError: bz2 text files not supported in python2
9,741
numpy/numpy
numpy__numpy-11746
745d51e931598036820d7b2e9558b76c40b833ce
diff --git a/numpy/lib/_datasource.py b/numpy/lib/_datasource.py --- a/numpy/lib/_datasource.py +++ b/numpy/lib/_datasource.py @@ -37,6 +37,7 @@ import os import sys +import warnings import shutil import io @@ -85,9 +86,10 @@ def _python2_bz2open(fn, mode, encoding, newline): if "t" in mode: # BZ2File is missing necessary functions for TextIOWrapper - raise ValueError("bz2 text files not supported in python2") - else: - return bz2.BZ2File(fn, mode) + warnings.warn("Assuming latin1 encoding for bz2 text file in Python2", + RuntimeWarning, stacklevel=5) + mode = mode.replace("t", "") + return bz2.BZ2File(fn, mode) def _python2_gzipopen(fn, mode, encoding, newline): """ Wrapper to open gzip in text mode.
np.loadtxt no longer loads bz2 files in python2 I have been using `np.loadtxt()` to happily load `txt.bz2` files for many years. I recently upgraded to numpy 1.14.2, and I noticed that it no longer seems possible to load a `txt.bz2` file using python2. Was this intensional, or some sort of bug? ``` Traceback (most recent call last): File "/Users/danhickstein/Documents/GitHub/PyAbel-DH/examples/example_all_O2.py", line 41, in <module> IM = np.loadtxt('data/O2-ANU1024.txt.bz2') File "/anaconda2/lib/python2.7/site-packages/numpy/lib/npyio.py", line 917, in loadtxt fh = np.lib._datasource.open(fname, 'rt', encoding=encoding) File "/anaconda2/lib/python2.7/site-packages/numpy/lib/_datasource.py", line 260, in open return ds.open(path, mode, encoding=encoding, newline=newline) File "/anaconda2/lib/python2.7/site-packages/numpy/lib/_datasource.py", line 614, in open encoding=encoding, newline=newline) File "/anaconda2/lib/python2.7/site-packages/numpy/lib/_datasource.py", line 88, in _python2_bz2open raise ValueError("bz2 text files not supported in python2") ValueError: bz2 text files not supported in python2 ```
It was intended and was part of extending encoding to text files in #4208. The problem is the `mode='rt'` in the call, might try passing `encoding='bytes'` in `loadtxt`. I think we should be able to fake it in Python 2 by assuming ascii/latin1 files if we raise a warning to that effect. @juliantaylor Thoughts? The issue is that the python2 bzip2 module is lacking functions to be used in a `TextIOWrapper ` so we can use standard encoding handling. gzip has similar issues but it is only missing one single simple function (read1) which we sort of patch in but for bzip2 I considered it too much. Maybe throwing an error is a bit harsh, one could indeed just enforce the bzip 2 textfiles to be latin1 and hope for the best during decoding. @juliantaylor The simple thing would be to just open the file with a warning about latin1. An alternative would be to include the python3 compatible version available on PyPI https://pypi.org/project/bz2file/#files, it has an Apache License Version 2, which I think is OK. The file is pure Python.
2018-08-15T16:24:47Z
[]
[]
Traceback (most recent call last): File "/Users/danhickstein/Documents/GitHub/PyAbel-DH/examples/example_all_O2.py", line 41, in <module> IM = np.loadtxt('data/O2-ANU1024.txt.bz2') File "/anaconda2/lib/python2.7/site-packages/numpy/lib/npyio.py", line 917, in loadtxt fh = np.lib._datasource.open(fname, 'rt', encoding=encoding) File "/anaconda2/lib/python2.7/site-packages/numpy/lib/_datasource.py", line 260, in open return ds.open(path, mode, encoding=encoding, newline=newline) File "/anaconda2/lib/python2.7/site-packages/numpy/lib/_datasource.py", line 614, in open encoding=encoding, newline=newline) File "/anaconda2/lib/python2.7/site-packages/numpy/lib/_datasource.py", line 88, in _python2_bz2open raise ValueError("bz2 text files not supported in python2") ValueError: bz2 text files not supported in python2
9,747
numpy/numpy
numpy__numpy-12257
8aa121415760cc6839a546c3f84e238d1dfa1aa6
diff --git a/numpy/ma/core.py b/numpy/ma/core.py --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -446,6 +446,7 @@ def _check_fill_value(fill_value, ndtype): If fill_value is not None, its value is forced to the given dtype. The result is always a 0d array. + """ ndtype = np.dtype(ndtype) fields = ndtype.fields @@ -465,17 +466,19 @@ def _check_fill_value(fill_value, ndtype): dtype=ndtype) else: if isinstance(fill_value, basestring) and (ndtype.char not in 'OSVU'): + # Note this check doesn't work if fill_value is not a scalar err_msg = "Cannot set fill value of string with array of dtype %s" raise TypeError(err_msg % ndtype) else: # In case we want to convert 1e20 to int. + # Also in case of converting string arrays. try: fill_value = np.array(fill_value, copy=False, dtype=ndtype) - except OverflowError: - # Raise TypeError instead of OverflowError. OverflowError - # is seldom used, and the real problem here is that the - # passed fill_value is not compatible with the ndtype. - err_msg = "Fill value %s overflows dtype %s" + except (OverflowError, ValueError): + # Raise TypeError instead of OverflowError or ValueError. + # OverflowError is seldom used, and the real problem here is + # that the passed fill_value is not compatible with the ndtype. + err_msg = "Cannot convert fill_value %s to dtype %s" raise TypeError(err_msg % (fill_value, ndtype)) return np.array(fill_value) @@ -4014,6 +4017,16 @@ def _comparison(self, other, compare): check = check.view(type(self)) check._update_from(self) check._mask = mask + + # Cast fill value to bool_ if needed. If it cannot be cast, the + # default boolean fill value is used. + if check._fill_value is not None: + try: + fill = _check_fill_value(check._fill_value, np.bool_) + except (TypeError, ValueError): + fill = _check_fill_value(None, np.bool_) + check._fill_value = fill + return check def __eq__(self, other):
Bug in masked array boolean comparison in Numpy 1.15.3 An issue was introduced in Numpy 1.15.3 compared to Numpy 1.15.2 which results in comparisons of masked arrays crashing (this has broken some functionality over at astropy - e.g. https://github.com/astropy/astropy/issues/7943) This is likely due to https://github.com/numpy/numpy/pull/12237 ### Reproducing code example: **Expected (Numpy 1.15.2)** ```python >>> (np.ma.array(['A', 'B', 'C'], fill_value='N') == 'A') | (np.ma.array(['A', 'B', 'C'], fill_value='N') == 'A') masked_array(data=[ True, False, False], mask=False, fill_value='N') ``` (arguably this was wrong too since fill_value should have been a bool, but at least it didn't crash) **Actual (Numpy 1.15.3)**: ```python >>> (np.ma.array(['A', 'B', 'C'], fill_value='N') == 'A') | (np.ma.array(['A', 'B', 'C'], fill_value='N') == 'A') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/tom/miniconda3/envs/np1153/lib/python3.6/site-packages/numpy/ma/core.py", line 3016, in __array_finalize__ self._fill_value = _check_fill_value(self._fill_value, self.dtype) File "/Users/tom/miniconda3/envs/np1153/lib/python3.6/site-packages/numpy/ma/core.py", line 476, in _check_fill_value fill_value = np.array(fill_value, copy=False, dtype=ndtype) ValueError: invalid literal for int() with base 10: 'N' ``` ### Numpy/Python version information: Python 3.6, Numpy 1.15.3
Just to be clear, #12237 isn't wrong as such, but there is a bug here that is causing the fill_value to be a string on the bool array, which now results in an error in downstream code. Hmm, I'd guess `_check_fill_value` is doing something wrong. Shorter test case ``` In [21]: np.ma.array(['A', 'B', 'C'], fill_value='N').astype('?') --------------------------------------------------------------------------- ValueError Traceback (most recent call last) ... ``` I think the bug was already there, we have just exposed it. ``` In [1]: a = np.ma.array(['A', 'B', 'C'], fill_value='N') In [2]: a == 'A' Out[2]: masked_array(data=[ True, False, False], mask=False, fill_value='N') In [3]: np.__version__ Out[3]: '1.15.0' ``` Which brings up the question, what should the fill value be in that case? It doesn't seem well defined when going from strings to boolean. Maybe the boolean default value? @charris - looking into this more I think that technically this is a bug for other types too, not just strings: ```python >>> a = np.ma.array([1, 2, 3], fill_value=2) >>> a == 1 masked_array(data=[ True, False, False], mask=False, fill_value=2) ``` Personally I would say that ``False`` would probably make more sense as a default fill value in boolean comparisons, but I don't really have a strong preference.
2018-10-24T15:49:36Z
[]
[]
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/tom/miniconda3/envs/np1153/lib/python3.6/site-packages/numpy/ma/core.py", line 3016, in __array_finalize__ self._fill_value = _check_fill_value(self._fill_value, self.dtype) File "/Users/tom/miniconda3/envs/np1153/lib/python3.6/site-packages/numpy/ma/core.py", line 476, in _check_fill_value fill_value = np.array(fill_value, copy=False, dtype=ndtype) ValueError: invalid literal for int() with base 10: 'N'
9,766
numpy/numpy
numpy__numpy-12265
59465028a5ffa886b2b9e04e768a4cbf82f9efca
diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py --- a/numpy/lib/index_tricks.py +++ b/numpy/lib/index_tricks.py @@ -10,11 +10,10 @@ ) from numpy.core.numerictypes import find_common_type, issubdtype -from . import function_base import numpy.matrixlib as matrixlib from .function_base import diff from numpy.core.multiarray import ravel_multi_index, unravel_index -from numpy.core import overrides +from numpy.core import overrides, linspace from numpy.lib.stride_tricks import as_strided @@ -346,7 +345,7 @@ def __getitem__(self, key): step = 1 if isinstance(step, complex): size = int(abs(step)) - newobj = function_base.linspace(start, stop, num=size) + newobj = linspace(start, stop, num=size) else: newobj = _nx.arange(start, stop, step) if ndmin > 1:
BUG: Missing linspace import breaks concatenation funcs In #12057 the linspace is removed from the imports from `core` however this broke various concatenation code in SciPy. The AxesConcetananenantatotator (it's impossible to type) has a method call specifically for linspace and hence trips up. https://github.com/numpy/numpy/blob/872372bd56ccb5fe98faae8be7d14e4a8c69e037/numpy/lib/index_tricks.py#L349 There are other backwards incompatible changes for `hstack` and `column_stack` which were explicitly accepting generator expressions but now they don't. Xref : scipy/scipy#9405 ### Reproducing code example: The simplest would be ```python >>> import numpy as np >>> np.r_[0:36:100j] ``` ### Error message: ``` Traceback (most recent call last): File "<ipython-input-62-500dc46d81ee>", line 1, in <module> np.r_[0:5:10j] File "c:\...\appdata\local\programs\python\python36\lib\site-packages\numpy-1.16.0.dev0+872372b-py3.6-win-amd64.egg\numpy\lib\index_tricks.py", line 349, in __getitem__ newobj = function_base.linspace(start, stop, num=size) AttributeError: module 'numpy.lib.function_base' has no attribute 'linspace' ``` ### Numpy/Python version information: <!-- Output from 'import sys, numpy; print(numpy.__version__, sys.version)' --> ``` 1.16.0.dev0+872372b 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD64)] ```
@shoyer Any chance that `__array_function__` broke functions that once accepted generators? @charris yes, that part is definitely due to `__array_function__` refactoring. Let's split that discussion off to https://github.com/numpy/numpy/issues/12263 and keep this one focused on breakage due to the removed imports.
2018-10-26T03:51:34Z
[]
[]
Traceback (most recent call last): File "<ipython-input-62-500dc46d81ee>", line 1, in <module> np.r_[0:5:10j] File "c:\...\appdata\local\programs\python\python36\lib\site-packages\numpy-1.16.0.dev0+872372b-py3.6-win-amd64.egg\numpy\lib\index_tricks.py", line 349, in __getitem__ newobj = function_base.linspace(start, stop, num=size) AttributeError: module 'numpy.lib.function_base' has no attribute 'linspace'
9,767
numpy/numpy
numpy__numpy-12297
484d2d182b6bbfcb43d3d9d1e63e9acb2d673bd5
diff --git a/numpy/ma/core.py b/numpy/ma/core.py --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -449,6 +449,7 @@ def _check_fill_value(fill_value, ndtype): If fill_value is not None, its value is forced to the given dtype. The result is always a 0d array. + """ ndtype = np.dtype(ndtype) fields = ndtype.fields @@ -468,17 +469,19 @@ def _check_fill_value(fill_value, ndtype): dtype=ndtype) else: if isinstance(fill_value, basestring) and (ndtype.char not in 'OSVU'): + # Note this check doesn't work if fill_value is not a scalar err_msg = "Cannot set fill value of string with array of dtype %s" raise TypeError(err_msg % ndtype) else: # In case we want to convert 1e20 to int. + # Also in case of converting string arrays. try: fill_value = np.array(fill_value, copy=False, dtype=ndtype) - except OverflowError: - # Raise TypeError instead of OverflowError. OverflowError - # is seldom used, and the real problem here is that the - # passed fill_value is not compatible with the ndtype. - err_msg = "Fill value %s overflows dtype %s" + except (OverflowError, ValueError): + # Raise TypeError instead of OverflowError or ValueError. + # OverflowError is seldom used, and the real problem here is + # that the passed fill_value is not compatible with the ndtype. + err_msg = "Cannot convert fill_value %s to dtype %s" raise TypeError(err_msg % (fill_value, ndtype)) return np.array(fill_value) @@ -4017,6 +4020,16 @@ def _comparison(self, other, compare): check = check.view(type(self)) check._update_from(self) check._mask = mask + + # Cast fill value to bool_ if needed. If it cannot be cast, the + # default boolean fill value is used. + if check._fill_value is not None: + try: + fill = _check_fill_value(check._fill_value, np.bool_) + except (TypeError, ValueError): + fill = _check_fill_value(None, np.bool_) + check._fill_value = fill + return check def __eq__(self, other):
Bug in masked array boolean comparison in Numpy 1.15.3 An issue was introduced in Numpy 1.15.3 compared to Numpy 1.15.2 which results in comparisons of masked arrays crashing (this has broken some functionality over at astropy - e.g. https://github.com/astropy/astropy/issues/7943) This is likely due to https://github.com/numpy/numpy/pull/12237 ### Reproducing code example: **Expected (Numpy 1.15.2)** ```python >>> (np.ma.array(['A', 'B', 'C'], fill_value='N') == 'A') | (np.ma.array(['A', 'B', 'C'], fill_value='N') == 'A') masked_array(data=[ True, False, False], mask=False, fill_value='N') ``` (arguably this was wrong too since fill_value should have been a bool, but at least it didn't crash) **Actual (Numpy 1.15.3)**: ```python >>> (np.ma.array(['A', 'B', 'C'], fill_value='N') == 'A') | (np.ma.array(['A', 'B', 'C'], fill_value='N') == 'A') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/tom/miniconda3/envs/np1153/lib/python3.6/site-packages/numpy/ma/core.py", line 3016, in __array_finalize__ self._fill_value = _check_fill_value(self._fill_value, self.dtype) File "/Users/tom/miniconda3/envs/np1153/lib/python3.6/site-packages/numpy/ma/core.py", line 476, in _check_fill_value fill_value = np.array(fill_value, copy=False, dtype=ndtype) ValueError: invalid literal for int() with base 10: 'N' ``` ### Numpy/Python version information: Python 3.6, Numpy 1.15.3
Just to be clear, #12237 isn't wrong as such, but there is a bug here that is causing the fill_value to be a string on the bool array, which now results in an error in downstream code. Hmm, I'd guess `_check_fill_value` is doing something wrong. Shorter test case ``` In [21]: np.ma.array(['A', 'B', 'C'], fill_value='N').astype('?') --------------------------------------------------------------------------- ValueError Traceback (most recent call last) ... ``` I think the bug was already there, we have just exposed it. ``` In [1]: a = np.ma.array(['A', 'B', 'C'], fill_value='N') In [2]: a == 'A' Out[2]: masked_array(data=[ True, False, False], mask=False, fill_value='N') In [3]: np.__version__ Out[3]: '1.15.0' ``` Which brings up the question, what should the fill value be in that case? It doesn't seem well defined when going from strings to boolean. Maybe the boolean default value? @charris - looking into this more I think that technically this is a bug for other types too, not just strings: ```python >>> a = np.ma.array([1, 2, 3], fill_value=2) >>> a == 1 masked_array(data=[ True, False, False], mask=False, fill_value=2) ``` Personally I would say that ``False`` would probably make more sense as a default fill value in boolean comparisons, but I don't really have a strong preference.
2018-10-31T02:58:51Z
[]
[]
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/tom/miniconda3/envs/np1153/lib/python3.6/site-packages/numpy/ma/core.py", line 3016, in __array_finalize__ self._fill_value = _check_fill_value(self._fill_value, self.dtype) File "/Users/tom/miniconda3/envs/np1153/lib/python3.6/site-packages/numpy/ma/core.py", line 476, in _check_fill_value fill_value = np.array(fill_value, copy=False, dtype=ndtype) ValueError: invalid literal for int() with base 10: 'N'
9,770
numpy/numpy
numpy__numpy-12358
50aa81362c9b81e4cc4926fd23adc7af6971a165
diff --git a/numpy/lib/format.py b/numpy/lib/format.py --- a/numpy/lib/format.py +++ b/numpy/lib/format.py @@ -259,6 +259,43 @@ def dtype_to_descr(dtype): else: return dtype.str +def descr_to_dtype(descr): + ''' + descr may be stored as dtype.descr, which is a list of + (name, format, [shape]) tuples. Offsets are not explicitly saved, rather + empty fields with name,format == '', '|Vn' are added as padding. + + This function reverses the process, eliminating the empty padding fields. + ''' + if isinstance(descr, (str, dict)): + # No padding removal needed + return numpy.dtype(descr) + + fields = [] + offset = 0 + for field in descr: + if len(field) == 2: + name, descr_str = field + dt = descr_to_dtype(descr_str) + else: + name, descr_str, shape = field + dt = numpy.dtype((descr_to_dtype(descr_str), shape)) + + # Ignore padding bytes, which will be void bytes with '' as name + # Once support for blank names is removed, only "if name == ''" needed) + is_pad = (name == '' and dt.type is numpy.void and dt.names is None) + if not is_pad: + fields.append((name, dt, offset)) + + offset += dt.itemsize + + names, formats, offsets = zip(*fields) + # names may be (title, names) tuples + nametups = (n if isinstance(n, tuple) else (None, n) for n in names) + titles, names = zip(*nametups) + return numpy.dtype({'names': names, 'formats': formats, 'titles': titles, + 'offsets': offsets, 'itemsize': offset}) + def header_data_from_array_1_0(array): """ Get the dictionary of header metadata from a numpy.ndarray. @@ -523,7 +560,7 @@ def _read_array_header(fp, version): msg = "fortran_order is not a valid bool: %r" raise ValueError(msg % (d['fortran_order'],)) try: - dtype = numpy.dtype(d['descr']) + dtype = descr_to_dtype(d['descr']) except TypeError as e: msg = "descr is not a valid dtype descriptor: %r" raise ValueError(msg % (d['descr'],))
Loading aligned dtype error (Trac #1619) _Original ticket http://projects.scipy.org/numpy/ticket/1619 on 2010-09-24 by trac user Ihor.Melnyk, assigned to unknown._ ``` import numpy as np t = np.dtype('i1, i4, i1', align=True) d = np.zeros(1, t) np.save("test.npy", d) data = np.load("test.npy") Traceback (most recent call last): File "D:\Projects\Cuda\Cuda_Git\pathwise\liinc\model\feeds\numpy_bug.py", line 8, in <module> data = np.load("test.npy") File "D:\Projects\Cuda\Cuda_Git\pathwise\pathwise\vendors\lib64\x64\python\numpy\lib\npyio.py", line 314, in load return format.read_array(fid) File "D:\Projects\Cuda\Cuda_Git\pathwise\pathwise\vendors\lib64\x64\python\numpy\lib\format.py", line 440, in read_array shape, fortran_order, dtype = read_array_header_1_0(fp) File "D:\Projects\Cuda\Cuda_Git\pathwise\pathwise\vendors\lib64\x64\python\numpy\lib\format.py", line 358, in read_array_header_1_0 dtype = numpy.dtype(d['descr']) ValueError: two fields with the same name ```
Attachment added by trac user jpeel on 2010-12-29: [0001-BF-added-fix-for-loading-aligned-dtype.patch](http://projects.scipy.org/numpy/attachment/ticket/1619/0001-BF-added-fix-for-loading-aligned-dtype.patch) _trac user jpeel wrote on 2010-12-29_ I've come up with a possible solution, but first let me explain the real problem here. The real problem here is that dtype() can't handle a list that describes an aligned dtype. For instance, in the example given above, the list that is put into dtype() when the file is loaded is `[('f0', '|i1'), ('', '|V3'), ('f1', '<i4'), ('f2', '|i1')]` on my machine. `(_, '|V3')` indicates that this is an aligned dtype. The first element in each tuple is the name of the field. When dtype finds a name equal to `_`, it currently sets the name of that field to `'f#ind'` where #ind is the index of the tuple in the list. That means that `('', '|V3')` in the above list has its name set to `'f1'` which then causes an error when the next item has a name of `'f1'`. Okay, so the problem then is that dtype() currently doesn't know how to read in an aligned type correctly. Here is how I approached solving this. 1. If the align parameter doesn't equal 1 and the name of the first tuple is not equal to `''`, then set checkalign to 1 so that this input list could indicate an aligned array. 2. If checkalign, then trigger that a tuple deals with alignment when: a. a tuple's name is `''` b. a tuple's title is NULL c. a tuple has only two elements d. the datatype of the tuple is VOID 3. When we find a tuple that meets all of the above conditions, a. add the size of the VOID tuple to the totalsize b. set maxalign to MAX(maxalign, current element size + previous element size) c. adjust the name index accordingly 4. Make sure that the alignment is set correctly when checkalign==1. 5. Readjust the size of the nameslist tuple if necessary. (if there were any aligning tuples, then nameslist initialized to be too large). 3.c. refers to an additional index, ii, to keep track of the indices in the nameslist. This is necessary because i refers to the index in the input list. There might be a better approach than this, but this is one possible solution. Other approaches might involve changing the npy format or how aligned dtypes are shown. However, I think that those will be much harder to implement. In the patch that I'm attaching, I've kept everything in the _convert_from_array_desc function, but it might be a good idea to break it up a bit or make some other changes to make the code more manageable. _@rgommers wrote on 2011-03-11_ Charles Harris sent a message to the Numpy mailing list about this ticket on March 3rd, probably good to reply there. For completeness, his comments: ``` In [2]: np.dtype('i1, i4, i1', align=True) Out[2]: dtype([('f0', '|i1'), ('', '|V3'), ('f1', '<i4'), ('f2', '|i1')]) In [3]: dtype([('f0', '|i1'), ('', '|V3'), ('f1', '<i4'), ('f2', '|i1')]) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) /home/charris/<ipython console> in <module>() ValueError: two fields with the same name Note that the second field in the dtype is inserted for alignment purposes and isn't named. However, the list in the dtype can not be used to define a dtype because the empty name is replaced by 'f1', which conflicts with the following field. The patch attached to the ticket has a rather complicated work around for this that I would rather avoid. I would prefer some sort of reserved name for alignment fields, maybe something like '*0', '*1', etc. Another question I have is if alignment is supposed to be preserved across architectures, that is, should it be possible to pickle/savez on one architecture and read things in on another and still have the elements aligned. I suspect this isn't worth doing, but one way or the other should be decided. ``` _@mwiebe wrote on 2011-03-16_ I think the bug here is in **repr** not producing a good string to reconstruct the data type. Rather than coming up with an awkward workaround, I would suggest **repr** print the following when the exact type would not be reconstructed with the normal repr: ``` dtype({'names': ['f0', 'f1', 'f2'], 'formats': [dtype('int8'), dtype('int32'), dtype('int8')], 'offsets': [0, 4, 8]}) ``` Unfortunately, however, this is still not good enough! It produces a type with itemsize 9 instead of 12. I think it's also necessary to extend the dtype construction syntax to something like: ``` dtype({'names': ['f0', 'f1', 'f2'], 'formats': [dtype('int8'), dtype('int32'), dtype('int8')], 'offsets': [0, 4, 8]}, itemsize=12) ``` Also, to see why the proposed patch doesn't work, consider the following example. ``` >>> t = np.dtype('i4, i1', align=True) >>> s = eval(repr(t)) >>> t dtype([('f0', '<i4'), ('f1', '|i1')]) >>> s dtype([('f0', '<i4'), ('f1', '|i1')]) >>> t.itemsize 8 >>> s.itemsize 5 ``` Here there is no clue provided to get the correct itemsize, extending the dtype constructor to have an itemsize parameter is the only reasonable way I can think of to make this work in general. _@charris wrote on 2011-03-16_ What if the dtype included an alignment number? Then align=1, would be no alignment, align=4 would be on 4 byte boundaries, etc. I think that would provide enough information to recreate the structure. _@mwiebe wrote on 2011-03-16_ Yes, that would work for the specific case of aligned data types, but it's possible (from C) to create data types with sizes that match neither the tightly packed nor the aligned pattern, and I think it's desirable to support that. I think at some point a function like 'dtype.restrict_to_fields(fields)' would be useful, which would make a data type exactly matching the dtype, but only having the fields mentioned. This would generate a more general data type, so to support the possibility of such a function it needs to be more general. _@mwiebe wrote on 2011-03-16_ On the other hand, also including an alignment number would be required for doing reasonable type promotions between structured types. If any of inputs are aligned, it would make sense for the promoted type to be aligned as well, and it may have a different set of fields than any of the inputs. _@pv wrote on 2011-04-02_ +1 for adding the itemsize parameter. This could be a workaround for #2383 if we decide not to include the trailing padding. -1 for `align` keyword, as it seems that it is not a very explicit specification of the data structure. I'm also not sure if it's portable if stored in `.npy` files. Native-alignment can in principle checked in UpdateFlags... _@mwiebe wrote on 2011-06-21_ I believe the align keyword can be well-defined, and C compilers in general have a consistent approach. The reason I really want this in is for in-memory calculations, where operations combining or manipulating aligned structured arrays should produce new aligned structured arrays, not throw away the alignment and force lots of extra copying and buffering. I'm not sure what the .npy format is doing, I wish it would have defined a NumPy + Python independent specification for the structure. I've fixed the repr issue, but the .npy format still breaks. _@mwiebe wrote on 2011-06-23_ Repr now produces reliable strings: ``` >>> np.dtype('i1, i4, i1', align=True) dtype({'names':['f0','f1','f2'], 'formats':['i1','<i4','i1'], 'offsets':[0,4,8], 'itemsize':12}, align=True) ``` but the original issue with the .npy file format is still there. Still needs a fix for .npy format.
2018-11-09T23:28:50Z
[]
[]
Traceback (most recent call last): File "D:\Projects\Cuda\Cuda_Git\pathwise\liinc\model\feeds\numpy_bug.py", line 8, in <module> data = np.load("test.npy") File "D:\Projects\Cuda\Cuda_Git\pathwise\pathwise\vendors\lib64\x64\python\numpy\lib\npyio.py", line 314, in load return format.read_array(fid) File "D:\Projects\Cuda\Cuda_Git\pathwise\pathwise\vendors\lib64\x64\python\numpy\lib\format.py", line 440, in read_array shape, fortran_order, dtype = read_array_header_1_0(fp) File "D:\Projects\Cuda\Cuda_Git\pathwise\pathwise\vendors\lib64\x64\python\numpy\lib\format.py", line 358, in read_array_header_1_0 dtype = numpy.dtype(d['descr']) ValueError: two fields with the same name
9,773
numpy/numpy
numpy__numpy-12407
a4b96ad7649281de2c3a41292fcbab4c77c0743d
diff --git a/numpy/distutils/exec_command.py b/numpy/distutils/exec_command.py --- a/numpy/distutils/exec_command.py +++ b/numpy/distutils/exec_command.py @@ -67,8 +67,10 @@ def filepath_from_subprocess_output(output): Inherited from `exec_command`, and possibly incorrect. """ - output = output.decode(locale.getpreferredencoding(False), - errors='replace') + mylocale = locale.getpreferredencoding(False) + if mylocale is None: + mylocale = 'ascii' + output = output.decode(mylocale, errors='replace') output = output.replace('\r\n', '\n') # Another historical oddity if output[-1:] == '\n': @@ -278,9 +280,10 @@ def _exec_command(command, use_shell=None, use_tee = None, **env): return 127, '' text, err = proc.communicate() - text = text.decode(locale.getpreferredencoding(False), - errors='replace') - + mylocale = locale.getpreferredencoding(False) + if mylocale is None: + mylocale = 'ascii' + text = text.decode(mylocale, errors='replace') text = text.replace('\r\n', '\n') # Another historical oddity if text[-1:] == '\n':
cannot configure/build without locale, due to commit 5652b0785 <!-- Please describe the issue in detail here, and fill in the fields below --> ### Reproducing code example: assume that ``` >>> import locale >>> locale.getpreferredencoding(False) is None True ``` Then `python setup.py build_ext` fails with `TypeError: decode() argument 1 must be string, not None` (see below for the full backtrace). I've tracked this down (by bisecting the numpy master branch) to commit 5652b0785 which introduced the use of locale, and uses it without checking that `locale.getpreferredencoding(False)` may return `None`, as the call to `text.decode()` must have a valid locale. It's easy to patch, please tell me if this would be acceptable before I spend more time on this --- I'd imagine you might decide not to fix it---on the other hand it may be argued that a broken/missing locale should not stop numpy from being built, and it is a problem now. ### Error message: Full traceback: ``` Running from numpy source directory. Cythonizing sources numpy/random/mtrand/randint_helpers.pxi.in has not changed numpy/random/mtrand/mtrand.pyx has not changed blas_opt_info: blas_mkl_info: customize UnixCCompiler C compiler: cc -fno-strict-aliasing -OPT:Olimit=0 -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wno-unused -fPIC creating /tmp/tmpDJvQAg/tmp creating /tmp/tmpDJvQAg/tmp/tmpDJvQAg compile options: '-MMD -MF /tmp/tmpDJvQAg/file.c.d -c' cc: /tmp/tmpDJvQAg/file.c Traceback (most recent call last): File "setup.py", line 394, in <module> setup_package() File "setup.py", line 386, in setup_package setup(**metadata) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/core.py", line 135, in setup config = configuration() File "setup.py", line 166, in configuration config.add_subpackage('numpy') File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/misc_util.py", line 1029, in add_subpackage caller_level = 2) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/misc_util.py", line 998, in get_subpackage caller_level = caller_level + 1) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/misc_util.py", line 935, in _get_configuration_from_setup_py config = setup_module.configuration(*args) File "numpy/setup.py", line 10, in configuration config.add_subpackage('core') File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/misc_util.py", line 1029, in add_subpackage caller_level = 2) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/misc_util.py", line 998, in get_subpackage caller_level = caller_level + 1) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/misc_util.py", line 935, in _get_configuration_from_setup_py config = setup_module.configuration(*args) File "numpy/core/setup.py", line 839, in configuration blas_info = get_info('blas_opt', 0) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 432, in get_info return cl().get_info(notfound_action) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 624, in get_info self.calc_info() File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 1635, in calc_info blas_mkl_info = get_info('blas_mkl') File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 432, in get_info return cl().get_info(notfound_action) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 624, in get_info self.calc_info() File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 1071, in calc_info info = self.check_libs2(lib_dirs, mkl_libs) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 780, in check_libs2 exts = self.library_extensions() File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 739, in library_extensions c = customized_ccompiler() File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/__init__.py", line 34, in customized_ccompiler c.customize('') File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/ccompiler.py", line 522, in CCompiler_customize extra_preargs=['-MMD', '-MF', fn + '.d']) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/ccompiler.py", line 343, in CCompiler_compile single_compile(o) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/ccompiler.py", line 303, in single_compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/unixccompiler.py", line 58, in UnixCCompiler__compile extra_postargs, display = display) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/ccompiler.py", line 139, in CCompiler_spawn s, o = exec_command(cmd) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/exec_command.py", line 214, in exec_command **env) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/exec_command.py", line 264, in _exec_command errors='replace') TypeError: decode() argument 1 must be string, not None ``` <!-- A short code example that reproduces the problem/missing feature. It should be self-contained, i.e., possible to run as-is via 'python myproblem.py' --> <!-- Remove these sections for a feature request --> <!-- If you are reporting a segfault please include a GDB traceback, which you can generate by following https://github.com/numpy/numpy/blob/master/doc/source/dev/development_environment.rst#debugging --> <!-- Full error message, if any (starting from line Traceback: ...) --> ### Numpy/Python version information: CPython 2.7.15 built from source: ``` Python 2.7.15 (default, Nov 15 2018, 12:10:04) [GCC 4.2.1 Compatible FreeBSD Clang 6.0.1 (tags/RELEASE_601/final 335540)] on freebsd12 ``` Problem shows itself on the master branch, all the way to 5652b0785, as well as on releases 1.14 and 1.15.
What if you replace `False` by `True` in `locale.getpreferredencoding(False)`? Can you think of a good replacement. I note that we use `getpreferredencoding` in a few other places, but `exec_command.py` is the only place with `False`. No, replacing `False` by `True` does not help. For the current master (a4b96ad764) to build I need to apply ``` diff --git a/numpy/distutils/exec_command.py b/numpy/distutils/exec_command.py index af7810d75..aaba3b077 100644 --- a/numpy/distutils/exec_command.py +++ b/numpy/distutils/exec_command.py @@ -67,8 +67,9 @@ def filepath_from_subprocess_output(output): Inherited from `exec_command`, and possibly incorrect. """ - output = output.decode(locale.getpreferredencoding(False), - errors='replace') + mylocale = locale.getpreferredencoding(False) + if mylocale is not None: + output = output.decode(mylocale, errors='replace') output = output.replace('\r\n', '\n') # Another historical oddity if output[-1:] == '\n': @@ -278,9 +279,9 @@ def _exec_command(command, use_shell=None, use_tee = None, **env): return 127, '' text, err = proc.communicate() - text = text.decode(locale.getpreferredencoding(False), - errors='replace') - + mylocale = locale.getpreferredencoding(False) + if mylocale is not None: + text = text.decode(mylocale, errors='replace') text = text.replace('\r\n', '\n') # Another historical oddity if text[-1:] == '\n': ``` Note that few tests fail, due to absent locale, but it's another story
2018-11-17T18:26:32Z
[]
[]
Traceback (most recent call last): File "setup.py", line 394, in <module> setup_package() File "setup.py", line 386, in setup_package setup(**metadata) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/core.py", line 135, in setup config = configuration() File "setup.py", line 166, in configuration config.add_subpackage('numpy') File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/misc_util.py", line 1029, in add_subpackage caller_level = 2) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/misc_util.py", line 998, in get_subpackage caller_level = caller_level + 1) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/misc_util.py", line 935, in _get_configuration_from_setup_py config = setup_module.configuration(*args) File "numpy/setup.py", line 10, in configuration config.add_subpackage('core') File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/misc_util.py", line 1029, in add_subpackage caller_level = 2) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/misc_util.py", line 998, in get_subpackage caller_level = caller_level + 1) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/misc_util.py", line 935, in _get_configuration_from_setup_py config = setup_module.configuration(*args) File "numpy/core/setup.py", line 839, in configuration blas_info = get_info('blas_opt', 0) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 432, in get_info return cl().get_info(notfound_action) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 624, in get_info self.calc_info() File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 1635, in calc_info blas_mkl_info = get_info('blas_mkl') File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 432, in get_info return cl().get_info(notfound_action) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 624, in get_info self.calc_info() File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 1071, in calc_info info = self.check_libs2(lib_dirs, mkl_libs) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 780, in check_libs2 exts = self.library_extensions() File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/system_info.py", line 739, in library_extensions c = customized_ccompiler() File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/__init__.py", line 34, in customized_ccompiler c.customize('') File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/ccompiler.py", line 522, in CCompiler_customize extra_preargs=['-MMD', '-MF', fn + '.d']) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/ccompiler.py", line 343, in CCompiler_compile single_compile(o) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/ccompiler.py", line 303, in single_compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/unixccompiler.py", line 58, in UnixCCompiler__compile extra_postargs, display = display) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/ccompiler.py", line 139, in CCompiler_spawn s, o = exec_command(cmd) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/exec_command.py", line 214, in exec_command **env) File "/usr/home/dimpase/Sage/sagemath/upstream/numpy/numpy/distutils/exec_command.py", line 264, in _exec_command errors='replace') TypeError: decode() argument 1 must be string, not None
9,777
numpy/numpy
numpy__numpy-12408
403d63749d0c6fe67ed9417a97d2d47de1405405
diff --git a/numpy/ma/core.py b/numpy/ma/core.py --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -449,17 +449,15 @@ def _check_fill_value(fill_value, ndtype): """ ndtype = np.dtype(ndtype) - fields = ndtype.fields if fill_value is None: fill_value = default_fill_value(ndtype) - elif fields: - fdtype = [(_[0], _[1]) for _ in ndtype.descr] + elif ndtype.names is not None: if isinstance(fill_value, (ndarray, np.void)): try: - fill_value = np.array(fill_value, copy=False, dtype=fdtype) + fill_value = np.array(fill_value, copy=False, dtype=ndtype) except ValueError: err_msg = "Unable to transform %s to dtype %s" - raise ValueError(err_msg % (fill_value, fdtype)) + raise ValueError(err_msg % (fill_value, ndtype)) else: fill_value = np.asarray(fill_value, dtype=object) fill_value = np.array(_recursive_set_fill_value(fill_value, ndtype), @@ -780,6 +778,10 @@ def fix_invalid(a, mask=nomask, copy=True, fill_value=None): a._data[invalid] = fill_value return a +def is_string_or_list_of_strings(val): + return (isinstance(val, basestring) or + (isinstance(val, list) and + builtins.all(isinstance(s, basestring) for s in val))) ############################################################################### # Ufuncs # @@ -3245,7 +3247,7 @@ def _scalar_heuristic(arr, elem): # Inherit attributes from self dout._update_from(self) # Check the fill_value - if isinstance(indx, basestring): + if is_string_or_list_of_strings(indx): if self._fill_value is not None: dout._fill_value = self._fill_value[indx]
Problem with views on masked structured arrays Create a view on a structured array (e.g. selecting a list of columns) causes problems with comparisons when the array is masked. ### Example ### Create a view on a masked structured array: ```python import numpy as np data = np.ma.array([ ('Mon', 'Sunny', 30, 20), ('Tue', 'Cloudy', 28, 17), ('Wed', 'Rain', 25, 17), ('Thu', 'Sunny', 29, 18), ('Fri', 'Sunny', 30, 20), ], dtype=[('day','|S3'),('weather','|S10'),('high','i4'),('low','i4')]) data2 = data[['day','high']] print (data2) ``` ``` [('Mon', 30) ('Tue', 28) ('Wed', 25) ('Thu', 29) ('Fri', 30)] ``` Try to do a comparison on the array: ```python print (data2[1:] == data2[:-1]) ``` ``` Traceback (most recent call last): File "test_numpy14.py", line 12, in <module> print (data2[1:] == data2[:-1]) File "XXX/lib/python2.7/site-packages/numpy/ma/core.py", line 4033, in __eq__ return self._comparison(other, operator.eq) File "XXX/lib/python2.7/site-packages/numpy/ma/core.py", line 3993, in _comparison sdata = sbroadcast.filled(odata) File "XXX/lib/python2.7/site-packages/numpy/ma/core.py", line 3709, in filled fill_value = _check_fill_value(fill_value, self.dtype) File "XXX/lib/python2.7/site-packages/numpy/ma/core.py", line 459, in _check_fill_value raise ValueError(err_msg % (fill_value, fdtype)) ValueError: Unable to transform [('Mon', 30) ('Tue', 28) ('Wed', 25) ('Thu', 29)] to dtype [('day', '|S3'), ('', '|V10'), ('high', '<i4'), ('', '|V4')] ``` A similar problem happens when calling `numpy.ma.unique` on the view. The problem persists even after copying the data (e.g. `data2 = data2.copy()`) I am using numpy 1.14.0 with Python 2.7.6. The problem does not appear in numpy 1.13.3, or when using a regular (non-masked) structured array.
Thanks for the report, confirmed. This is very similar to, or caused by, #10387, which itself is indirectly caused by our recent change in numpy 1.14.0 to return a view instead of a copy for multi-field indexing. We're on it. We are planning to revert that change in 1.14.1, and push it off to 1.15. That will give us time to fix this and similar bugs that need to be fixed first (#3176, #8100). This report is a little different from #10387, because it is likely that the `numpy.ma` code should not be using `dtype.descr` in the first place. So in addition to fixing the padding bytes in `.descr`, we should also remove use of `.descr` in `np.ma`. `fill_value` has some really weird semantics that are far too complex, when the logic should be nothing more than `self.fill_value = np.array(fill_value, dtype=self.dtype)`. Of course, that will certainly break compatibility. Perhaps we should start deprecating cases that give a different result. Pushing off to 1.16. @ahaldane How do you want to handle the 1.15 fix? If you want to keep master as is we should wait until 1.15 is branched.
2018-11-18T06:39:59Z
[]
[]
Traceback (most recent call last): File "test_numpy14.py", line 12, in <module> print (data2[1:] == data2[:-1]) File "XXX/lib/python2.7/site-packages/numpy/ma/core.py", line 4033, in __eq__ return self._comparison(other, operator.eq) File "XXX/lib/python2.7/site-packages/numpy/ma/core.py", line 3993, in _comparison sdata = sbroadcast.filled(odata) File "XXX/lib/python2.7/site-packages/numpy/ma/core.py", line 3709, in filled fill_value = _check_fill_value(fill_value, self.dtype) File "XXX/lib/python2.7/site-packages/numpy/ma/core.py", line 459, in _check_fill_value raise ValueError(err_msg % (fill_value, fdtype)) ValueError: Unable to transform [('Mon', 30) ('Tue', 28) ('Wed', 25) ('Thu', 29)] to dtype [('day', '|S3'), ('', '|V10'), ('high', '<i4'), ('', '|V4')]
9,778
numpy/numpy
numpy__numpy-12413
1466e788a43b8d4356fe35951bf0c3b0aedb554f
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py --- a/numpy/distutils/ccompiler.py +++ b/numpy/distutils/ccompiler.py @@ -19,7 +19,7 @@ from numpy.distutils.compat import get_exception from numpy.distutils.exec_command import filepath_from_subprocess_output from numpy.distutils.misc_util import cyg2win32, is_sequence, mingw32, \ - quote_args, get_num_build_jobs, \ + get_num_build_jobs, \ _commandline_dep_string # globals for parallel build management @@ -772,8 +772,13 @@ def new_compiler (plat=None, _distutils_gen_lib_options = gen_lib_options def gen_lib_options(compiler, library_dirs, runtime_library_dirs, libraries): - library_dirs = quote_args(library_dirs) - runtime_library_dirs = quote_args(runtime_library_dirs) + # the version of this function provided by CPython allows the following + # to return lists, which are unpacked automatically: + # - compiler.runtime_library_dir_option + # our version extends the behavior to: + # - compiler.library_dir_option + # - compiler.library_option + # - compiler.find_library_file r = _distutils_gen_lib_options(compiler, library_dirs, runtime_library_dirs, libraries) lib_opts = [] @@ -793,11 +798,6 @@ def gen_lib_options(compiler, library_dirs, runtime_library_dirs, libraries): if _m is not None: setattr(_m, 'gen_lib_options', gen_lib_options) -_distutils_gen_preprocess_options = gen_preprocess_options -def gen_preprocess_options (macros, include_dirs): - include_dirs = quote_args(include_dirs) - return _distutils_gen_preprocess_options(macros, include_dirs) -ccompiler.gen_preprocess_options = gen_preprocess_options ##Fix distutils.util.split_quoted: # NOTE: I removed this fix in revision 4481 (see ticket #619), but it appears
Building on windows no longer works Bisected to b18d0a5aeaa4495b6589b4e9f297db7f8df35bdd (#11898). Output on my machine, at 1466e788a43b8d4356fe35951bf0c3b0aedb554f: ``` > .\runtests.py -i Building, see build.log... numpy/random\mtrand\randint_helpers.pxi.in has not changed numpy/random\mtrand\mtrand.pyx has not changed Cythonizing sources blas_opt_info: blas_mkl_info: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries mkl_rt not found in ['C:\\Program Files\\Python 3.5\\lib', 'C:\\', 'C:\\Program Files\\Python 3.5\\libs'] NOT AVAILABLE blis_info: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries blis not found in ['C:\\Program Files\\Python 3.5\\lib', 'C:\\', 'C:\\Program Files\\Python 3.5\\libs'] NOT AVAILABLE openblas_info: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries openblas not found in ['C:\\Program Files\\Python 3.5\\lib', 'C:\\', 'C:\\Program Files\\Python 3.5\\libs'] get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']' customize GnuFCompiler Could not locate executable g77 Could not locate executable f77 customize IntelVisualFCompiler Could not locate executable ifort Could not locate executable ifl customize AbsoftFCompiler Could not locate executable f90 customize CompaqVisualFCompiler Could not locate executable DF customize IntelItaniumVisualFCompiler Could not locate executable efl customize Gnu95FCompiler Could not locate executable gfortran Could not locate executable f95 customize G95FCompiler Could not locate executable g95 customize IntelEM64VisualFCompiler customize IntelEM64TFCompiler Could not locate executable efort Could not locate executable efc customize PGroupFlangCompiler Could not locate executable flang don't know how to compile Fortran code on platform 'nt' NOT AVAILABLE atlas_3_10_blas_threads_info: Setting PTATLAS=ATLAS No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries tatlas not found in ['C:\\Program Files\\Python 3.5\\lib', 'C:\\', 'C:\\Program Files\\Python 3.5\\libs'] NOT AVAILABLE atlas_3_10_blas_info: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries satlas not found in ['C:\\Program Files\\Python 3.5\\lib', 'C:\\', 'C:\\Program Files\\Python 3.5\\libs'] NOT AVAILABLE atlas_blas_threads_info: Setting PTATLAS=ATLAS No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries ptf77blas,ptcblas,atlas not found in ['C:\\Program Files\\Python 3.5\\lib', 'C:\\', 'C:\\Program Files\\Python 3.5\\libs'] NOT AVAILABLE atlas_blas_info: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries f77blas,cblas,atlas not found in ['C:\\Program Files\\Python 3.5\\lib', 'C:\\', 'C:\\Program Files\\Python 3.5\\libs'] NOT AVAILABLE accelerate_info: NOT AVAILABLE blas_info: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries blas not found in ['C:\\Program Files\\Python 3.5\\lib', 'C:\\', 'C:\\Program Files\\Python 3.5\\libs'] NOT AVAILABLE blas_src_info: NOT AVAILABLE NOT AVAILABLE lapack_opt_info: lapack_mkl_info: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries mkl_rt not found in ['C:\\Program Files\\Python 3.5\\lib', 'C:\\', 'C:\\Program Files\\Python 3.5\\libs'] NOT AVAILABLE openblas_lapack_info: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries openblas not found in ['C:\\Program Files\\Python 3.5\\lib', 'C:\\', 'C:\\Program Files\\Python 3.5\\libs'] NOT AVAILABLE openblas_clapack_info: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries openblas,lapack not found in ['C:\\Program Files\\Python 3.5\\lib', 'C:\\', 'C:\\Program Files\\Python 3.5\\libs'] NOT AVAILABLE atlas_3_10_threads_info: Setting PTATLAS=ATLAS No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries tatlas,tatlas not found in C:\Program Files\Python 3.5\lib No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries lapack_atlas not found in C:\Program Files\Python 3.5\lib No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries tatlas,tatlas not found in C:\ No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries lapack_atlas not found in C:\ No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries tatlas,tatlas not found in C:\Program Files\Python 3.5\libs No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries lapack_atlas not found in C:\Program Files\Python 3.5\libs <class 'numpy.distutils.system_info.atlas_3_10_threads_info'> NOT AVAILABLE atlas_3_10_info: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries satlas,satlas not found in C:\Program Files\Python 3.5\lib No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries lapack_atlas not found in C:\Program Files\Python 3.5\lib No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries satlas,satlas not found in C:\ No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries lapack_atlas not found in C:\ No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries satlas,satlas not found in C:\Program Files\Python 3.5\libs No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries lapack_atlas not found in C:\Program Files\Python 3.5\libs <class 'numpy.distutils.system_info.atlas_3_10_info'> NOT AVAILABLE atlas_threads_info: Setting PTATLAS=ATLAS No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries ptf77blas,ptcblas,atlas not found in C:\Program Files\Python 3.5\lib No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries lapack_atlas not found in C:\Program Files\Python 3.5\lib No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries ptf77blas,ptcblas,atlas not found in C:\ No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries lapack_atlas not found in C:\ No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries ptf77blas,ptcblas,atlas not found in C:\Program Files\Python 3.5\libs No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries lapack_atlas not found in C:\Program Files\Python 3.5\libs <class 'numpy.distutils.system_info.atlas_threads_info'> NOT AVAILABLE atlas_info: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries f77blas,cblas,atlas not found in C:\Program Files\Python 3.5\lib No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries lapack_atlas not found in C:\Program Files\Python 3.5\lib No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries f77blas,cblas,atlas not found in C:\ No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries lapack_atlas not found in C:\ No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries f77blas,cblas,atlas not found in C:\Program Files\Python 3.5\libs No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries lapack_atlas not found in C:\Program Files\Python 3.5\libs <class 'numpy.distutils.system_info.atlas_info'> NOT AVAILABLE lapack_info: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries lapack not found in ['C:\\Program Files\\Python 3.5\\lib', 'C:\\', 'C:\\Program Files\\Python 3.5\\libs'] NOT AVAILABLE lapack_src_info: NOT AVAILABLE NOT AVAILABLE running build running config_cc unifing config_cc, config, build_clib, build_ext, build commands --compiler options running config_fc unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options running build_src build_src building py_modules sources creating build\src.win-amd64-3.5 creating build\src.win-amd64-3.5\numpy creating build\src.win-amd64-3.5\numpy\distutils building library "npymath" sources No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Inumpy\core\src\common -Inumpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\npysort -I"C:\Program Files\Python 3.5\include" -I"C:\Program Files\Python 3.5\include" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" /Tc_configtest.c /Fo_configtest.obj C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /MANIFEST:EMBED,ID=1 /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\um\x64" _configtest.obj /OUT:_configtest.exe success! removing: _configtest.c _configtest.obj _configtest.obj.d _configtest.exe C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Inumpy\core\src\common -Inumpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\npysort -I"C:\Program Files\Python 3.5\include" -I"C:\Program Files\Python 3.5\include" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" /Tc_configtest.c /Fo_configtest.obj C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /MANIFEST:EMBED,ID=1 /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.16299.0\um\x64" _configtest.obj /OUT:_configtest.exe success! removing: _configtest.c _configtest.obj _configtest.obj.d _configtest.exe creating build\src.win-amd64-3.5\numpy\core creating build\src.win-amd64-3.5\numpy\core\src creating build\src.win-amd64-3.5\numpy\core\src\npymath conv_template:> build\src.win-amd64-3.5\numpy\core\src\npymath\npy_math_internal.h adding 'build\src.win-amd64-3.5\numpy\core\src\npymath' to include_dirs. conv_template:> build\src.win-amd64-3.5\numpy\core\src\npymath\ieee754.c conv_template:> build\src.win-amd64-3.5\numpy\core\src\npymath\npy_math_complex.c None - nothing done with h_files = ['build\\src.win-amd64-3.5\\numpy\\core\\src\\npymath\\npy_math_internal.h'] building library "npysort" sources creating build\src.win-amd64-3.5\numpy\core\src\common conv_template:> build\src.win-amd64-3.5\numpy\core\src\common\npy_sort.h adding 'build\src.win-amd64-3.5\numpy\core\src\common' to include_dirs. creating build\src.win-amd64-3.5\numpy\core\src\npysort conv_template:> build\src.win-amd64-3.5\numpy\core\src\npysort\quicksort.c conv_template:> build\src.win-amd64-3.5\numpy\core\src\npysort\mergesort.c conv_template:> build\src.win-amd64-3.5\numpy\core\src\npysort\heapsort.c conv_template:> build\src.win-amd64-3.5\numpy\core\src\common\npy_partition.h conv_template:> build\src.win-amd64-3.5\numpy\core\src\npysort\selection.c conv_template:> build\src.win-amd64-3.5\numpy\core\src\common\npy_binsearch.h conv_template:> build\src.win-amd64-3.5\numpy\core\src\npysort\binsearch.c None - nothing done with h_files = ['build\\src.win-amd64-3.5\\numpy\\core\\src\\common\\npy_sort.h', 'build\\src.win-amd64-3.5\\numpy\\core\\src\\common\\npy_partition.h', 'build\\src.win-amd64-3.5\\numpy\\core\\src\\common\\npy_binsearch.h'] building extension "numpy.core._dummy" sources Generating build\src.win-amd64-3.5\numpy\core\include/numpy\config.h C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Inumpy\core\src\common -Inumpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\npysort -I"C:\Program Files\Python 3.5\include" -I"C:\Program Files\Python 3.5\include" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" -I"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt" /Tc_configtest.c /Fo_configtest.obj b"_configtest.c\r\n_configtest.c(1): fatal error C1083: Cannot open include file: 'Python.h': No such file or directory\r\n" failure. removing: _configtest.c _configtest.obj Running from numpy source directory. numpy\core\setup.py:400: MismatchCAPIWarning: API mismatch detected, the C API version numbers have to be updated. Current C api version is 13, with checksum 5b0e8bbded00b166125974fc71e80a33, but recorded checksum for C API version 13 in codegen_dir/cversions.txt is a1bc756c5782853ec2e3616cf66869d8. If functions were added in the C API, you have to update C_API_VERSION in numpy\core\setup_common.py. check_api_version(C_API_VERSION, codegen_dir) C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\system_info.py:625: UserWarning: Atlas (http://math-atlas.sourceforge.net/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [atlas]) or by setting the ATLAS environment variable. self.calc_info() C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\system_info.py:625: UserWarning: Blas (http://www.netlib.org/blas/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [blas]) or by setting the BLAS environment variable. self.calc_info() C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\system_info.py:625: UserWarning: Blas (http://www.netlib.org/blas/) sources not found. Directories to search for the sources can be specified in the numpy/distutils/site.cfg file (section [blas_src]) or by setting the BLAS_SRC environment variable. self.calc_info() C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\system_info.py:625: UserWarning: Lapack (http://www.netlib.org/lapack/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [lapack]) or by setting the LAPACK environment variable. self.calc_info() C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\system_info.py:625: UserWarning: Lapack (http://www.netlib.org/lapack/) sources not found. Directories to search for the sources can be specified in the numpy/distutils/site.cfg file (section [lapack_src]) or by setting the LAPACK_SRC environment variable. self.calc_info() C:\Program Files\Python 3.5\lib\distutils\dist.py:261: UserWarning: Unknown distribution option: 'define_macros' warnings.warn(msg) Traceback (most recent call last): File "setup.py", line 415, in <module> setup_package() File "setup.py", line 407, in setup_package setup(**metadata) File "C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\core.py", line 171, in setup return old_setup(**new_attr) File "C:\Users\wiese\AppData\Roaming\Python\Python35\site-packages\setuptools\__init__.py", line 129, in setup return distutils.core.setup(**attrs) File "C:\Program Files\Python 3.5\lib\distutils\core.py", line 148, in setup dist.run_commands() File "C:\Program Files\Python 3.5\lib\distutils\dist.py", line 955, in run_commands self.run_command(cmd) File "C:\Program Files\Python 3.5\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\command\build.py", line 47, in run old_build.run(self) File "C:\Program Files\Python 3.5\lib\distutils\command\build.py", line 135, in run self.run_command(cmd_name) File "C:\Program Files\Python 3.5\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Program Files\Python 3.5\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\command\build_src.py", line 148, in run self.build_sources() File "C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\command\build_src.py", line 165, in build_sources self.build_extension_sources(ext) File "C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\command\build_src.py", line 324, in build_extension_sources sources = self.generate_sources(sources, ext) File "C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\command\build_src.py", line 377, in generate_sources source = func(extension, build_dir) File "numpy\core\setup.py", line 422, in generate_config_h moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir) File "numpy\core\setup.py", line 47, in check_types out = check_types(*a, **kw) File "numpy\core\setup.py", line 281, in check_types "install {0}-dev|{0}-devel.".format(python)) SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel. Build failed! ```
What's different on your machine vs. the passing builds in our Azure CI matrix? Probably the installation paths. My hunch is that MSVC is now receiving extra quotes, due to `CCompiler.spawn` having a poorly-designed contract (one that we don't own) when passed lists. I assumed that the list semantics were an extension for our own use, but it looks like they're relied upon in `distutils._msvccompiler`. Basically, `CCompiler.spawn(['"C:/Program', 'Files/program.exe"'])` seems to be required to behave the same as `subprocess.call(["C:/Program Files/program.exe"])`, which is pretty alarming to me. https://bugs.python.org/issue8987 is related here, but it looks like distutils is destined to be broken forever, for fear of breaking people who are working around the bugs. Removing our patch to `gen_preprocess_options`, which causes arguments to be double-quoted, seems to solve the issue. In fact, I think every instance of `quote_args` probably needs to be removed from `numpy.distutils`.
2018-11-19T02:21:53Z
[]
[]
Traceback (most recent call last): File "setup.py", line 415, in <module> setup_package() File "setup.py", line 407, in setup_package setup(**metadata) File "C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\core.py", line 171, in setup return old_setup(**new_attr) File "C:\Users\wiese\AppData\Roaming\Python\Python35\site-packages\setuptools\__init__.py", line 129, in setup return distutils.core.setup(**attrs) File "C:\Program Files\Python 3.5\lib\distutils\core.py", line 148, in setup dist.run_commands() File "C:\Program Files\Python 3.5\lib\distutils\dist.py", line 955, in run_commands self.run_command(cmd) File "C:\Program Files\Python 3.5\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\command\build.py", line 47, in run old_build.run(self) File "C:\Program Files\Python 3.5\lib\distutils\command\build.py", line 135, in run self.run_command(cmd_name) File "C:\Program Files\Python 3.5\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Program Files\Python 3.5\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\command\build_src.py", line 148, in run self.build_sources() File "C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\command\build_src.py", line 165, in build_sources self.build_extension_sources(ext) File "C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\command\build_src.py", line 324, in build_extension_sources sources = self.generate_sources(sources, ext) File "C:\Users\wiese\Repos\numeric-python\numpy\numpy\distutils\command\build_src.py", line 377, in generate_sources source = func(extension, build_dir) File "numpy\core\setup.py", line 422, in generate_config_h moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir) File "numpy\core\setup.py", line 47, in check_types out = check_types(*a, **kw) File "numpy\core\setup.py", line 281, in check_types "install {0}-dev|{0}-devel.".format(python)) SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel.
9,779
numpy/numpy
numpy__numpy-12831
f8058c81220565d0837a4331fbec7aa8dce5aaa9
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py --- a/numpy/distutils/ccompiler.py +++ b/numpy/distutils/ccompiler.py @@ -639,7 +639,7 @@ def matcher(version_string): return version try: - output = subprocess.check_output(version_cmd) + output = subprocess.check_output(version_cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as exc: output = exc.output status = exc.returncode
[BUG] Intel Fortran compiler installed but not found Hi, I have intel compilers installed, but get this: ``` Found executable /opt/intel/compilers_and_libraries_2018.1.163/linux/bin/intel64/icc customize IntelEM64TFCompiler Found executable /opt/intel/compilers_and_libraries_2018.1.163/linux/bin/intel64/ifort Traceback (most recent call last): File "setup.py", line 418, in <module>setup_package() File "setup.py", line 414, in setup_packagesetup(**metadata) File "/usr/lib/python3.6/site-packages/numpy/distutils/core.py", line 169, in setupreturn old_setup(**new_attr) File "/usr/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setupreturn distutils.core.setup(**attrs) File "/usr/lib/python3.6/distutils/core.py", line 148, in setupdist.run_commands() File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commandsself.run_command(cmd) File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_commandcmd_obj.run() File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_clib.py", line 75, in runself.run_command('build_src') File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_commandself.distribution.run_command(command) File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_commandcmd_obj.run() File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_src.py", line 148, in runself.build_sources() File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_src.py", line 165, in build_sourcesself.build_extension_sources(ext) File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_src.py", line 324, in build_extension_sourcessources = self.generate_sources(sources, ext) File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_src.py", line 377, in generate_sourcessource = func(extension, build_dir) File "scipy/_lib/setup.py", line 32, in get_messagestream_configif config_cmd.check_func('open_memstream', decl=True, call=True): File "/usr/lib/python3.6/site-packages/numpy/distutils/command/config.py", line 312, in check_funcself._check_compiler() File "/usr/lib/python3.6/site-packages/numpy/distutils/command/config.py", line 83, in _check_compilerself.fcompiler.customize(self.distribution) File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/__init__.py", line 499, in customizeget_flags('opt', oflags) File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/__init__.py", line 490, in get_flagsflags.extend(getattr(self.flag_vars, tag)) File "/usr/lib/python3.6/site-packages/numpy/distutils/environment.py", line 39, in __getattr__return self._get_var(name, conf_desc) File "/usr/lib/python3.6/site-packages/numpy/distutils/environment.py", line 53, in _get_varvar = self._hook_handler(name, hook) File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/__init__.py", line 697, in _environment_hookreturn hook() File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/intel.py", line 125, in get_flags_optv = self.get_version() File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/__init__.py", line 430, in get_versionraise CompilerNotFound() numpy.distutils.fcompiler.CompilerNotFound ```
Hmm, looks like a bug. Did you use a `site.cfg`? And what build command did you use? My NumPy 1.14 was build by this: https://aur.archlinux.org/cgit/aur.git/tree/?h=python-numpy-mkl Then, I tried to build [SciPy with MKL](https://aur.archlinux.org/cgit/aur.git/tree/?h=python-scipy-mkl) and got that error But the same error raises when I import `distutils` and try get the version manually. Probably due to a mismatch between where MKL was located for the numpy build: library_dirs = /opt/intel/mkl/lib/intel64/ include_dirs = /opt/intel/mkl/include and the scipy build: Found executable /opt/intel/compilers_and_libraries_2018.1.163/linux/bin/intel64/icc customize IntelEM64TFCompiler Found executable /opt/intel/compilers_and_libraries_2018.1.163/linux/bin/intel64/ifort Still a bug, but if you move your MKL install or create a symlink from `/opt/intel/mkl/` I expect the build to succeed. I'll try this. Seems the problem has long roots: https://github.com/numpy/numpy/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3A"component%3A+numpy.distutils"+ @homocomputeris Any results so far? Surprisingly, I have exactly the same problem now, however, I managed to build it successfully earlier. The only thing that has changed is icc version. @V-Kh Not really. I believe I eventually managed to compile it, but it should have been a happy coincidence of config and a proper MKL installation. I avoided the problem by using GCC. @homocomputeris OK, we're lucky enough: there is a new release available: https://aur.archlinux.org/cgit/aur.git/commit/?h=python-scipy-mkl&id=f749ab88426dc943806eb5442ec539c7e5d2ade0 UPD. there is no need to rush, the problem is still there :-/
2019-01-23T07:54:45Z
[]
[]
Traceback (most recent call last): File "setup.py", line 418, in <module>setup_package() File "setup.py", line 414, in setup_packagesetup(**metadata)
9,802
numpy/numpy
numpy__numpy-13433
7efa6192f9393621190e85927a612d11c986718b
diff --git a/numpy/lib/format.py b/numpy/lib/format.py --- a/numpy/lib/format.py +++ b/numpy/lib/format.py @@ -261,15 +261,19 @@ def dtype_to_descr(dtype): def descr_to_dtype(descr): ''' descr may be stored as dtype.descr, which is a list of - (name, format, [shape]) tuples. Offsets are not explicitly saved, rather - empty fields with name,format == '', '|Vn' are added as padding. + (name, format, [shape]) tuples where format may be a str or a tuple. + Offsets are not explicitly saved, rather empty fields with + name, format == '', '|Vn' are added as padding. This function reverses the process, eliminating the empty padding fields. ''' - if isinstance(descr, (str, dict)): + if isinstance(descr, str): # No padding removal needed return numpy.dtype(descr) - + elif isinstance(descr, tuple): + # subtype, will always have a shape descr[1] + dt = descr_to_dtype(descr[0]) + return numpy.dtype((dt, descr[1])) fields = [] offset = 0 for field in descr:
np.load() "invalid shape in fixed-type tuple" in NumPy 1.16.0 In NumPy 1.16.0, `np.load()` fails to load some files created by `np.save()`, saying "ValueError: invalid shape in fixed-type tuple." The problem seems to be that #12358 changed `np.lib.format._read_array_header()`. It used to pass the descr to `np.dtype()`, but now it uses a new function `descr_to_dtype()` which fails for some valid inputs. We have significant amounts of data stored on disk with formats which NumPy 1.16.0 cannot load, so this is a showstopper for upgrading beyond 1.15. ### Reproducing code example: This fails in NumPy 1.16.0, but works in all prior versions: ```python import numpy as np a = np.zeros(1, np.dtype([('c', ('<f8', (5,)), (2,))])) np.save('a.npy', a) np.load('a.npy') ``` ### Error message: ``` Traceback (most recent call last): File "numpy/lib/npyio.py", line 440, in load pickle_kwargs=pickle_kwargs) File "numpy/lib/format.py", line 678, in read_array shape, fortran_order, dtype = _read_array_header(fp, version) File "numpy/lib/format.py", line 563, in _read_array_header dtype = descr_to_dtype(d['descr']) File "numpy/lib/format.py", line 282, in descr_to_dtype dt = numpy.dtype((descr_to_dtype(descr_str), shape)) File "numpy/lib/format.py", line 282, in descr_to_dtype dt = numpy.dtype((descr_to_dtype(descr_str), shape)) ValueError: invalid shape in fixed-type tuple. ``` ### Numpy/Python version information: NumPy 1.16.0 Python 3.6.6
2019-04-30T11:01:50Z
[]
[]
Traceback (most recent call last): File "numpy/lib/npyio.py", line 440, in load pickle_kwargs=pickle_kwargs) File "numpy/lib/format.py", line 678, in read_array shape, fortran_order, dtype = _read_array_header(fp, version) File "numpy/lib/format.py", line 563, in _read_array_header dtype = descr_to_dtype(d['descr']) File "numpy/lib/format.py", line 282, in descr_to_dtype dt = numpy.dtype((descr_to_dtype(descr_str), shape)) File "numpy/lib/format.py", line 282, in descr_to_dtype dt = numpy.dtype((descr_to_dtype(descr_str), shape)) ValueError: invalid shape in fixed-type tuple.
9,831
numpy/numpy
numpy__numpy-13561
1b5b0b4306f1ec0115e4db7bf39a4af4c74b6b08
diff --git a/numpy/lib/format.py b/numpy/lib/format.py --- a/numpy/lib/format.py +++ b/numpy/lib/format.py @@ -262,15 +262,19 @@ def dtype_to_descr(dtype): def descr_to_dtype(descr): ''' descr may be stored as dtype.descr, which is a list of - (name, format, [shape]) tuples. Offsets are not explicitly saved, rather - empty fields with name,format == '', '|Vn' are added as padding. + (name, format, [shape]) tuples where format may be a str or a tuple. + Offsets are not explicitly saved, rather empty fields with + name, format == '', '|Vn' are added as padding. This function reverses the process, eliminating the empty padding fields. ''' - if isinstance(descr, (str, dict)): + if isinstance(descr, str): # No padding removal needed return numpy.dtype(descr) - + elif isinstance(descr, tuple): + # subtype, will always have a shape descr[1] + dt = descr_to_dtype(descr[0]) + return numpy.dtype((dt, descr[1])) fields = [] offset = 0 for field in descr:
np.load() "invalid shape in fixed-type tuple" in NumPy 1.16.0 In NumPy 1.16.0, `np.load()` fails to load some files created by `np.save()`, saying "ValueError: invalid shape in fixed-type tuple." The problem seems to be that #12358 changed `np.lib.format._read_array_header()`. It used to pass the descr to `np.dtype()`, but now it uses a new function `descr_to_dtype()` which fails for some valid inputs. We have significant amounts of data stored on disk with formats which NumPy 1.16.0 cannot load, so this is a showstopper for upgrading beyond 1.15. ### Reproducing code example: This fails in NumPy 1.16.0, but works in all prior versions: ```python import numpy as np a = np.zeros(1, np.dtype([('c', ('<f8', (5,)), (2,))])) np.save('a.npy', a) np.load('a.npy') ``` ### Error message: ``` Traceback (most recent call last): File "numpy/lib/npyio.py", line 440, in load pickle_kwargs=pickle_kwargs) File "numpy/lib/format.py", line 678, in read_array shape, fortran_order, dtype = _read_array_header(fp, version) File "numpy/lib/format.py", line 563, in _read_array_header dtype = descr_to_dtype(d['descr']) File "numpy/lib/format.py", line 282, in descr_to_dtype dt = numpy.dtype((descr_to_dtype(descr_str), shape)) File "numpy/lib/format.py", line 282, in descr_to_dtype dt = numpy.dtype((descr_to_dtype(descr_str), shape)) ValueError: invalid shape in fixed-type tuple. ``` ### Numpy/Python version information: NumPy 1.16.0 Python 3.6.6
2019-05-14T22:41:16Z
[]
[]
Traceback (most recent call last): File "numpy/lib/npyio.py", line 440, in load pickle_kwargs=pickle_kwargs) File "numpy/lib/format.py", line 678, in read_array shape, fortran_order, dtype = _read_array_header(fp, version) File "numpy/lib/format.py", line 563, in _read_array_header dtype = descr_to_dtype(d['descr']) File "numpy/lib/format.py", line 282, in descr_to_dtype dt = numpy.dtype((descr_to_dtype(descr_str), shape)) File "numpy/lib/format.py", line 282, in descr_to_dtype dt = numpy.dtype((descr_to_dtype(descr_str), shape)) ValueError: invalid shape in fixed-type tuple.
9,839
numpy/numpy
numpy__numpy-13564
1b5b0b4306f1ec0115e4db7bf39a4af4c74b6b08
diff --git a/numpy/distutils/ccompiler.py b/numpy/distutils/ccompiler.py --- a/numpy/distutils/ccompiler.py +++ b/numpy/distutils/ccompiler.py @@ -639,7 +639,7 @@ def matcher(version_string): return version try: - output = subprocess.check_output(version_cmd) + output = subprocess.check_output(version_cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as exc: output = exc.output status = exc.returncode
[BUG] Intel Fortran compiler installed but not found Hi, I have intel compilers installed, but get this: ``` Found executable /opt/intel/compilers_and_libraries_2018.1.163/linux/bin/intel64/icc customize IntelEM64TFCompiler Found executable /opt/intel/compilers_and_libraries_2018.1.163/linux/bin/intel64/ifort Traceback (most recent call last): File "setup.py", line 418, in <module>setup_package() File "setup.py", line 414, in setup_packagesetup(**metadata) File "/usr/lib/python3.6/site-packages/numpy/distutils/core.py", line 169, in setupreturn old_setup(**new_attr) File "/usr/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setupreturn distutils.core.setup(**attrs) File "/usr/lib/python3.6/distutils/core.py", line 148, in setupdist.run_commands() File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commandsself.run_command(cmd) File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_commandcmd_obj.run() File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_clib.py", line 75, in runself.run_command('build_src') File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_commandself.distribution.run_command(command) File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_commandcmd_obj.run() File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_src.py", line 148, in runself.build_sources() File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_src.py", line 165, in build_sourcesself.build_extension_sources(ext) File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_src.py", line 324, in build_extension_sourcessources = self.generate_sources(sources, ext) File "/usr/lib/python3.6/site-packages/numpy/distutils/command/build_src.py", line 377, in generate_sourcessource = func(extension, build_dir) File "scipy/_lib/setup.py", line 32, in get_messagestream_configif config_cmd.check_func('open_memstream', decl=True, call=True): File "/usr/lib/python3.6/site-packages/numpy/distutils/command/config.py", line 312, in check_funcself._check_compiler() File "/usr/lib/python3.6/site-packages/numpy/distutils/command/config.py", line 83, in _check_compilerself.fcompiler.customize(self.distribution) File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/__init__.py", line 499, in customizeget_flags('opt', oflags) File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/__init__.py", line 490, in get_flagsflags.extend(getattr(self.flag_vars, tag)) File "/usr/lib/python3.6/site-packages/numpy/distutils/environment.py", line 39, in __getattr__return self._get_var(name, conf_desc) File "/usr/lib/python3.6/site-packages/numpy/distutils/environment.py", line 53, in _get_varvar = self._hook_handler(name, hook) File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/__init__.py", line 697, in _environment_hookreturn hook() File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/intel.py", line 125, in get_flags_optv = self.get_version() File "/usr/lib/python3.6/site-packages/numpy/distutils/fcompiler/__init__.py", line 430, in get_versionraise CompilerNotFound() numpy.distutils.fcompiler.CompilerNotFound ```
Hmm, looks like a bug. Did you use a `site.cfg`? And what build command did you use? My NumPy 1.14 was build by this: https://aur.archlinux.org/cgit/aur.git/tree/?h=python-numpy-mkl Then, I tried to build [SciPy with MKL](https://aur.archlinux.org/cgit/aur.git/tree/?h=python-scipy-mkl) and got that error But the same error raises when I import `distutils` and try get the version manually. Probably due to a mismatch between where MKL was located for the numpy build: library_dirs = /opt/intel/mkl/lib/intel64/ include_dirs = /opt/intel/mkl/include and the scipy build: Found executable /opt/intel/compilers_and_libraries_2018.1.163/linux/bin/intel64/icc customize IntelEM64TFCompiler Found executable /opt/intel/compilers_and_libraries_2018.1.163/linux/bin/intel64/ifort Still a bug, but if you move your MKL install or create a symlink from `/opt/intel/mkl/` I expect the build to succeed. I'll try this. Seems the problem has long roots: https://github.com/numpy/numpy/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3A"component%3A+numpy.distutils"+ @homocomputeris Any results so far? Surprisingly, I have exactly the same problem now, however, I managed to build it successfully earlier. The only thing that has changed is icc version. @V-Kh Not really. I believe I eventually managed to compile it, but it should have been a happy coincidence of config and a proper MKL installation. I avoided the problem by using GCC. @homocomputeris OK, we're lucky enough: there is a new release available: https://aur.archlinux.org/cgit/aur.git/commit/?h=python-scipy-mkl&id=f749ab88426dc943806eb5442ec539c7e5d2ade0 UPD. there is no need to rush, the problem is still there :-/
2019-05-14T23:23:15Z
[]
[]
Traceback (most recent call last): File "setup.py", line 418, in <module>setup_package() File "setup.py", line 414, in setup_packagesetup(**metadata)
9,840
numpy/numpy
numpy__numpy-13629
387ba1f2be61c1b75b40c3ef8b5f9a24254b02b3
diff --git a/numpy/distutils/command/install_clib.py b/numpy/distutils/command/install_clib.py --- a/numpy/distutils/command/install_clib.py +++ b/numpy/distutils/command/install_clib.py @@ -19,6 +19,9 @@ def finalize_options(self): def run (self): build_clib_cmd = get_cmd("build_clib") + if not build_clib_cmd.build_clib: + # can happen if the user specified `--skip-build` + build_clib_cmd.finalize_options() build_dir = build_clib_cmd.build_clib # We need the compiler to get the library name -> filename association
1.16.2 build fails with python 3.6 on install stage Running from numpy source directory. /usr/lib64/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'define_macros' warnings.warn(msg) Traceback (most recent call last): File "setup.py", line 415, in <module> setup_package() File "setup.py", line 407, in setup_package setup(**metadata) File "/builddir/build/BUILD/numpy-1.16.2/numpy/distutils/core.py", line 171, in setup return old_setup(**new_attr) File "/usr/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup return distutils.core.setup(**attrs) File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands self.run_command(cmd) File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/builddir/build/BUILD/numpy-1.16.2/numpy/distutils/command/install.py", line 62, in run r = self.setuptools_run() File "/builddir/build/BUILD/numpy-1.16.2/numpy/distutils/command/install.py", line 36, in setuptools_run return distutils_install.run(self) File "/usr/lib64/python3.6/distutils/command/install.py", line 568, in run self.run_command(cmd_name) File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/builddir/build/BUILD/numpy-1.16.2/numpy/distutils/command/install_data.py", line 19, in run self.run_command('install_clib') File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/builddir/build/BUILD/numpy-1.16.2/numpy/distutils/command/install_clib.py", line 34, in run source = os.path.join(build_dir, name) File "/usr/lib64/python3.6/posixpath.py", line 80, in join a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not NoneType
The same for 1.16.3 did you do `git clean -xfd` before building? I have used the source from pip, so no git stuff is inside. Are the sources different? After debug the installer I found, the source of the problem and and hot fix for it. But this fix will only work on Centos. In numpy/distutils/command/install_clib.py build_dir will be None. I don't know why. My fix is that: [numpy-patch.txt](https://github.com/numpy/numpy/files/3191194/numpy-patch.txt) Now the installer will work, but the tests fails, because some files where not installed. This have I fixed with: > for missing in __multiarray_api.h _numpyconfig.h > do > install build/src.linux-%{_target_cpu}-?.?/numpy/core/include/numpy/${missing} %{buildroot}%{python3_sitearch}/%{pypi_name}/core/include/numpy > done > mkdir -p %{buildroot}%{python3_sitearch}/%{pypi_name}/core/lib/npy-pkg-config > for ini in mlib.ini npymath.ini > do > install build/src.linux-%{_target_cpu}-?.?/numpy/core/lib/npy-pkg-config/${ini} %{buildroot}%{python3_sitearch}/%{pypi_name}/core/lib/npy-pkg-config/ > done What command are you running? What version of distutils/setuptools do you have? Those files should be generated when building NumPy. I use the versions of distutils/setuptools that comes with Python from CentOS. Because it are in the core package I can't tell you the version. For the build: /usr/bin/python3.6 setup.py build '--executable=/usr/bin/python3.6 -s' For the install: /usr/bin/python3.6 setup.py install -O1 --skip-build --root /builddir/build/BUILDROOT/python-numpy-1.16.3-1.el7.x86_64
2019-05-26T05:57:02Z
[]
[]
Traceback (most recent call last): File "setup.py", line 415, in <module> setup_package() File "setup.py", line 407, in setup_package setup(**metadata) File "/builddir/build/BUILD/numpy-1.16.2/numpy/distutils/core.py", line 171, in setup return old_setup(**new_attr) File "/usr/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup return distutils.core.setup(**attrs) File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup dist.run_commands() File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands self.run_command(cmd) File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/builddir/build/BUILD/numpy-1.16.2/numpy/distutils/command/install.py", line 62, in run r = self.setuptools_run() File "/builddir/build/BUILD/numpy-1.16.2/numpy/distutils/command/install.py", line 36, in setuptools_run return distutils_install.run(self) File "/usr/lib64/python3.6/distutils/command/install.py", line 568, in run self.run_command(cmd_name) File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/builddir/build/BUILD/numpy-1.16.2/numpy/distutils/command/install_data.py", line 19, in run self.run_command('install_clib') File "/usr/lib64/python3.6/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command cmd_obj.run() File "/builddir/build/BUILD/numpy-1.16.2/numpy/distutils/command/install_clib.py", line 34, in run source = os.path.join(build_dir, name) File "/usr/lib64/python3.6/posixpath.py", line 80, in join a = os.fspath(a) TypeError: expected str, bytes or os.PathLike object, not NoneType
9,844
numpy/numpy
numpy__numpy-15949
8f7adad487ebac177964a577f5d263da975d8333
diff --git a/numpy/ma/core.py b/numpy/ma/core.py --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -3297,6 +3297,10 @@ def _scalar_heuristic(arr, elem): if self._fill_value is not None: dout._fill_value = self._fill_value[indx] + # Something like gh-15895 has happened if this check fails. + # _fill_value should always be an ndarray. + if not isinstance(dout._fill_value, np.ndarray): + raise RuntimeError('Internal NumPy error.') # If we're indexing a multidimensional field in a # structured array (such as dtype("(2,)i2,(2,)i1")), # dimensionality goes up (M[field].ndim == M.ndim + @@ -3304,7 +3308,7 @@ def _scalar_heuristic(arr, elem): # M[field] but problematic for M[field].fill_value # which should have shape () to avoid breaking several # methods. There is no great way out, so set to - # first element. See issue #6723. + # first element. See issue #6723. if dout._fill_value.ndim > 0: if not (dout._fill_value == dout._fill_value.flat[0]).all(): @@ -3315,7 +3319,10 @@ def _scalar_heuristic(arr, elem): "heterogeneous fill_value and setting " f"all to {dout._fill_value[0]!s}.", stacklevel=2) - dout._fill_value = dout._fill_value.flat[0] + # Need to use `.flat[0:1].squeeze(...)` instead of just + # `.flat[0]` to ensure the result is a 0d array and not + # a scalar. + dout._fill_value = dout._fill_value.flat[0:1].squeeze(axis=0) dout._isfield = True # Update the mask if needed if mout is not nomask:
BUG: MaskedArray with nested dtype and object elements cause AttributeError on access When I create a `MaskedArray` using a nested dtype which contains an `object` at the innermost level, trying to access it causes an _AttributeError: 'str' object has no attribute 'ndim'_. If I use `int` instead of `object`, the element access works fine. The issue seems to be caused by the assumption that `_fill_value` is of a numpy type and has an `ndim` attribute. This assumption is true for `numpy.int32` which would be used if `int` was specified inside the dtype. But for `object`, the `_fill_value` will be a just python `str` _'?'_, which has no attribute `ndim`. I propose to change the code line in question to ```python if hasattr(dout._fill_value, 'ndim') and dout._fill_value.ndim > 0: ``` ### Reproducing code example: ```python import numpy as np my_dtype = np.dtype([('b', [('c', object)], (1,))]) a = np.ma.masked_all((1,), my_dtype) print(a['b']['c']) ``` ### Error message: ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python37\lib\site-packages\numpy\ma\core.py", line 3276, in __getitem__ if dout._fill_value.ndim > 0: AttributeError: 'str' object has no attribute 'ndim' ``` ### Numpy/Python version information: 1.18.1 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
Nice catch but shouldn't we just check if __fill_value is not a ```str``` rather than use hasattr. But even then it feels hacky, there seems to be a comment regarding issue #6723 above the check. is this the right approach @seberg ? Trying to understand the background better. Well, its a bit of a mess. But aside from that, you are right of course. Checking for `ndim` has a bad code smell (and could definitely fail). Even the current code _can_ do something incorrect for certain `object` cases in theory. I think the solution has to be to test for this happening more directly, one thing I am considering is changing it along: ``` new_fill_value = self._fill_value[indx, ...] # guarantee array return ``` and moving the `flat` line out of the if. Or, alternative adding an `else: dout._fill_value = new_fill_value[()]`. So, the purpose of `_fill_value` was to _always_ be an array, unlike `.fill_value` which is the scalar. Do we know how `_fill_value` is ending up with the wrong type? Ah sorry, this is of course structured access, which is the problem (so the `...` suggestion will not work on its own). In any case, this code branch seems to not know about `_fill_value` being guaranteed to be an array, and it has to make sure of that. Probably the best thing to do is to get the new dtype directly with `dtype = self._fill_value.dtype[indx]`, and then using `dtype.ndim` to check for that special branch and otherwise create a new empty array with that dtype and assign to it to ensure that the new `_fill_value` is again an array. I have looked into the issue, a little more I have a better understanding of masked array The solution would be something like this? @seberg ```python if self._fill_value.dtype[indx].ndim > 0: if not (dout._fill_value == dout._fill_value.flat[0]).all(): warnings.warn( "Upon accessing multidimensional field " f"{indx!s}, need to keep dimensionality " "of fill_value at 0. Discarding " "heterogeneous fill_value and setting " f"all to {dout._fill_value[0]!s}.", stacklevel=2) dout._fill_value = dout._fill_value.flat[0] else: dout._fill_value = array(self._fill_value[indx]) ```
2020-04-11T01:47:28Z
[]
[]
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python37\lib\site-packages\numpy\ma\core.py", line 3276, in __getitem__ if dout._fill_value.ndim > 0: AttributeError: 'str' object has no attribute 'ndim'
9,912
numpy/numpy
numpy__numpy-16708
19f91f3935069229bbc23bbda4294c36957901a5
diff --git a/numpy/__init__.py b/numpy/__init__.py --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -338,11 +338,18 @@ def _mac_os_check(): import os use_hugepage = os.environ.get("NUMPY_MADVISE_HUGEPAGE", None) if sys.platform == "linux" and use_hugepage is None: - use_hugepage = 1 - kernel_version = os.uname().release.split(".")[:2] - kernel_version = tuple(int(v) for v in kernel_version) - if kernel_version < (4, 6): - use_hugepage = 0 + # If there is an issue with parsing the kernel version, + # set use_hugepages to 0. Usage of LooseVersion will handle + # the kernel version parsing better, but avoided since it + # will increase the import time. See: #16679 for related discussion. + try: + use_hugepage = 1 + kernel_version = os.uname().release.split(".")[:2] + kernel_version = tuple(int(v) for v in kernel_version) + if kernel_version < (4, 6): + use_hugepage = 0 + except ValueError: + use_hugepages = 0 elif use_hugepage is None: # This is not Linux, so it should not matter, just enable anyway use_hugepage = 1
BUG: non-numeric kernel_version on the OVH platform <!-- Please describe the issue in detail here, and fill in the fields below --> <!-- A short code example that reproduces the problem/missing feature. It should be self-contained, i.e., possible to run as-is via 'python myproblem.py' --> Hello, there is an error in the code of __ini__.py (Python3.8) , when detecting the version of the Kernel. I found the solution but I detail the problem here to help other users. ```python # We usually use madvise hugepages support, but on some old kernels it # is slow and thus better avoided. # Specifically kernel version 4.6 had a bug fix which probably fixed this: # https://github.com/torvalds/linux/commit/7cf91a98e607c2f935dbcc177d70011e95b8faff import os use_hugepage = os.environ.get("NUMPY_MADVISE_HUGEPAGE", None) if sys.platform == "linux" and use_hugepage is None: use_hugepage = 1 kernel_version = os.uname().release.split(".")[:2] kernel_version = tuple(int(v) for v in kernel_version) if kernel_version < (4, 6): use_hugepage = 0 elif use_hugepage is None: # This is not Linux, so it should not matter, just enable anyway use_hugepage = 1 else: use_hugepage = int(use_hugepage) # Note that this will currently only make a difference on Linux core.multiarray._set_madvise_hugepage(use_hugepage) ``` <!-- Remove these sections for a feature request --> ### Error message: <!-- If you are reporting a segfault please include a GDB traceback, which you can generate by following https://github.com/numpy/numpy/blob/master/doc/source/dev/development_environment.rst#debugging --> ``` # usr\local\lib\python3.8\site-packages\numpy\__init__.py #python3.8 test.py ['4', '19-ovh-xxxx-std-ipv6-64'] Traceback (most recent call last): File "test.py", line 4, in <module> kernel_version = tuple(int(v) for v in kernel_version) File "test.py", line 4, in <genexpr> kernel_version = tuple(int(v) for v in kernel_version) ValueError: invalid literal for int() with base 10: '19-ovh-xxxx-std-ipv6-64' ``` ### Numpy/Python version information: <!-- Output from 'import sys, numpy; print(numpy.__version__, sys.version)' --> To fix this error, here is the solution: ```python kernel_version = tuple(int(v[0:2]) for v in kernel_version) ``` The `int (v [0: 2] )` truncate the string to recover the INT correctly.
Hi, I'm having the same issue with the kernel shipped with OVH. I see you are making the pull request. Thanks ! Hmmm, my error, why didn't I use looseversion here? Oh, looking again (sorry missing things a bit more today), that is a strange version string, dropping the micro-release. But, it seems that `LooseVersion` does handle it correctly, so I think we can just use that here. Although I guess importing distutils may be slow, so maybe just add a `try:/except:` its not very important to begin with. I couldnt find the pull request, @nejib1 do you happen to be working on it. @anirudh2290 There isn't a PR, could you make one? There seem to be two fixes, one given in the report and @seberg use of `LooseVersion`.
2020-06-29T18:42:00Z
[]
[]
Traceback (most recent call last): File "test.py", line 4, in <module> kernel_version = tuple(int(v) for v in kernel_version) File "test.py", line 4, in <genexpr> kernel_version = tuple(int(v) for v in kernel_version) ValueError: invalid literal for int() with base 10: '19-ovh-xxxx-std-ipv6-64'
9,944
numpy/numpy
numpy__numpy-16714
9890e3787d138b492b3610c21f3f1f8b6d81c648
diff --git a/numpy/__init__.py b/numpy/__init__.py --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -293,11 +293,18 @@ def _mac_os_check(): import os use_hugepage = os.environ.get("NUMPY_MADVISE_HUGEPAGE", None) if sys.platform == "linux" and use_hugepage is None: - use_hugepage = 1 - kernel_version = os.uname().release.split(".")[:2] - kernel_version = tuple(int(v) for v in kernel_version) - if kernel_version < (4, 6): - use_hugepage = 0 + # If there is an issue with parsing the kernel version, + # set use_hugepages to 0. Usage of LooseVersion will handle + # the kernel version parsing better, but avoided since it + # will increase the import time. See: #16679 for related discussion. + try: + use_hugepage = 1 + kernel_version = os.uname().release.split(".")[:2] + kernel_version = tuple(int(v) for v in kernel_version) + if kernel_version < (4, 6): + use_hugepage = 0 + except ValueError: + use_hugepages = 0 elif use_hugepage is None: # This is not Linux, so it should not matter, just enable anyway use_hugepage = 1
BUG: non-numeric kernel_version on the OVH platform <!-- Please describe the issue in detail here, and fill in the fields below --> <!-- A short code example that reproduces the problem/missing feature. It should be self-contained, i.e., possible to run as-is via 'python myproblem.py' --> Hello, there is an error in the code of __ini__.py (Python3.8) , when detecting the version of the Kernel. I found the solution but I detail the problem here to help other users. ```python # We usually use madvise hugepages support, but on some old kernels it # is slow and thus better avoided. # Specifically kernel version 4.6 had a bug fix which probably fixed this: # https://github.com/torvalds/linux/commit/7cf91a98e607c2f935dbcc177d70011e95b8faff import os use_hugepage = os.environ.get("NUMPY_MADVISE_HUGEPAGE", None) if sys.platform == "linux" and use_hugepage is None: use_hugepage = 1 kernel_version = os.uname().release.split(".")[:2] kernel_version = tuple(int(v) for v in kernel_version) if kernel_version < (4, 6): use_hugepage = 0 elif use_hugepage is None: # This is not Linux, so it should not matter, just enable anyway use_hugepage = 1 else: use_hugepage = int(use_hugepage) # Note that this will currently only make a difference on Linux core.multiarray._set_madvise_hugepage(use_hugepage) ``` <!-- Remove these sections for a feature request --> ### Error message: <!-- If you are reporting a segfault please include a GDB traceback, which you can generate by following https://github.com/numpy/numpy/blob/master/doc/source/dev/development_environment.rst#debugging --> ``` # usr\local\lib\python3.8\site-packages\numpy\__init__.py #python3.8 test.py ['4', '19-ovh-xxxx-std-ipv6-64'] Traceback (most recent call last): File "test.py", line 4, in <module> kernel_version = tuple(int(v) for v in kernel_version) File "test.py", line 4, in <genexpr> kernel_version = tuple(int(v) for v in kernel_version) ValueError: invalid literal for int() with base 10: '19-ovh-xxxx-std-ipv6-64' ``` ### Numpy/Python version information: <!-- Output from 'import sys, numpy; print(numpy.__version__, sys.version)' --> To fix this error, here is the solution: ```python kernel_version = tuple(int(v[0:2]) for v in kernel_version) ``` The `int (v [0: 2] )` truncate the string to recover the INT correctly.
Hi, I'm having the same issue with the kernel shipped with OVH. I see you are making the pull request. Thanks ! Hmmm, my error, why didn't I use looseversion here? Oh, looking again (sorry missing things a bit more today), that is a strange version string, dropping the micro-release. But, it seems that `LooseVersion` does handle it correctly, so I think we can just use that here. Although I guess importing distutils may be slow, so maybe just add a `try:/except:` its not very important to begin with. I couldnt find the pull request, @nejib1 do you happen to be working on it. @anirudh2290 There isn't a PR, could you make one? There seem to be two fixes, one given in the report and @seberg use of `LooseVersion`.
2020-06-30T18:58:01Z
[]
[]
Traceback (most recent call last): File "test.py", line 4, in <module> kernel_version = tuple(int(v) for v in kernel_version) File "test.py", line 4, in <genexpr> kernel_version = tuple(int(v) for v in kernel_version) ValueError: invalid literal for int() with base 10: '19-ovh-xxxx-std-ipv6-64'
9,945
numpy/numpy
numpy__numpy-16730
4690248dd48e11e57167da20e54dc21a5d853bfa
diff --git a/numpy/distutils/fcompiler/pg.py b/numpy/distutils/fcompiler/pg.py --- a/numpy/distutils/fcompiler/pg.py +++ b/numpy/distutils/fcompiler/pg.py @@ -31,7 +31,7 @@ class PGroupFCompiler(FCompiler): 'compiler_f77': ["pgfortran"], 'compiler_fix': ["pgfortran", "-Mfixed"], 'compiler_f90': ["pgfortran"], - 'linker_so': ["pgfortran"], + 'linker_so': ["<F90>"], 'archiver': ["ar", "-cr"], 'ranlib': ["ranlib"] }
f2py undefined symbol with PGI fortran compiler and MPI calls <!-- Please describe the issue in detail here, and fill in the fields below --> I am trying to wrap fortran code with f2py. The fortran code includes some MPI calls and is compiled with the PGI compiler. When importing the wrapped module in python I get this error: `undefined symbol: mpi_comm_rank_` ### Reproducing code example: <!-- A short code example that reproduces the problem/missing feature. It should be self-contained, i.e., possible to run as-is via 'python myproblem.py' --> ``` 1 ! file: helloworld.f90 2 subroutine sayhello(comm) 3 use mpi 4 implicit none 5 integer :: comm, rank, size, ierr 6 call MPI_Comm_size(comm, size, ierr) 7 call MPI_Comm_rank(comm, rank, ierr) 8 print *, 'Hello, World! I am process ',rank,' of ',size,'.' 9 end subroutine sayhello ``` ### Compilation `CC=gcc f2py --verbose --f90exec=mpif90 --fcompiler=pg -c helloworld.f90 -m helloworld` ### Partial output ``` [...] <class 'numpy.distutils.fcompiler.pg.PGroupFCompiler'> version_cmd = ['***/pgi/linuxpower/19.9/bin/pgfortran', '-V'] compiler_f77 = ['***/pgi/linuxpower/19.9/bin/pgfortran', '-fpic', '-Minform=inform', '-Mnosecond_underscore', '-fast'] compiler_fix = ['***/spectrum_mpi/10.03.00.01rtm3-rh7_20190611/bin/mpif90', '-Mfixed', '-fpic', '-Minform=inform', '-Mnosecond_underscore', '-fast'] compiler_f90 = ['***/spectrum_mpi/10.03.00.01rtm3-rh7_20190611/bin/mpif90', '-fpic', '-Minform=inform', '-Mnosecond_underscore', '-fast'] linker_so = ['***/pgi/linuxpower/19.9/bin/pgfortran', '-shared', '-fpic'] archiver = None ranlib = None linker_exe = None version = LooseVersion ('19.9-0') libraries = [] library_dirs = [] object_switch = '-o ' compile_switch = '-c' include_dirs = ['***/python_venv/python_numpy_pgi_reproducer/include', '***/anaconda3/2019.03/include/python3.7m'] [...] ***/pgi/linuxpower/19.9/bin/pgfortran -shared -fpic /tmp/tmpfy731xy8/tmp/tmpfy731xy8/src.linux-ppc64le-3.7/helloworldmodule.o /tmp/tmpfy731xy8/tmp/tmpfy731xy8/src.linux-ppc64le-3.7/fortranobject.o /tmp/tmpfy731xy8/helloworld.o -o ./helloworld.cpython-37m-powerpc64le-linux-gnu.so Removing build directory /tmp/tmpfy731xy8 ``` The "linker_so" executable is chosen to be the pgfortran executable, whereas I would like to use the mpif90 executable instead. This leads to the following error when importing the wrapped module from python: ``` $ python -c "import helloworld" Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: ***/helloworld.cpython-37m-powerpc64le-linux-gnu.so: undefined symbol: mpi_comm_rank_ ``` ### System informations ``` $ mpif90 --version pgf90 19.9-0 linuxpower target on Linuxpower ``` ``` $ python --version Python 3.7.3 ``` ``` $ python -c "import sys, numpy; print(numpy.__version__, sys.version)" 1.18.4 3.7.3 (default, Mar 27 2019, 22:31:02) [GCC 7.3.0] ``` ### Workarround This solves the problem in my case: In file numpy/distutils/fcompiler/pg.py - line 36 (numpy installed version) ``` -'linker_so': ["pgfortran"], +'linker_so': ["<F90>"], ``` The executable supplied with the `--f90exec` option is then the one picked to be the linker executable and the ImportError does not occur.
2020-07-02T13:05:27Z
[]
[]
Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: ***/helloworld.cpython-37m-powerpc64le-linux-gnu.so: undefined symbol: mpi_comm_rank_
9,946
numpy/numpy
numpy__numpy-16789
86fcce61c9cddbc354ba67b2f818670f5822c688
diff --git a/numpy/distutils/ccompiler_opt.py b/numpy/distutils/ccompiler_opt.py --- a/numpy/distutils/ccompiler_opt.py +++ b/numpy/distutils/ccompiler_opt.py @@ -673,7 +673,7 @@ def _dist_test_spawn_paths(self, cmd, display=None): # intel and msvc compilers don't raise # fatal errors when flags are wrong or unsupported ".*(" - "ignoring unknown option|" # msvc + "warning D9002|" # msvc, it should be work with any language. "invalid argument for option" # intel ").*" ) @@ -681,9 +681,8 @@ def _dist_test_spawn_paths(self, cmd, display=None): def _dist_test_spawn(cmd, display=None): from distutils.errors import CompileError try: - o = subprocess.check_output(cmd, stderr=subprocess.STDOUT) - if isinstance(o, bytes): - o = o.decode() + o = subprocess.check_output(cmd, stderr=subprocess.STDOUT, + universal_newlines=True) if o and re.match(_Distutils._dist_warn_regex, o): _Distutils.dist_error( "Flags in command", cmd ,"aren't supported by the compiler" @@ -697,7 +696,6 @@ def _dist_test_spawn(cmd, display=None): s = 127 else: return None - o = o.decode() _Distutils.dist_error( "Command", cmd, "failed with exit status %d output -> \n%s" % ( s, o
Build Failure on Windows, Python 3.6 GCC Compilers: UnicodeDecodeError. updating to the latest master , an `UnicodeDecodeError `occurred even after execute `git clean -xfd` ### Reproducing code example: No code example. ### Error message: ``` CCompilerOpt.cc_test_flags[989] : testing flags (/WX) CCompilerOpt.__init__[1137] : feature 'AVX512_KNL' is disabled, MSVC compiler doesn't support it CCompilerOpt.__init__[1137] : feature 'AVX512_KNM' is disabled, MSVC compiler doesn't support it CCompilerOpt.__init__[1621] : check requested baseline CCompilerOpt.cc_test_flags[989] : testing flags (/arch:SSE) Traceback (most recent call last): File "setup.py", line 499, in <module> setup_package() File "setup.py", line 491, in setup_package setup(**metadata) File "D:\Source\numpy\numpy\distutils\core.py", line 169, in setup return old_setup(**new_attr) File "C:\Python36\lib\site-packages\setuptools\__init__.py", line 143, in setup return distutils.core.setup(**attrs) File "C:\Python36\lib\distutils\core.py", line 148, in setup dist.run_commands() File "C:\Python36\lib\distutils\dist.py", line 955, in run_commands self.run_command(cmd) File "C:\Python36\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "D:\Source\numpy\numpy\distutils\command\build_ext.py", line 111, in run build_clib.run() File "D:\Source\numpy\numpy\distutils\command\build_clib.py", line 126, in run cpu_dispatch=self.cpu_dispatch, cache_path=opt_cache_path File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 2451, in new_ccompiler_opt opt = CCompilerOpt(compiler, **kwargs) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 2055, in __init__ _Parse.__init__(self, cpu_baseline, cpu_dispatch) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 1624, in __init__ baseline_names = self.feature_names(cpu_baseline) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 1182, in feature_names if self.feature_is_supported(f, force_flags=force_flags): File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 829, in cache_wrap_me ccb = cb(self, *args, **kwargs) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 1471, in feature_is_supported if not self.feature_test(impl, force_flags): File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 829, in cache_wrap_me ccb = cb(self, *args, **kwargs) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 1432, in feature_test force_flags = self.feature_flags(name) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 829, in cache_wrap_me ccb = cb(self, *args, **kwargs) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 1411, in feature_flags if not f or not self.cc_test_flags(f): File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 829, in cache_wrap_me ccb = cb(self, *args, **kwargs) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 991, in cc_test_flags test = self.dist_test(test_path, flags) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 556, in dist_test [source], flags, output_dir=self.conf_tmp_path File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 536, in dist_compile sources, extra_postargs=flags, **kwargs File "C:\Python36\lib\distutils\_msvccompiler.py", line 423, in compile self.spawn(args) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 668, in _dist_test_spawn_paths self._dist_test_spawn(cmd) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 686, in _dist_test_spawn o = o.decode() UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 4: invalid continuation byte CCompilerOpt._cache_write[786] : write cache to path -> D:\Source\numpy\build\temp.win-amd64-3.6\ccompiler_opt_cache_clib.py ```
Do you have non-ascii characters in your path? Could you stop at the error and try to work out what is going on? does `o` have an encoding property `o.encoding` ? I'm sure that no non-ascii characters existed, It's seems like the exception is triggered when testing SSE flags: ``` CCompilerOpt.cc_test_flags[991] : testing flags (/arch:SSE) decode:b'cl: \xc3\xfc\xc1\xee\xd0\xd0 warning D9002 :\xba\xf6\xc2\xd4\xce\xb4\xd6\xaa\xd1\xa1\xcf\xee\xa1\xb0/arch:SSE\xa1\xb1\r\ntest_flags.c\r\n' ``` o.decode() failed to decode ``` b'cl: \xc3\xfc\xc1\xee\xd0\xd0 warning D9002 :\xba\xf6\xc2\xd4\xce\xb4\xd6\xaa\xd1\xa1\xcf\xee\xa1\xb0/arch:SSE\xa1\xb1\r\ntest_flags.c\r\n' ``` @Qiyu8, your compiler output is encoded in [`GB2312`](https://en.wikipedia.org/wiki/GB_2312) rather than utf8 it seems. The string decodes to ``` cl: 命令行 warning D9002 :忽略未知选项“/arch:SSE” test_flags.c ``` https://bugs.python.org/issue27179#msg267091 seems slightly related, I haven't read the whole thread. Maybe a parallel problem, I always build numpy with `python setup.py build_ext -i -j 8`, turned to `python setup.py build_ext -i` and the build successfully. My guess would be that the codepage of the parallel processes does not match the codepage of the parent process. This problem arose again in my local machine, even with non-parallel build. There was a [long discussion](https://discuss.python.org/t/pep-597-use-utf-8-for-default-text-file-encoding/1819) and a PEP 597 about changing the default stdout encoding. Bottom line: what does `locale.getpreferredencoding()` show for you? If you modify the offending line ``` File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 686, in _dist_test_spawn o = o.decode() ``` to use that encoding does it fix the problem? my encoding result is `cp936`, The build can succeed after modifed to `o.decode(encoding="cp936")`, But there are large amount of `warning D9002 :忽略未知选项“/arch:SSE” ` produced during build. @mattip I want to provide a PR to solve this issue, modify `decode()` to `decode(locale.getpreferredencoding())`, what do you think? > modify `decode()` to `decode(locale.getpreferredencoding())` I think the preferred spelling of this is when calling `check_output` to specify `universal_newlines=True` which will force the output to be text (already encoded). Search for "unversal_newlines" on the [subprocess doc page](https://docs.python.org/3.6/library/subprocess.html#frequently-used-arguments). Could you try it (since we don't really test for non-ascii windows versions)? As for the multiple warnings, can you show the part of the log that looks like the one in [this comment](https://github.com/numpy/numpy/pull/13516#issuecomment-655579534) ? The build can succeed after specify `universal_newlines=True`, see the build log of multiple warnings: ``` cl: 命令行 warning D9002 :忽略未知选项“/arch:SSE2” C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DHAVE_BLAS_ILP64 -DBLAS_SYMBOL_SUFFIX=64_ -Inumpy\core\include -Inumpy\core\include/numpy -Inumpy\core\src\common -Inumpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\npysort -IC:\Python36\include -IC:\Python36\include -Inumpy\core\src\common -Inumpy\core\src\npymath -IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt /Tcnumpy\linalg\lapack_lite\f2c_s_lapack.c /Fobuild\temp.win-amd64-3.6\Release\numpy\linalg\lapack_lite\f2c_s_lapack.obj /arch:SSE2 cl: 命令行 warning D9002 :忽略未知选项“/arch:SSE2” C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DHAVE_BLAS_ILP64 -DBLAS_SYMBOL_SUFFIX=64_ -Inumpy\core\include -Inumpy\core\include/numpy -Inumpy\core\src\common -Inumpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\npysort -IC:\Python36\include -IC:\Python36\include -Inumpy\core\src\common -Inumpy\core\src\npymath -IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt /Tcnumpy\linalg\lapack_lite\f2c_lapack.c /Fobuild\temp.win-amd64-3.6\Release\numpy\linalg\lapack_lite\f2c_lapack.obj /arch:SSE2 cl: 命令行 warning D9002 :忽略未知选项“/arch:SSE2” C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DHAVE_BLAS_ILP64 -DBLAS_SYMBOL_SUFFIX=64_ -Inumpy\core\include -Inumpy\core\include/numpy -Inumpy\core\src\common -Inumpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\npysort -IC:\Python36\include -IC:\Python36\include -Inumpy\core\src\common -Inumpy\core\src\npymath -IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt /Tcnumpy\linalg\lapack_lite\f2c_blas.c /Fobuild\temp.win-amd64-3.6\Release\numpy\linalg\lapack_lite\f2c_blas.obj /arch:SSE2 cl: 命令行 warning D9002 :忽略未知选项“/arch:SSE2” C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DHAVE_BLAS_ILP64 -DBLAS_SYMBOL_SUFFIX=64_ -Inumpy\core\include -Inumpy\core\include/numpy -Inumpy\core\src\common -Inumpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\npysort -IC:\Python36\include -IC:\Python36\include -Inumpy\core\src\common -Inumpy\core\src\npymath -IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt /Tcnumpy\linalg\lapack_lite\f2c_config.c /Fobuild\temp.win-amd64-3.6\Release\numpy\linalg\lapack_lite\f2c_config.obj /arch:SSE2 cl: 命令行 warning D9002 :忽略未知选项“/arch:SSE2” C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DHAVE_BLAS_ILP64 -DBLAS_SYMBOL_SUFFIX=64_ -Inumpy\core\include -Inumpy\core\include/numpy -Inumpy\core\src\common -Inumpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\npysort -IC:\Python36\include -IC:\Python36\include -Inumpy\core\src\common -Inumpy\core\src\npymath -IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt /Tcnumpy\linalg\lapack_lite\f2c.c /Fobuild\temp.win-amd64-3.6\Release\numpy\linalg\lapack_lite\f2c.obj /arch:SSE2 cl: 命令行 warning D9002 :忽略未知选项“/arch:SSE2” C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Python36\libs /LIBPATH:C:\Python36\PCbuild\amd64 /LIBPATH:build\temp.win-amd64-3.6 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\lib\x64 /LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\lib\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\ucrt\x64 /LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64 npymath.lib /EXPORT:PyInit__umath_linalg build\temp.win-amd64-3.6\Release\numpy\linalg\umath_linalg.obj build\temp.win-amd64-3.6\Release\numpy\linalg\lapack_lite\python_xerbla.obj build\temp.win-amd64-3.6\Release\numpy\linalg\lapack_lite\f2c_z_lapack.obj build\temp.win-amd64-3.6\Release\numpy\linalg\lapack_lite\f2c_c_lapack.obj build\temp.win-amd64-3.6\Release\numpy\linalg\lapack_lite\f2c_d_lapack.obj build\temp.win-amd64-3.6\Release\numpy\linalg\lapack_lite\f2c_s_lapack.obj build\temp.win-amd64-3.6\Release\numpy\linalg\lapack_lite\f2c_lapack.obj build\temp.win-amd64-3.6\Release\numpy\linalg\lapack_lite\f2c_blas.obj build\temp.win-amd64-3.6\Release\numpy\linalg\lapack_lite\f2c_config.obj build\temp.win-amd64-3.6\Release\numpy\linalg\lapack_lite\f2c.obj /OUT:numpy\linalg\_umath_linalg.cp36-win_amd64.pyd /IMPLIB:build\temp.win-amd64-3.6\Release\numpy\linalg\_umath_linalg.cp36-win_amd64.lib ``` Good to hear: so the correct fix for this issue is `universal_newlines=True` As for the warnings: on 64-bit windows, you should not be using `/arch:SSE2`, since it is on by default. This is a separate issue, @seiko2plus might be able to help. Note that `universal_newlines=True` is equivalent to decoding with `locale.getpreferredencoding(False)` according to https://docs.python.org/3/library/io.html#io.TextIOWrapper. I still suspect there's a nastier issue here regarding the locale in which parallel vs non-parallel builds are executed in. > @mattip, This is a separate issue yes, my bad. I didn't expect msvc to raise warning messages in another language than English. @Qiyu8, well to solve this issue you have to replace: https://github.com/numpy/numpy/blob/86fcce61c9cddbc354ba67b2f818670f5822c688/numpy/distutils/ccompiler_opt.py#L676 with: ```Python "warning D9002|" # msvc, it should be work with any language. ``` And why? Because microsoft and Intel compiler tending to raise warning messages rather than fatal errros for unkown or unsupported options.
2020-07-09T12:20:02Z
[]
[]
Traceback (most recent call last): File "setup.py", line 499, in <module> setup_package() File "setup.py", line 491, in setup_package setup(**metadata) File "D:\Source\numpy\numpy\distutils\core.py", line 169, in setup return old_setup(**new_attr) File "C:\Python36\lib\site-packages\setuptools\__init__.py", line 143, in setup return distutils.core.setup(**attrs) File "C:\Python36\lib\distutils\core.py", line 148, in setup dist.run_commands() File "C:\Python36\lib\distutils\dist.py", line 955, in run_commands self.run_command(cmd) File "C:\Python36\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "D:\Source\numpy\numpy\distutils\command\build_ext.py", line 111, in run build_clib.run() File "D:\Source\numpy\numpy\distutils\command\build_clib.py", line 126, in run cpu_dispatch=self.cpu_dispatch, cache_path=opt_cache_path File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 2451, in new_ccompiler_opt opt = CCompilerOpt(compiler, **kwargs) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 2055, in __init__ _Parse.__init__(self, cpu_baseline, cpu_dispatch) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 1624, in __init__ baseline_names = self.feature_names(cpu_baseline) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 1182, in feature_names if self.feature_is_supported(f, force_flags=force_flags): File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 829, in cache_wrap_me ccb = cb(self, *args, **kwargs) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 1471, in feature_is_supported if not self.feature_test(impl, force_flags): File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 829, in cache_wrap_me ccb = cb(self, *args, **kwargs) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 1432, in feature_test force_flags = self.feature_flags(name) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 829, in cache_wrap_me ccb = cb(self, *args, **kwargs) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 1411, in feature_flags if not f or not self.cc_test_flags(f): File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 829, in cache_wrap_me ccb = cb(self, *args, **kwargs) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 991, in cc_test_flags test = self.dist_test(test_path, flags) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 556, in dist_test [source], flags, output_dir=self.conf_tmp_path File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 536, in dist_compile sources, extra_postargs=flags, **kwargs File "C:\Python36\lib\distutils\_msvccompiler.py", line 423, in compile self.spawn(args) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 668, in _dist_test_spawn_paths self._dist_test_spawn(cmd) File "D:\Source\numpy\numpy\distutils\ccompiler_opt.py", line 686, in _dist_test_spawn o = o.decode() UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 4: invalid continuation byte
9,947
numpy/numpy
numpy__numpy-17344
f981a7ff4b02204f215eb089ce77f9a3f3906b1e
diff --git a/numpy/distutils/fcompiler/__init__.py b/numpy/distutils/fcompiler/__init__.py --- a/numpy/distutils/fcompiler/__init__.py +++ b/numpy/distutils/fcompiler/__init__.py @@ -745,7 +745,7 @@ def wrap_unlinkable_objects(self, objects, output_dir, extra_dll_dir): ('win32', ('gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang')), ('cygwin.*', ('gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95')), - ('linux.*', ('gnu95', 'intel', 'lahey', 'pg', 'absoft', 'nag', 'vast', 'compaq', + ('linux.*', ('gnu95', 'intel', 'lahey', 'pg', 'nv', 'absoft', 'nag', 'vast', 'compaq', 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor')), ('darwin.*', ('gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg')), ('sunos.*', ('sun', 'gnu', 'gnu95', 'g95')), diff --git a/numpy/distutils/fcompiler/nv.py b/numpy/distutils/fcompiler/nv.py new file mode 100644 --- /dev/null +++ b/numpy/distutils/fcompiler/nv.py @@ -0,0 +1,55 @@ +import sys + +from numpy.distutils.fcompiler import FCompiler + +compilers = ['NVHPCFCompiler'] + +class NVHPCFCompiler(FCompiler): + """ NVIDIA High Performance Computing (HPC) SDK Fortran Compiler + + https://developer.nvidia.com/hpc-sdk + + Since august 2020 the NVIDIA HPC SDK includes the compilers formerly known as The Portland Group compilers, + https://www.pgroup.com/index.htm. + See also `numpy.distutils.fcompiler.pg`. + """ + + compiler_type = 'nv' + description = 'NVIDIA HPC SDK' + version_pattern = r'\s*(nvfortran|(pg(f77|f90|fortran)) \(aka nvfortran\)) (?P<version>[\d.-]+).*' + + executables = { + 'version_cmd': ["<F90>", "-V"], + 'compiler_f77': ["nvfortran"], + 'compiler_fix': ["nvfortran", "-Mfixed"], + 'compiler_f90': ["nvfortran"], + 'linker_so': ["<F90>"], + 'archiver': ["ar", "-cr"], + 'ranlib': ["ranlib"] + } + pic_flags = ['-fpic'] + + module_dir_switch = '-module ' + module_include_switch = '-I' + + def get_flags(self): + opt = ['-Minform=inform', '-Mnosecond_underscore'] + return self.pic_flags + opt + + def get_flags_opt(self): + return ['-fast'] + + def get_flags_debug(self): + return ['-g'] + + def get_flags_linker_so(self): + return ["-shared", '-fpic'] + + def runtime_library_dir_option(self, dir): + return '-R%s' % dir + +if __name__ == '__main__': + from distutils import log + log.set_verbosity(2) + from numpy.distutils import customized_fcompiler + print(customized_fcompiler(compiler='nv').get_version())
Support for the NVIDIA HPC SDK fortran compiler <!-- Please describe the issue in detail here, and fill in the fields below --> PGI Compilers & Tools are now packaged in the NVIDIA HPC SDK (https://www.pgroup.com/index.htm). This implies a few changes for the detection of the fortran compiler. Our particular use case uses f2py to wrap fortran code. **nv**fortran is the executable for compiling fortran code, **pg**fortran is still available as an alias for nvfortran. The compiler detection process parses the output of the `--version` flag. Here are the outputs of the `--version` flag for pgfortran 20.04 (previous packaging), pgfortran 20.07 (new packaing alias) and nvfortran 20.07 (new packagin): ```shell $ pgfortran --version pgfortran 20.4-0 linuxpower target on Linuxpower PGI Compilers and Tools Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. ``` ```shell $ pgfortran --version pgfortran (aka nvfortran) 20.7-0 linuxpower target on Linuxpower PGI Compilers and Tools Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. ``` ```shell $ nvfortran --version nvfortran 20.7-0 linuxpower target on Linuxpower NVIDIA Compilers and Tools Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. ``` Notice : - the `(aka nvfortran)` part (2nd output) breaks the version detection if the pgfortran executable is used. - **nv**fortran (3rd output) is not matched during version detection if the nvfortran executable is used. <!-- Remove these sections for a feature request --> ### Reproducing code example: ```fortran ! file: helloworld.f90 module m_hello_world contains subroutine sayhello() implicit none print *, 'Hello, World!' end subroutine sayhello end module m_hello_world ``` ### Compiled with: In this exemple the nvfortran executable is used ```shell $ F77=nvfortran F90=nvfortran CC=gcc CPATH= f2py --verbose -c --fcompiler=pg helloworld.f90 -m helloworld ``` <!-- A short code example that reproduces the problem/missing feature. It should be self-contained, i.e., possible to run as-is via 'python myproblem.py' --> ### Error message: This is the error message with the nvfortran executable. ``` customize PGroupFCompiler find_executable('nvfortran') Found executable ***/nvhpc/20.07/Linux_ppc64le/20.7/compilers/bin/nvfortran Traceback (most recent call last): File "***/python_venv/reproducer_venv/bin/f2py", line 11, in <module> load_entry_point('numpy==1.19.2', 'console_scripts', 'f2py')() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/f2py/f2py2e.py", line 692, in main run_compile() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/f2py/f2py2e.py", line 659, in run_compile setup(ext_modules=[ext]) File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/core.py", line 169, in setup return old_setup(**new_attr) File "***/anaconda3/2019.03/lib/python3.7/distutils/core.py", line 148, in setup dist.run_commands() File "***/anaconda3/2019.03/lib/python3.7/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "***/anaconda3/2019.03/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/command/build.py", line 40, in run old_build.run(self) File "***/anaconda3/2019.03/lib/python3.7/distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "***/anaconda3/2019.03/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "***/anaconda3/2019.03/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/command/build_ext.py", line 238, in run if fcompiler and fcompiler.get_version(): File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/fcompiler/__init__.py", line 428, in get_version raise CompilerNotFound() numpy.distutils.fcompiler.CompilerNotFound ``` With the pgfortran executable the Traceback is identical. ### Workarround This modification allows to match "**nv**fortran" in the output of the `--version` flag. ```diff diff --git a/numpy/distutils/fcompiler/pg.py b/numpy/distutils/fcompiler/pg.py index 72442c4fe..306f7ef34 100644 --- a/numpy/distutils/fcompiler/pg.py +++ b/numpy/distutils/fcompiler/pg.py @@ -12,7 +12,7 @@ class PGroupFCompiler(FCompiler): compiler_type = 'pg' description = 'Portland Group Fortran Compiler' - version_pattern = r'\s*pg(f77|f90|hpf|fortran) (?P<version>[\d.-]+).*' + version_pattern = r'\s*(pg|nv)(f77|f90|hpf|fortran) (?P<version>[\d.-]+).*' if platform == 'darwin': executables = { ``` Handling the `(aka nvfortran)` part for the pgfortran executable seems trickier. <!-- If you are reporting a segfault please include a GDB traceback, which you can generate by following https://github.com/numpy/numpy/blob/master/doc/source/dev/development_environment.rst#debugging --> <!-- Full error message, if any (starting from line Traceback: ...) --> ### Numpy/Python version information: ```shell $ python --version Python 3.7.3 ``` ```shell $ pip show numpy Name: numpy Version: 1.19.2 Summary: NumPy is the fundamental package for array computing with Python. Home-page: https://www.numpy.org Author: Travis E. Oliphant et al. Author-email: None License: BSD Location: ***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg Requires: Required-by: f90wrap ``` <!-- Output from 'import sys, numpy; print(numpy.__version__, sys.version)' -->
Could you make a PR with this modification?
2020-09-17T15:50:03Z
[]
[]
Traceback (most recent call last): File "***/python_venv/reproducer_venv/bin/f2py", line 11, in <module> load_entry_point('numpy==1.19.2', 'console_scripts', 'f2py')() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/f2py/f2py2e.py", line 692, in main run_compile() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/f2py/f2py2e.py", line 659, in run_compile setup(ext_modules=[ext]) File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/core.py", line 169, in setup return old_setup(**new_attr) File "***/anaconda3/2019.03/lib/python3.7/distutils/core.py", line 148, in setup dist.run_commands() File "***/anaconda3/2019.03/lib/python3.7/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "***/anaconda3/2019.03/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/command/build.py", line 40, in run old_build.run(self) File "***/anaconda3/2019.03/lib/python3.7/distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "***/anaconda3/2019.03/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "***/anaconda3/2019.03/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/command/build_ext.py", line 238, in run if fcompiler and fcompiler.get_version(): File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/fcompiler/__init__.py", line 428, in get_version raise CompilerNotFound() numpy.distutils.fcompiler.CompilerNotFound
9,965
numpy/numpy
numpy__numpy-17522
629bcf46c8a06467209d67a55fa7a1d0200b3373
diff --git a/numpy/distutils/fcompiler/__init__.py b/numpy/distutils/fcompiler/__init__.py --- a/numpy/distutils/fcompiler/__init__.py +++ b/numpy/distutils/fcompiler/__init__.py @@ -745,7 +745,7 @@ def wrap_unlinkable_objects(self, objects, output_dir, extra_dll_dir): ('win32', ('gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang')), ('cygwin.*', ('gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95')), - ('linux.*', ('gnu95', 'intel', 'lahey', 'pg', 'absoft', 'nag', 'vast', 'compaq', + ('linux.*', ('gnu95', 'intel', 'lahey', 'pg', 'nv', 'absoft', 'nag', 'vast', 'compaq', 'intele', 'intelem', 'gnu', 'g95', 'pathf95', 'nagfor')), ('darwin.*', ('gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg')), ('sunos.*', ('sun', 'gnu', 'gnu95', 'g95')), diff --git a/numpy/distutils/fcompiler/nv.py b/numpy/distutils/fcompiler/nv.py new file mode 100644 --- /dev/null +++ b/numpy/distutils/fcompiler/nv.py @@ -0,0 +1,55 @@ +import sys + +from numpy.distutils.fcompiler import FCompiler + +compilers = ['NVHPCFCompiler'] + +class NVHPCFCompiler(FCompiler): + """ NVIDIA High Performance Computing (HPC) SDK Fortran Compiler + + https://developer.nvidia.com/hpc-sdk + + Since august 2020 the NVIDIA HPC SDK includes the compilers formerly known as The Portland Group compilers, + https://www.pgroup.com/index.htm. + See also `numpy.distutils.fcompiler.pg`. + """ + + compiler_type = 'nv' + description = 'NVIDIA HPC SDK' + version_pattern = r'\s*(nvfortran|(pg(f77|f90|fortran)) \(aka nvfortran\)) (?P<version>[\d.-]+).*' + + executables = { + 'version_cmd': ["<F90>", "-V"], + 'compiler_f77': ["nvfortran"], + 'compiler_fix': ["nvfortran", "-Mfixed"], + 'compiler_f90': ["nvfortran"], + 'linker_so': ["<F90>"], + 'archiver': ["ar", "-cr"], + 'ranlib': ["ranlib"] + } + pic_flags = ['-fpic'] + + module_dir_switch = '-module ' + module_include_switch = '-I' + + def get_flags(self): + opt = ['-Minform=inform', '-Mnosecond_underscore'] + return self.pic_flags + opt + + def get_flags_opt(self): + return ['-fast'] + + def get_flags_debug(self): + return ['-g'] + + def get_flags_linker_so(self): + return ["-shared", '-fpic'] + + def runtime_library_dir_option(self, dir): + return '-R%s' % dir + +if __name__ == '__main__': + from distutils import log + log.set_verbosity(2) + from numpy.distutils import customized_fcompiler + print(customized_fcompiler(compiler='nv').get_version())
Support for the NVIDIA HPC SDK fortran compiler <!-- Please describe the issue in detail here, and fill in the fields below --> PGI Compilers & Tools are now packaged in the NVIDIA HPC SDK (https://www.pgroup.com/index.htm). This implies a few changes for the detection of the fortran compiler. Our particular use case uses f2py to wrap fortran code. **nv**fortran is the executable for compiling fortran code, **pg**fortran is still available as an alias for nvfortran. The compiler detection process parses the output of the `--version` flag. Here are the outputs of the `--version` flag for pgfortran 20.04 (previous packaging), pgfortran 20.07 (new packaing alias) and nvfortran 20.07 (new packagin): ```shell $ pgfortran --version pgfortran 20.4-0 linuxpower target on Linuxpower PGI Compilers and Tools Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. ``` ```shell $ pgfortran --version pgfortran (aka nvfortran) 20.7-0 linuxpower target on Linuxpower PGI Compilers and Tools Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. ``` ```shell $ nvfortran --version nvfortran 20.7-0 linuxpower target on Linuxpower NVIDIA Compilers and Tools Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. ``` Notice : - the `(aka nvfortran)` part (2nd output) breaks the version detection if the pgfortran executable is used. - **nv**fortran (3rd output) is not matched during version detection if the nvfortran executable is used. <!-- Remove these sections for a feature request --> ### Reproducing code example: ```fortran ! file: helloworld.f90 module m_hello_world contains subroutine sayhello() implicit none print *, 'Hello, World!' end subroutine sayhello end module m_hello_world ``` ### Compiled with: In this exemple the nvfortran executable is used ```shell $ F77=nvfortran F90=nvfortran CC=gcc CPATH= f2py --verbose -c --fcompiler=pg helloworld.f90 -m helloworld ``` <!-- A short code example that reproduces the problem/missing feature. It should be self-contained, i.e., possible to run as-is via 'python myproblem.py' --> ### Error message: This is the error message with the nvfortran executable. ``` customize PGroupFCompiler find_executable('nvfortran') Found executable ***/nvhpc/20.07/Linux_ppc64le/20.7/compilers/bin/nvfortran Traceback (most recent call last): File "***/python_venv/reproducer_venv/bin/f2py", line 11, in <module> load_entry_point('numpy==1.19.2', 'console_scripts', 'f2py')() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/f2py/f2py2e.py", line 692, in main run_compile() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/f2py/f2py2e.py", line 659, in run_compile setup(ext_modules=[ext]) File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/core.py", line 169, in setup return old_setup(**new_attr) File "***/anaconda3/2019.03/lib/python3.7/distutils/core.py", line 148, in setup dist.run_commands() File "***/anaconda3/2019.03/lib/python3.7/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "***/anaconda3/2019.03/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/command/build.py", line 40, in run old_build.run(self) File "***/anaconda3/2019.03/lib/python3.7/distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "***/anaconda3/2019.03/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "***/anaconda3/2019.03/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/command/build_ext.py", line 238, in run if fcompiler and fcompiler.get_version(): File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/fcompiler/__init__.py", line 428, in get_version raise CompilerNotFound() numpy.distutils.fcompiler.CompilerNotFound ``` With the pgfortran executable the Traceback is identical. ### Workarround This modification allows to match "**nv**fortran" in the output of the `--version` flag. ```diff diff --git a/numpy/distutils/fcompiler/pg.py b/numpy/distutils/fcompiler/pg.py index 72442c4fe..306f7ef34 100644 --- a/numpy/distutils/fcompiler/pg.py +++ b/numpy/distutils/fcompiler/pg.py @@ -12,7 +12,7 @@ class PGroupFCompiler(FCompiler): compiler_type = 'pg' description = 'Portland Group Fortran Compiler' - version_pattern = r'\s*pg(f77|f90|hpf|fortran) (?P<version>[\d.-]+).*' + version_pattern = r'\s*(pg|nv)(f77|f90|hpf|fortran) (?P<version>[\d.-]+).*' if platform == 'darwin': executables = { ``` Handling the `(aka nvfortran)` part for the pgfortran executable seems trickier. <!-- If you are reporting a segfault please include a GDB traceback, which you can generate by following https://github.com/numpy/numpy/blob/master/doc/source/dev/development_environment.rst#debugging --> <!-- Full error message, if any (starting from line Traceback: ...) --> ### Numpy/Python version information: ```shell $ python --version Python 3.7.3 ``` ```shell $ pip show numpy Name: numpy Version: 1.19.2 Summary: NumPy is the fundamental package for array computing with Python. Home-page: https://www.numpy.org Author: Travis E. Oliphant et al. Author-email: None License: BSD Location: ***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg Requires: Required-by: f90wrap ``` <!-- Output from 'import sys, numpy; print(numpy.__version__, sys.version)' -->
Could you make a PR with this modification?
2020-10-09T19:13:07Z
[]
[]
Traceback (most recent call last): File "***/python_venv/reproducer_venv/bin/f2py", line 11, in <module> load_entry_point('numpy==1.19.2', 'console_scripts', 'f2py')() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/f2py/f2py2e.py", line 692, in main run_compile() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/f2py/f2py2e.py", line 659, in run_compile setup(ext_modules=[ext]) File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/core.py", line 169, in setup return old_setup(**new_attr) File "***/anaconda3/2019.03/lib/python3.7/distutils/core.py", line 148, in setup dist.run_commands() File "***/anaconda3/2019.03/lib/python3.7/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "***/anaconda3/2019.03/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/command/build.py", line 40, in run old_build.run(self) File "***/anaconda3/2019.03/lib/python3.7/distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "***/anaconda3/2019.03/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "***/anaconda3/2019.03/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/command/build_ext.py", line 238, in run if fcompiler and fcompiler.get_version(): File "***/python_venv/reproducer_venv/lib/python3.7/site-packages/numpy-1.19.2-py3.7-linux-ppc64le.egg/numpy/distutils/fcompiler/__init__.py", line 428, in get_version raise CompilerNotFound() numpy.distutils.fcompiler.CompilerNotFound
9,971
numpy/numpy
numpy__numpy-18293
ac7676930a8ea25502c2856fa364c0cef0913ae3
diff --git a/numpy/__init__.py b/numpy/__init__.py --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -212,8 +212,8 @@ extended_msg=_int_extended_msg.format("long"))) __deprecated_attrs__["unicode"] = ( - getattr(compat, "long"), - _msg.format(n="unciode", n2="str", + getattr(compat, "unicode"), + _msg.format(n="unicode", n2="str", extended_msg=_specific_msg.format("str_"))) del _msg, _specific_msg, _int_extended_msg, _type_info, _builtins
np.unicode aliased to np.compat.long It appears a bug was introduced in numpy when deprecating type aliases in #18230. The bug caused `np.unicode` to be aliased to `np.compat.long` which is an alias for `int`. This was quick to track down because of a typo in the deprecation message (unciode). https://github.com/numpy/numpy/blob/v1.20.0/numpy/__init__.py#L209-L212 ### Reproducing code example: ```python import numpy as np np.unicode("hello") ``` ### Error message: ``` <stdin>:1: DeprecationWarning: `np.unciode` is a deprecated alias for `np.compat.unciode`. To silence this warning, use `np.compat.unciode` by itself. In the likely event your code does not need to work on Python 2 you can use the builtin `str` for which `np.compat.unciode` is itself an alias. Doing this will not modify any behaviour and is safe. If you specifically wanted the numpy scalar type, use `np.str_` here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for int() with base 10: 'hello' ``` ### NumPy/Python version information: ``` >>> import sys, numpy; print(numpy.__version__, sys.version) 1.20.0 3.8.2 (default, Nov 4 2020, 21:23:28) [Clang 12.0.0 (clang-1200.0.32.28)] ```
I'm afraid this one is on you @seberg, it didn't exist before #18230
2021-02-02T00:34:32Z
[]
[]
Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for int() with base 10: 'hello'
9,992
numpy/numpy
numpy__numpy-18310
70a6b83ead80d3de8d2e992ca34e128f5997746a
diff --git a/numpy/__init__.py b/numpy/__init__.py --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -207,8 +207,8 @@ extended_msg=_int_extended_msg.format("long"))) __deprecated_attrs__["unicode"] = ( - getattr(compat, "long"), - _msg.format(n="unciode", n2="str", + getattr(compat, "unicode"), + _msg.format(n="unicode", n2="str", extended_msg=_specific_msg.format("str_"))) del _msg, _specific_msg, _int_extended_msg, _type_info, _builtins
np.unicode aliased to np.compat.long It appears a bug was introduced in numpy when deprecating type aliases in #18230. The bug caused `np.unicode` to be aliased to `np.compat.long` which is an alias for `int`. This was quick to track down because of a typo in the deprecation message (unciode). https://github.com/numpy/numpy/blob/v1.20.0/numpy/__init__.py#L209-L212 ### Reproducing code example: ```python import numpy as np np.unicode("hello") ``` ### Error message: ``` <stdin>:1: DeprecationWarning: `np.unciode` is a deprecated alias for `np.compat.unciode`. To silence this warning, use `np.compat.unciode` by itself. In the likely event your code does not need to work on Python 2 you can use the builtin `str` for which `np.compat.unciode` is itself an alias. Doing this will not modify any behaviour and is safe. If you specifically wanted the numpy scalar type, use `np.str_` here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for int() with base 10: 'hello' ``` ### NumPy/Python version information: ``` >>> import sys, numpy; print(numpy.__version__, sys.version) 1.20.0 3.8.2 (default, Nov 4 2020, 21:23:28) [Clang 12.0.0 (clang-1200.0.32.28)] ```
I'm afraid this one is on you @seberg, it didn't exist before #18230
2021-02-03T01:09:16Z
[]
[]
Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: invalid literal for int() with base 10: 'hello'
9,993
numpy/numpy
numpy__numpy-18695
fb60eb72d65b3f26509231c0eb63de9fa35491d4
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py --- a/numpy/f2py/crackfortran.py +++ b/numpy/f2py/crackfortran.py @@ -43,7 +43,8 @@ 'implicit','externals','interfaced','common','sortvars', 'commonvars','note']} B['block'] = 'interface' | 'function' | 'subroutine' | 'module' | - 'program' | 'block data' | 'type' | 'pythonmodule' + 'program' | 'block data' | 'type' | 'pythonmodule' | + 'abstract interface' B['body'] --- list containing `subblocks' with the same structure as `blocks' B['parent_block'] --- dictionary of a parent block: C['body'][<index>]['parent_block'] is C @@ -138,6 +139,7 @@ The above may be solved by creating appropriate preprocessor program, for example. """ +import io import sys import string import fileinput @@ -567,7 +569,8 @@ def readfortrancode(ffile, dowithline=show, istop=1): beginpattern77 = re.compile( beforethisafter % ('', groupbegins77, groupbegins77, '.*'), re.I), 'begin' groupbegins90 = groupbegins77 + \ - r'|module(?!\s*procedure)|python\s*module|interface|type(?!\s*\()' + r'|module(?!\s*procedure)|python\s*module|(abstract|)\s*interface|' + \ + r'type(?!\s*\()' beginpattern90 = re.compile( beforethisafter % ('', groupbegins90, groupbegins90, '.*'), re.I), 'begin' groupends = (r'end|endprogram|endblockdata|endmodule|endpythonmodule|' @@ -941,15 +944,17 @@ def analyzeline(m, case, line): block = block.lower() if re.match(r'block\s*data', block, re.I): block = 'block data' - if re.match(r'python\s*module', block, re.I): + elif re.match(r'python\s*module', block, re.I): block = 'python module' + elif re.match(r'abstract\s*interface', block, re.I): + block = 'abstract interface' name, args, result, bind = _resolvenameargspattern(m.group('after')) if name is None: if block == 'block data': name = '_BLOCK_DATA_' else: name = '' - if block not in ['interface', 'block data']: + if block not in ['interface', 'block data', 'abstract interface']: outmess('analyzeline: No name/args pattern found for line.\n') previous_context = (block, name, groupcounter) @@ -983,7 +988,7 @@ def analyzeline(m, case, line): if f77modulename and neededmodule == -1 and groupcounter <= 1: neededmodule = groupcounter + 2 needmodule = 1 - if block != 'interface': + if block not in ['interface', 'abstract interface']: needinterface = 1 # Create new block(s) groupcounter = groupcounter + 1 @@ -1023,7 +1028,7 @@ def analyzeline(m, case, line): groupname[groupcounter] = block groupcache[groupcounter]['block'] = block if not name: - name = 'unknown_' + block + name = 'unknown_' + block.replace(' ', '_') groupcache[groupcounter]['prefix'] = m.group('before') groupcache[groupcounter]['name'] = rmbadname1(name) groupcache[groupcounter]['result'] = result @@ -2088,7 +2093,7 @@ def analyzebody(block, args, tab=''): else: as_ = args b = postcrack(b, as_, tab=tab + '\t') - if b['block'] == 'interface' and not b['body']: + if b['block'] in ['interface', 'abstract interface'] and not b['body']: if 'f2pyenhancements' not in b: continue if b['block'].replace(' ', '') == 'pythonmodule': diff --git a/numpy/f2py/f90mod_rules.py b/numpy/f2py/f90mod_rules.py --- a/numpy/f2py/f90mod_rules.py +++ b/numpy/f2py/f90mod_rules.py @@ -192,7 +192,8 @@ def iadd(line, s=ihooks): if hasbody(m): for b in m['body']: if not isroutine(b): - print('Skipping', b['block'], b['name']) + outmess("f90mod_rules.buildhooks:" + f" skipping {b['block']} {b['name']}\n") continue modobjs.append('%s()' % (b['name'])) b['modulename'] = m['name'] diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py --- a/numpy/f2py/rules.py +++ b/numpy/f2py/rules.py @@ -1163,7 +1163,7 @@ def buildmodule(m, um): for n in m['interfaced']: nb = None for bi in m['body']: - if not bi['block'] == 'interface': + if bi['block'] not in ['interface', 'abstract interface']: errmess('buildmodule: Expected interface block. Skipping.\n') continue for b in bi['body']:
Error when parsing fortran code with abstract interface f2py appears to be missing support for abstract interfaces. Attempting to parse code containing an abstract interface produces an error. ### Reproducing code example: ```python from numpy.f2py.crackfortran import crackfortran crackfortran('test_interface.F90') ``` test_interface.F90: ```fortran module test abstract interface end interface end module test ``` ### Error message: ``` Traceback (most recent call last): File "/Users/jhaiduce/Development/lightda/test_interface_crackfortran.py", line 3, in <module> crackfortran('test_interface.F90') File "/usr/local/lib/python3.9/site-packages/numpy/f2py/crackfortran.py", line 3310, in crackfortran readfortrancode(files, crackline) File "/usr/local/lib/python3.9/site-packages/numpy/f2py/crackfortran.py", line 526, in readfortrancode dowithline(finalline) File "/usr/local/lib/python3.9/site-packages/numpy/f2py/crackfortran.py", line 759, in crackline raise Exception('crackline: groupcounter(=%s) is nonpositive. ' Exception: crackline: groupcounter(=0) is nonpositive. Check the blocks. ``` ### NumPy/Python version information: 1.20.1 3.9.1 (default, Feb 3 2021, 07:04:48) [Clang 11.0.0 (clang-1100.0.33.17)]
2021-03-29T15:01:34Z
[]
[]
Traceback (most recent call last): File "/Users/jhaiduce/Development/lightda/test_interface_crackfortran.py", line 3, in <module> crackfortran('test_interface.F90') File "/usr/local/lib/python3.9/site-packages/numpy/f2py/crackfortran.py", line 3310, in crackfortran readfortrancode(files, crackline) File "/usr/local/lib/python3.9/site-packages/numpy/f2py/crackfortran.py", line 526, in readfortrancode dowithline(finalline) File "/usr/local/lib/python3.9/site-packages/numpy/f2py/crackfortran.py", line 759, in crackline raise Exception('crackline: groupcounter(=%s) is nonpositive. ' Exception: crackline: groupcounter(=0) is nonpositive. Check the blocks.
10,008
numpy/numpy
numpy__numpy-18911
a0f46219d3279b8347c0ccd3a87e719bc3d579d2
diff --git a/numpy/distutils/ccompiler_opt.py b/numpy/distutils/ccompiler_opt.py --- a/numpy/distutils/ccompiler_opt.py +++ b/numpy/distutils/ccompiler_opt.py @@ -747,12 +747,14 @@ def __init__(self, cache_path=None, *factors): self.cache_me = {} self.cache_private = set() self.cache_infile = False + self._cache_path = None if self.conf_nocache: self.dist_log("cache is disabled by `Config`") return - chash = self.cache_hash(*factors, *self.conf_cache_factors) + self._cache_hash = self.cache_hash(*factors, *self.conf_cache_factors) + self._cache_path = cache_path if cache_path: if os.path.exists(cache_path): self.dist_log("load cache from file ->", cache_path) @@ -765,7 +767,7 @@ def __init__(self, cache_path=None, *factors): elif not hasattr(cache_mod, "hash") or \ not hasattr(cache_mod, "data"): self.dist_log("invalid cache file", stderr=True) - elif chash == cache_mod.hash: + elif self._cache_hash == cache_mod.hash: self.dist_log("hit the file cache") for attr, val in cache_mod.data.items(): setattr(self, attr, val) @@ -773,10 +775,8 @@ def __init__(self, cache_path=None, *factors): else: self.dist_log("miss the file cache") - atexit.register(self._cache_write, cache_path, chash) - if not self.cache_infile: - other_cache = _share_cache.get(chash) + other_cache = _share_cache.get(self._cache_hash) if other_cache: self.dist_log("hit the memory cache") for attr, val in other_cache.__dict__.items(): @@ -785,32 +785,41 @@ def __init__(self, cache_path=None, *factors): continue setattr(self, attr, val) - _share_cache[chash] = self + _share_cache[self._cache_hash] = self + atexit.register(self.cache_flush) def __del__(self): - # TODO: remove the cache form share on del - pass + for h, o in _share_cache.items(): + if o == self: + _share_cache.pop(h) + break - def _cache_write(self, cache_path, cache_hash): + def cache_flush(self): + """ + Force update the cache. + """ + if not self._cache_path: + return # TODO: don't write if the cache doesn't change - self.dist_log("write cache to path ->", cache_path) - for attr in list(self.__dict__.keys()): + self.dist_log("write cache to path ->", self._cache_path) + cdict = self.__dict__.copy() + for attr in self.__dict__.keys(): if re.match(self._cache_ignore, attr): - self.__dict__.pop(attr) + cdict.pop(attr) - d = os.path.dirname(cache_path) + d = os.path.dirname(self._cache_path) if not os.path.exists(d): os.makedirs(d) - repr_dict = pprint.pformat(self.__dict__, compact=True) - with open(cache_path, "w") as f: + repr_dict = pprint.pformat(cdict, compact=True) + with open(self._cache_path, "w") as f: f.write(textwrap.dedent("""\ # AUTOGENERATED DON'T EDIT # Please make changes to the code generator \ (distutils/ccompiler_opt.py) hash = {} data = \\ - """).format(cache_hash)) + """).format(self._cache_hash)) f.write(repr_dict) def cache_hash(self, *factors): diff --git a/numpy/distutils/command/build_clib.py b/numpy/distutils/command/build_clib.py --- a/numpy/distutils/command/build_clib.py +++ b/numpy/distutils/command/build_clib.py @@ -123,15 +123,20 @@ def run(self): opt_cache_path = os.path.abspath( os.path.join(self.build_temp, 'ccompiler_opt_cache_clib.py') ) + if hasattr(self, "compiler_opt"): + # By default `CCompilerOpt` update the cache at the exit of + # the process, which may lead to duplicate building + # (see build_extension()/force_rebuild) if run() called + # multiple times within the same os process/thread without + # giving the chance the previous instances of `CCompilerOpt` + # to update the cache. + self.compiler_opt.cache_flush() + self.compiler_opt = new_ccompiler_opt( compiler=self.compiler, dispatch_hpath=dispatch_hpath, cpu_baseline=self.cpu_baseline, cpu_dispatch=self.cpu_dispatch, cache_path=opt_cache_path ) - if not self.compiler_opt.is_cached(): - log.info("Detected changes on compiler optimizations, force rebuilding") - self.force = True - def report(copt): log.info("\n########### CLIB COMPILER OPTIMIZATION ###########") log.info(copt.report(full=True)) @@ -212,7 +217,12 @@ def build_a_library(self, build_info, lib_name, libraries): lib_file = compiler.library_filename(lib_name, output_dir=self.build_clib) depends = sources + build_info.get('depends', []) - if not (self.force or newer_group(depends, lib_file, 'newer')): + + force_rebuild = self.force + if not self.disable_optimization and not self.compiler_opt.is_cached(): + log.debug("Detected changes on compiler optimizations") + force_rebuild = True + if not (force_rebuild or newer_group(depends, lib_file, 'newer')): log.debug("skipping '%s' library (up-to-date)", lib_name) return else: diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py --- a/numpy/distutils/command/build_ext.py +++ b/numpy/distutils/command/build_ext.py @@ -151,15 +151,20 @@ def run(self): opt_cache_path = os.path.abspath( os.path.join(self.build_temp, 'ccompiler_opt_cache_ext.py') ) + if hasattr(self, "compiler_opt"): + # By default `CCompilerOpt` update the cache at the exit of + # the process, which may lead to duplicate building + # (see build_extension()/force_rebuild) if run() called + # multiple times within the same os process/thread without + # giving the chance the previous instances of `CCompilerOpt` + # to update the cache. + self.compiler_opt.cache_flush() + self.compiler_opt = new_ccompiler_opt( compiler=self.compiler, dispatch_hpath=dispatch_hpath, cpu_baseline=self.cpu_baseline, cpu_dispatch=self.cpu_dispatch, cache_path=opt_cache_path ) - if not self.compiler_opt.is_cached(): - log.info("Detected changes on compiler optimizations, force rebuilding") - self.force = True - def report(copt): log.info("\n########### EXT COMPILER OPTIMIZATION ###########") log.info(copt.report(full=True)) @@ -360,7 +365,11 @@ def build_extension(self, ext): self.get_ext_filename(fullname)) depends = sources + ext.depends - if not (self.force or newer_group(depends, ext_filename, 'newer')): + force_rebuild = self.force + if not self.disable_optimization and not self.compiler_opt.is_cached(): + log.debug("Detected changes on compiler optimizations") + force_rebuild = True + if not (force_rebuild or newer_group(depends, ext_filename, 'newer')): log.debug("skipping '%s' extension (up-to-date)", ext.name) return else:
Wheel building with CPU optimization flag error Building NumPy python wheel reports error in the end of process if CPU instruction set baseline flag is passed: > python3 setup.py build --cpu-baseline="avx" bdist_wheel > AttributeError: 'CCompilerOpt' object has no attribute '_requested_baseline' Full error: ``` ########### EXT COMPILER OPTIMIZATION ########### Platform : Architecture: x64 Compiler : gcc CPU baseline : Requested : 'avx' Enabled : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx Extra checks: none CPU dispatch : Requested : 'max -xop -fma4' Enabled : F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL Generated : : AVX2 : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mavx2 Extra checks: none Detect : AVX F16C AVX2 : numpy/core/src/umath/_umath_tests.dispatch.c : (FMA3 AVX2) : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mfma -mavx2 Extra checks: none Detect : AVX F16C FMA3 AVX2 : build/src.linux-x86_64-3.8/numpy/core/src/_simd/_simd.dispatch.c : AVX512F : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mfma -mavx2 -mavx512f Extra checks: AVX512F_REDUCE Detect : AVX512F : build/src.linux-x86_64-3.8/numpy/core/src/_simd/_simd.dispatch.c : AVX512_SKX : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mfma -mavx2 -mavx512f -mavx512cd -mavx512vl -mavx512bw -mavx512dq Extra checks: AVX512BW_MASK AVX512DQ_MASK Detect : AVX512_SKX : build/src.linux-x86_64-3.8/numpy/core/src/_simd/_simd.dispatch.c CCompilerOpt._cache_write[796] : write cache to path -> /home/user/Work/numpy-1.20.2/build/temp.linux-x86_64-3.8/ccompiler_opt_cache_ext.py ########### EXT COMPILER OPTIMIZATION ########### Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/home/user/Work/numpy-1.20.2/numpy/distutils/command/build_ext.py", line 166, in report log.info(self.compiler_opt.report(full=True)) File "/home/user/Work/numpy-1.20.2/numpy/distutils/ccompiler_opt.py", line 2331, in report baseline_rows.append(("Requested", repr(self._requested_baseline))) AttributeError: 'CCompilerOpt' object has no attribute '_requested_baseline' CCompilerOpt._cache_write[796] : write cache to path -> /home/user/Work/numpy-1.20.2/build/temp.linux-x86_64-3.8/ccompiler_opt_cache_ext.py ########### CLIB COMPILER OPTIMIZATION ########### Platform : Architecture: x64 Compiler : gcc CPU baseline : Requested : 'avx' Enabled : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx Extra checks: none CPU dispatch : Requested : 'max -xop -fma4' Enabled : F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL Generated : none CCompilerOpt._cache_write[796] : write cache to path -> /home/user/Work/numpy-1.20.2/build/temp.linux-x86_64-3.8/ccompiler_opt_cache_clib.py ``` Although wheel file is successfully created and after installation it passes all standard tests. Simply building NumPy without wheel goes without errors: > python3 setup.py build --cpu-baseline="avx" ``` ########### EXT COMPILER OPTIMIZATION ########### Platform : Architecture: x64 Compiler : gcc CPU baseline : Requested : 'avx' Enabled : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx Extra checks: none CPU dispatch : Requested : 'max -xop -fma4' Enabled : F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL Generated : : AVX2 : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mavx2 Extra checks: none Detect : AVX F16C AVX2 : numpy/core/src/umath/_umath_tests.dispatch.c : (FMA3 AVX2) : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mfma -mavx2 Extra checks: none Detect : AVX F16C FMA3 AVX2 : build/src.linux-x86_64-3.8/numpy/core/src/_simd/_simd.dispatch.c : AVX512F : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mfma -mavx2 -mavx512f Extra checks: AVX512F_REDUCE Detect : AVX512F : build/src.linux-x86_64-3.8/numpy/core/src/_simd/_simd.dispatch.c : AVX512_SKX : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mfma -mavx2 -mavx512f -mavx512cd -mavx512vl -mavx512bw -mavx512dq Extra checks: AVX512BW_MASK AVX512DQ_MASK Detect : AVX512_SKX : build/src.linux-x86_64-3.8/numpy/core/src/_simd/_simd.dispatch.c CCompilerOpt._cache_write[796] : write cache to path -> /home/user/Work/numpy-1.20.2/build/temp.linux-x86_64-3.8/ccompiler_opt_cache_ext.py ########### CLIB COMPILER OPTIMIZATION ########### Platform : Architecture: x64 Compiler : gcc CPU baseline : Requested : 'avx' Enabled : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx Extra checks: none CPU dispatch : Requested : 'max -xop -fma4' Enabled : F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL Generated : none CCompilerOpt._cache_write[796] : write cache to path -> /home/user/Work/numpy-1.20.2/build/temp.linux-x86_64-3.8/ccompiler_opt_cache_clib.py ``` But if after building additionally request to create wheel distribution with the first command (**python3 setup.py build --cpu-baseline="avx" bdist_wheel**) it will end up with the same error. Also, building wheel without specifying CPU instruction set has no errors: > python3 setup.py bdist_wheel ``` ########### EXT COMPILER OPTIMIZATION ########### Platform : Architecture: x64 Compiler : gcc CPU baseline : Requested : 'min' Enabled : SSE SSE2 SSE3 Flags : -msse -msse2 -msse3 Extra checks: none CPU dispatch : Requested : 'max -xop -fma4' Enabled : SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL Generated : : SSE41 : SSE SSE2 SSE3 SSSE3 Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 Extra checks: none Detect : SSE SSE2 SSE3 SSSE3 SSE41 : numpy/core/src/umath/_umath_tests.dispatch.c : SSE42 : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 Extra checks: none Detect : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 : build/src.linux-x86_64-3.8/numpy/core/src/_simd/_simd.dispatch.c : AVX2 : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mavx2 Extra checks: none Detect : AVX F16C AVX2 : numpy/core/src/umath/_umath_tests.dispatch.c : (FMA3 AVX2) : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mfma -mavx2 Extra checks: none Detect : AVX F16C FMA3 AVX2 : build/src.linux-x86_64-3.8/numpy/core/src/_simd/_simd.dispatch.c : AVX512F : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mfma -mavx2 -mavx512f Extra checks: AVX512F_REDUCE Detect : AVX512F : build/src.linux-x86_64-3.8/numpy/core/src/_simd/_simd.dispatch.c : AVX512_SKX : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mfma -mavx2 -mavx512f -mavx512cd -mavx512vl -mavx512bw -mavx512dq Extra checks: AVX512BW_MASK AVX512DQ_MASK Detect : AVX512_SKX : build/src.linux-x86_64-3.8/numpy/core/src/_simd/_simd.dispatch.c CCompilerOpt._cache_write[796] : write cache to path -> /home/user/Work/numpy-1.20.2/build/temp.linux-x86_64-3.8/ccompiler_opt_cache_ext.py ########### CLIB COMPILER OPTIMIZATION ########### Platform : Architecture: x64 Compiler : gcc CPU baseline : Requested : 'min' Enabled : SSE SSE2 SSE3 Flags : -msse -msse2 -msse3 Extra checks: none CPU dispatch : Requested : 'max -xop -fma4' Enabled : SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL Generated : none CCompilerOpt._cache_write[796] : write cache to path -> /home/user/Work/numpy-1.20.2/build/temp.linux-x86_64-3.8/ccompiler_opt_cache_clib.py ``` ### NumPy/Python version information: 1.20.2 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
This issue has two sides: 1. This AttributeError is caused due to calling an object whose attributes have been freed. 2. But if you look closely, you will find that the main cause of the issue is duplicate building the extensions. in other words, command `build_ext` has been calling twice one by `build` and the other by `bdist_wheel`. which leads to increasing the build time and also leads to discovering the first side. The first part of this issue should be fixed by #18899, while I'm still looking for a better way to fix the second one. For a workaround, try to specify the option `build` after `bdist_wheel` and the two sides of this bug will disappear. e.g. `(python3 setup.py bdist_wheel build --cpu-baseline="avx"` @rgommers, Is this a normal behavior to get duplicated builds when option `build` specified before `bdist_wheel`? Yes, setuptools isn't very smart with reusing; if you give it multiple commands it will execute them separately. If you want to build a wheel, you just do `python setup.py bdist_wheel`. @rgommers, so there's no need to create a workaround for such behavior, and any specified `build` options should come after `bdist_wheel` to avoid any duplicate building; For example, it should be `python setup.py bdist_wheel build --cpu-baseline="avx2"` instead of `python setup.py build --cpu-baseline="avx2" bdist_wheel`, Is that correct? if the answer is yes then we can close this issue since #18899 already fixed the reported error. I'm a little surprised that that makes a difference, but the whole "multiple commands on a single setup.py invocation" is a little weird anyway. There's an example at http://scipy.github.io/devdocs/building/linux.html for `--compiler=intel`, but other than the rule that flags go _after_ the command I don't think there's many rules/guarantees. Does `python setup.py bdist_wheel build --cpu-baseline="avx2"` work? I just searched for `bdist_wheel` and found this in `tools/travis-test.sh`: ``` $PYTHON setup.py build --warn-error build_src --verbose-cfg bdist_wheel ``` and that seems to work (example log [here](https://travis-ci.com/github/numpy/numpy/jobs/502788069)) and not do a double build. So maybe something else is off here. > Yes, setuptools isn't very smart with reusing; if you give it multiple commands it will execute them separately. So this may have been incorrect, it's _supposed_ to work but is badly tested. I ran into the same when writing the clang-cl patch. In the end, I added a not great `hasattr` check. https://github.com/numpy/numpy/pull/13816/files#diff-a9126c03aa7a34e7b791e5d0202715b359bb3a44da09d0dbc8f156932cb42240R2348-R2351 > Does python setup.py bdist_wheel build --cpu-baseline="avx2" work? Yes, changing the order helps to build wheel without errors > "multiple commands on a single setup.py invocation" is a little weird I haven't found how to build wheel with instruction set parameter without merging both **build** and **bdist_wheel** into one line 1. `python setup.py bdist_wheel --cpu-baseline="avx2"` complains about unknown parameter 2. `python setup.py build --cpu-baseline="avx2"` `python setup.py bdist_wheel` restarts build from scratch without flag What happens if you use config first? I tried `python3 setup.py config --cpu-baseline="avx" bdist_wheel` it throws > error: option --cpu-baseline not recognized
2021-05-05T10:36:15Z
[]
[]
Traceback (most recent call last): File "/home/user/Work/numpy-1.20.2/numpy/distutils/command/build_ext.py", line 166, in report log.info(self.compiler_opt.report(full=True)) File "/home/user/Work/numpy-1.20.2/numpy/distutils/ccompiler_opt.py", line 2331, in report baseline_rows.append(("Requested", repr(self._requested_baseline))) AttributeError: 'CCompilerOpt' object has no attribute '_requested_baseline'
10,013
numpy/numpy
numpy__numpy-19098
f7e6e512105c0a26917d00f597b11efe0de97375
diff --git a/numpy/distutils/ccompiler_opt.py b/numpy/distutils/ccompiler_opt.py --- a/numpy/distutils/ccompiler_opt.py +++ b/numpy/distutils/ccompiler_opt.py @@ -552,7 +552,7 @@ def dist_compile(self, sources, flags, ccompiler=None, **kwargs): ccompiler = self._ccompiler return ccompiler.compile(sources, extra_postargs=flags, **kwargs) - def dist_test(self, source, flags): + def dist_test(self, source, flags, macros=[]): """Return True if 'CCompiler.compile()' able to compile a source file with certain flags. """ @@ -569,7 +569,7 @@ def dist_test(self, source, flags): test = False try: self.dist_compile( - [source], flags, output_dir=self.conf_tmp_path + [source], flags, macros=macros, output_dir=self.conf_tmp_path ) test = True except CompileError as e: @@ -1172,20 +1172,23 @@ def __init__(self): self.feature_is_cached = True - def feature_names(self, names=None, force_flags=None): + def feature_names(self, names=None, force_flags=None, macros=[]): """ Returns a set of CPU feature names that supported by platform and the **C** compiler. Parameters ---------- - 'names': sequence or None, optional + names: sequence or None, optional Specify certain CPU features to test it against the **C** compiler. if None(default), it will test all current supported features. **Note**: feature names must be in upper-case. - 'force_flags': list or None, optional - If None(default), default compiler flags for every CPU feature will be used - during the test. + force_flags: list or None, optional + If None(default), default compiler flags for every CPU feature will + be used during the test. + + macros : list of tuples, optional + A list of C macro definitions. """ assert( names is None or ( @@ -1198,7 +1201,9 @@ def feature_names(self, names=None, force_flags=None): names = self.feature_supported.keys() supported_names = set() for f in names: - if self.feature_is_supported(f, force_flags=force_flags): + if self.feature_is_supported( + f, force_flags=force_flags, macros=macros + ): supported_names.add(f) return supported_names @@ -1433,20 +1438,23 @@ def feature_flags(self, names): return self.cc_normalize_flags(flags) @_Cache.me - def feature_test(self, name, force_flags=None): + def feature_test(self, name, force_flags=None, macros=[]): """ Test a certain CPU feature against the compiler through its own check file. Parameters ---------- - 'name': str + name: str Supported CPU feature name. - 'force_flags': list or None, optional + force_flags: list or None, optional If None(default), the returned flags from `feature_flags()` will be used. - """ + + macros : list of tuples, optional + A list of C macro definitions. + """ if force_flags is None: force_flags = self.feature_flags(name) @@ -1462,24 +1470,29 @@ def feature_test(self, name, force_flags=None): if not os.path.exists(test_path): self.dist_fatal("feature test file is not exist", test_path) - test = self.dist_test(test_path, force_flags + self.cc_flags["werror"]) + test = self.dist_test( + test_path, force_flags + self.cc_flags["werror"], macros=macros + ) if not test: self.dist_log("testing failed", stderr=True) return test @_Cache.me - def feature_is_supported(self, name, force_flags=None): + def feature_is_supported(self, name, force_flags=None, macros=[]): """ Check if a certain CPU feature is supported by the platform and compiler. Parameters ---------- - 'name': str + name: str CPU feature name in uppercase. - 'force_flags': list or None, optional - If None(default), default compiler flags for every CPU feature will be used - during test. + force_flags: list or None, optional + If None(default), default compiler flags for every CPU feature will + be used during test. + + macros : list of tuples, optional + A list of C macro definitions. """ assert(name.isupper()) assert(force_flags is None or isinstance(force_flags, list)) @@ -1487,9 +1500,9 @@ def feature_is_supported(self, name, force_flags=None): supported = name in self.feature_supported if supported: for impl in self.feature_implies(name): - if not self.feature_test(impl, force_flags): + if not self.feature_test(impl, force_flags, macros=macros): return False - if not self.feature_test(name, force_flags): + if not self.feature_test(name, force_flags, macros=macros): return False return supported @@ -1812,7 +1825,9 @@ def _parse_arg_features(self, arg_name, req_features): self.dist_fatal(arg_name, "native option isn't supported by the compiler" ) - features_to = self.feature_names(force_flags=native) + features_to = self.feature_names( + force_flags=native, macros=[("DETECT_FEATURES", 1)] + ) elif TOK == "MAX": features_to = self.feature_supported.keys() elif TOK == "MIN":
CPU feature detection is broken/incorrect when using Intel compilers 2021 update 2 When compiling numpy 1.20.3 with Intel compilers 2021 update 2 (latest release to date) with `--cpu-baseline native` (because `-xHost` is used in `$CFLAGS`), the detection of CPU features isn't being done correctly. I'm not seeing this problem when compiling with GCC 10.3.0 on the same system. On an Intel Skylake X system (Xeon Gold 6140), the compiler crashes (only) when compiling the `cpu_avx512_knm.c` C test program which uses intrinsics to check for the support of a specific feature. That's probably a compiler bug, but it breaks the detection mechanism used by numpy... One way around this is to compile with `-O0`, but I'm not sure if that makes sense? I used `-O0` to work around that issue, but even then the detection seems to be done incorrectly. There are no errors mentioned in the output when testing for supported features, and this is reported at the end: ``` CPU baseline : Requested : 'native' Enabled : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL Flags : -xICELAKE-CLIENT Extra checks: AVX512F_REDUCE AVX512BW_MASK AVX512DQ_MASK CPU dispatch : Requested : 'max -xop -fma4' Enabled : none Generated : none ``` Several of these CPU features, like `AVX512_KNL`, are not supported by Intel Skylake X (although the Intel compiler does support them). When compiling with `GCC` 10.3.0, the output is correct w.r.t. CPU baseline vs dispatch: ``` CPU baseline : Requested : 'native' Enabled : SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_SKX Flags : -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt -msse4.2 -mavx -mf16c -mfma -mavx2 -mavx512f -mavx512cd -mavx512vl -mavx512bw -mavx512dq Extra checks: AVX512F_REDUCE AVX512BW_MASK AVX512DQ_MASK CPU dispatch : Requested : 'max -xop -fma4' Enabled : AVX512_KNL AVX512_KNM AVX512_CLX AVX512_CNL AVX512_ICL Generated : none ``` The [documentation](https://numpy.org/devdocs/reference/simd/simd-optimizations.html) mentions that CPU features that are not supported by the host platform or the compiler should be skipped, but that doesn't seem to be the case... I took a quick look at the code in `numpy/distutils/ccompiler_opt.py`, and it seems that the `feature_is_supported` method only checks for compiler support via `feature_test`, it doesn't try to run the compiled test programs at all? That doesn't match the `"Check if a certain CPU feature is supported by the platform and compiler."` docstring in `feature_is_supported`, but perhaps I'm interpreting that incorrectly, or I'm missing something. Trying to run the compiled test program `cpu_avx512_knl.c` manually results in a failure, as expected: ``` $ ./cpu_avx512_knl Illegal instruction ``` Isn't the intention to also *run* these (rather than just compile them) to detect whether the CPU features are actually supported? It's not clear to me why the current mechanism works as expected when using GCC 10.3.0... How is the discrimination between baseline and dispatch CPU features done? The installation actually completes, but the result doesn't work at all, it leads to trouble on `import numpy`, which triggers an error reporting that `AVX512_KNL` is not supported (see traceback below). ### Reproducing code example: * build numpy from source with Intel compilers 2021 update 2 using `--cpu-baseline native`, and install it; * try to `import numpy` using that installation; ### Error message: * internal compiler error when checking for support for `AVX512_KNM` feature: ``` CCompilerOpt.feature_test[1444] : testing feature 'AVX512_KNM' with flags (-xKNM) C compiler: icc -fPIC -fp-model strict -O3 -fomit-frame-pointer -qopenmp compile options: '-Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -Inumpy/core/src/_simd -I/software/Python/3.9.5-GCCcore-10.3.0/include/python3.9 -Ibuild/src.linux-x86_64-3.9/numpy/core/src/common -Ibuild/src.linux-x86_64-3.9/numpy/core/src/npymath -c' extra options: '-xKNM -Werror' CCompilerOpt.dist_test[576] : CCompilerOpt._dist_test_spawn[711] : Command (icc -fPIC -fp-model strict -O3 -fomit-frame-pointer -qopenmp -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -Inumpy/core/src/_simd -I/software/Python/3.9.5-GCCcore-10.3.0/include/python3.9 -Ibuild/src.linux-x86_64-3.9/numpy/core/src/common -Ibuild/src.linux-x86_64-3.9/numpy/core/src/npymath -c /tmp/numpy-1.20.3/numpy/distutils/checks/cpu_avx512_knm.c -o /tmp/eb-5n40d3vl/tmpx45c9w98/tmp/numpy-1.20.3/numpy/distutils/checks/cpu_avx512_knm.o -MMD -MF /tmp/eb-5n40d3vl/tmpx45c9w98/tmp/numpy-1.20.3/numpy/distutils/checks/cpu_avx512_knm.o.d -xKNM -Werror) failed with exit status 4 output -> ": internal error: IERROR_MODULE_ID_1102 compilation aborted for /tmp/numpy-1.20.3/numpy/distutils/checks/cpu_avx512_knm.c (code 4) ``` * runtime error on `import numpy`: ``` Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/eb-5n40d3vl/tmp5mog6hw4/lib/python3.9/site-packages/numpy/__init__.py", line 145, in <module> from . import core File "/tmp/eb-5n40d3vl/tmp5mog6hw4/lib/python3.9/site-packages/numpy/core/__init__.py", line 22, in <module> from . import multiarray File "/tmp/eb-5n40d3vl/tmp5mog6hw4/lib/python3.9/site-packages/numpy/core/multiarray.py", line 12, in <module> from . import overrides File "/tmp/eb-5n40d3vl/tmp5mog6hw4/lib/python3.9/site-packages/numpy/core/overrides.py", line 7, in <module> from numpy.core._multiarray_umath import ( RuntimeError: NumPy was built with baseline optimizations: (SSE SSE2 SSE3 SSSE3 SSE41 POPCNT SSE42 AVX F16C FMA3 AVX2 AVX512F AVX512CD AVX512_KNL AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL) but your machine doesn't support: (AVX512_KNL). ``` ### NumPy/Python version information: * OS: CentOS 7.9 * compiler: Intel compilers 2021 update 2 ("classic" commands, so using `icc`, `icpc`, `ifort`) * compiler flags: `-O1 -xHost -ftz -fp-speculation=safe -fp-model source -fPIC` * numpy 1.20.3, Python 3.9.5
If I understand correctly: 1) At compile time, check if the compiler supports various intrinsics by checking success/failure of compilation, with no regard to the capabilities of the host CPU. This give us the largest set of intrinsics we can use in the code. If the tests fail due to an internal compiler error, that is a compiler bug and should be reported to the compiler vendor. We cannot really help here. 2) At compile time, use the `--baseline` and `--dispatch` flags to select from the intrinsics in step 1. 3) Any intrinsics in the baseline will be required to be present at runtime. Any intrinsics in the dispatch will be tested for at runtime, and possibly used if they are found. Somehow the compiler bug in (1) is causing `AVX512_KNL` to be added to `--cpu-baseline native`, but at runtime the detection for it is failing. @seiko2plus thoughts?
2021-05-25T22:41:34Z
[]
[]
Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/eb-5n40d3vl/tmp5mog6hw4/lib/python3.9/site-packages/numpy/__init__.py", line 145, in <module> from . import core File "/tmp/eb-5n40d3vl/tmp5mog6hw4/lib/python3.9/site-packages/numpy/core/__init__.py", line 22, in <module> from . import multiarray File "/tmp/eb-5n40d3vl/tmp5mog6hw4/lib/python3.9/site-packages/numpy/core/multiarray.py", line 12, in <module> from . import overrides File "/tmp/eb-5n40d3vl/tmp5mog6hw4/lib/python3.9/site-packages/numpy/core/overrides.py", line 7, in <module> from numpy.core._multiarray_umath import ( RuntimeError: NumPy was built with baseline optimizations:
10,024
numpy/numpy
numpy__numpy-19654
334428c4d10b778fd74fc3919f3dc9a3b1959875
diff --git a/runtests.py b/runtests.py --- a/runtests.py +++ b/runtests.py @@ -480,6 +480,7 @@ def build_project(args): site_dir = site_dir_template.format(platbase=dst_dir, py_version_short=py_v_s, platlibdir=platlibdir, + base=dst_dir, ) noarch_template = sysconfig.get_path('purelib', expand=False) site_dir_noarch = noarch_template.format(base=dst_dir,
BUG: `runtest.py` fails with a `KeyError` Since the merging of https://github.com/numpy/numpy/pull/19628 the `python ./runtest.py` fails with a `KeyError`. Based on the traceback it seems that `sysconfig.get_path('platlib', expand=False)` returns an incorrect formattable string. ### Error message: ``` >>> python .\runtests.py Traceback (most recent call last): File "C:\Users\hardd\Documents\GitHub\numpy\runtests.py", line 695, in <module> main(argv=sys.argv[1:]) File "C:\Users\hardd\Documents\GitHub\numpy\runtests.py", line 192, in main site_dir, site_dir_noarch = build_project(args) File "C:\Users\hardd\Documents\GitHub\numpy\runtests.py", line 480, in build_project site_dir = site_dir_template.format(platbase=dst_dir, KeyError: 'base' ``` And the content of the offending `site_dir_template` formattable string: ``` python >>> print(site_dir_template) {base}/Lib/site-packages ``` ### NumPy/Python version information: 1.22.0.dev0+696.g334428c4d 3.9.4 | packaged by conda-forge | (default, May 10 2021, 22:10:34) [MSC v.1916 64 bit (AMD64)]
2021-08-12T05:33:53Z
[]
[]
Traceback (most recent call last): File "C:\Users\hardd\Documents\GitHub\numpy\runtests.py", line 695, in <module> main(argv=sys.argv[1:]) File "C:\Users\hardd\Documents\GitHub\numpy\runtests.py", line 192, in main site_dir, site_dir_noarch = build_project(args) File "C:\Users\hardd\Documents\GitHub\numpy\runtests.py", line 480, in build_project site_dir = site_dir_template.format(platbase=dst_dir, KeyError: 'base'
10,041
numpy/numpy
numpy__numpy-19661
7659f14ec643a612411fb80d83a9bb404a7c75c7
diff --git a/runtests.py b/runtests.py --- a/runtests.py +++ b/runtests.py @@ -480,6 +480,7 @@ def build_project(args): site_dir = site_dir_template.format(platbase=dst_dir, py_version_short=py_v_s, platlibdir=platlibdir, + base=dst_dir, ) noarch_template = sysconfig.get_path('purelib', expand=False) site_dir_noarch = noarch_template.format(base=dst_dir,
BUG: `runtest.py` fails with a `KeyError` Since the merging of https://github.com/numpy/numpy/pull/19628 the `python ./runtest.py` fails with a `KeyError`. Based on the traceback it seems that `sysconfig.get_path('platlib', expand=False)` returns an incorrect formattable string. ### Error message: ``` >>> python .\runtests.py Traceback (most recent call last): File "C:\Users\hardd\Documents\GitHub\numpy\runtests.py", line 695, in <module> main(argv=sys.argv[1:]) File "C:\Users\hardd\Documents\GitHub\numpy\runtests.py", line 192, in main site_dir, site_dir_noarch = build_project(args) File "C:\Users\hardd\Documents\GitHub\numpy\runtests.py", line 480, in build_project site_dir = site_dir_template.format(platbase=dst_dir, KeyError: 'base' ``` And the content of the offending `site_dir_template` formattable string: ``` python >>> print(site_dir_template) {base}/Lib/site-packages ``` ### NumPy/Python version information: 1.22.0.dev0+696.g334428c4d 3.9.4 | packaged by conda-forge | (default, May 10 2021, 22:10:34) [MSC v.1916 64 bit (AMD64)]
2021-08-12T22:52:59Z
[]
[]
Traceback (most recent call last): File "C:\Users\hardd\Documents\GitHub\numpy\runtests.py", line 695, in <module> main(argv=sys.argv[1:]) File "C:\Users\hardd\Documents\GitHub\numpy\runtests.py", line 192, in main site_dir, site_dir_noarch = build_project(args) File "C:\Users\hardd\Documents\GitHub\numpy\runtests.py", line 480, in build_project site_dir = site_dir_template.format(platbase=dst_dir, KeyError: 'base'
10,043
numpy/numpy
numpy__numpy-20344
a0d86e298b18f6c1bc13d2ed032ac7fd9d67e592
diff --git a/numpy/distutils/ccompiler_opt.py b/numpy/distutils/ccompiler_opt.py --- a/numpy/distutils/ccompiler_opt.py +++ b/numpy/distutils/ccompiler_opt.py @@ -196,7 +196,6 @@ class _Config: native = '-march=native', opt = '-O3', werror = '-Werror', - cxx = '-std=c++11', ), clang = dict( native = '-march=native', @@ -207,25 +206,21 @@ class _Config: # "unused arguments" warnings. # see https://github.com/numpy/numpy/issues/19624 werror = '-Werror=switch -Werror', - cxx = '-std=c++11', ), icc = dict( native = '-xHost', opt = '-O3', werror = '-Werror', - cxx = '-std=c++11', ), iccw = dict( native = '/QxHost', opt = '/O3', werror = '/Werror', - cxx = '-std=c++11', ), msvc = dict( native = None, opt = '/O2', werror = '/WX', - cxx = '-std=c++11', ) ) conf_min_features = dict(
BUG: Error when importing NumPy main (No module named 'numpy.core._multiarray_umath') ### Describe the issue: In NumPy main, when I do an inplace build, I can no longer import NumPy. I get ``` Traceback (most recent call last): File "./numpy/core/__init__.py", line 23, in <module> from . import multiarray File "./numpy/core/multiarray.py", line 10, in <module> from . import overrides File "./numpy/core/overrides.py", line 6, in <module> from numpy.core._multiarray_umath import ( ModuleNotFoundError: No module named 'numpy.core._multiarray_umath' ``` I bisected it to https://github.com/numpy/numpy/commit/2ae7aeb3aa909b1a16bc58fd0e40dc4476dff35d. There are several errors in the build log, which I've included here https://gist.github.com/asmeurer/40754d1a4429449e1d558e003caa1860. There seem to be some issues with the build scripts with C++. Perhaps they were never tested with clang? This is currently blocking my ability to properly test my PR https://github.com/numpy/numpy/pull/20066. ### Reproduce the code example: ```python git clean -dfX python setup.py build_ext --inplace python -c 'import numpy' ``` ### Error message: _No response_ ### NumPy/Python version information: This is the latest NumPy main. I am using Python 3.9.2, on macOS.
Can you add the full build log @asmeurer? Cc @serge-sans-paille The main error seems to be ``error: invalid argument '-std=c++11' not allowed with 'C'`` This flag is only passed through ``extra_cxx_compile_args`` and ``cxx``. My guess would be that the compiler used to compile C++ code is still ``clang`` and not ``clang++`` ``` $ echo 'int man() { return 0;}' | clang -std=c++11 -x c - -o/dev/null error: invalid argument '-std=c++11' not allowed with 'C' ``` Other errors: ``` clang-12: error: unknown argument: '-mavx5124fmaps' ``` That's pretty clear, this machine target is not supported (but ``-mavx512f``` , ``-mavx512vpopcntdq`` etc are ) ``` error: implicit declaration of function '_mm512_4fmadd_ps' is invalid in C99 ``` That's a consequence of the above. The correct approach here would be to (use xsimd) make sure these are only used when the correct arch is available. Hope it helps. @asmeurer can you describe the minimal steps I should use to reproduce locally, I'd be happy to provide patches. I did link the build log in the OP. The minimal steps are just do an inplace build from a fresh clone, as I noted. I'm happy to provide additional information on my environment (compiler versions or whatever), but you'll have to tell me what you want to know because I don't really know enough about the NumPy build process to guess know what is relevant. > invalid argument '-std=c++11' not allowed with 'C' I saw that in the wheel builds, but it didn't abort anything. Maybe because they were release builds? Are you building on a mac? I'm curious about the clang version. This is on Mac. I'm assuming these are the correct commands for the clang version ``` $ clang --version clang version 12.0.1 Target: x86_64-apple-darwin20.6.0 Thread model: posix InstalledDir: /Users/aaronmeurer/anaconda3/envs/array-apis/bin $ clang++ --version clang version 12.0.1 Target: x86_64-apple-darwin20.6.0 Thread model: posix InstalledDir: /Users/aaronmeurer/anaconda3/envs/array-apis/bin ``` Apparently I have it installed via conda-forge (but I have no idea what the relevant conda packages are). Just tried building in another environment using the system clang and it worked. ``` Apple clang version 13.0.0 (clang-1300.0.29.3) Target: x86_64-apple-darwin20.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin ``` Interesting. My understanding is that apple clang versioning differs from non-apple versioning so I don't know how the versions actually compare.
2021-11-10T08:04:48Z
[]
[]
Traceback (most recent call last): File "./numpy/core/__init__.py", line 23, in <module> from . import multiarray File "./numpy/core/multiarray.py", line 10, in <module> from . import overrides File "./numpy/core/overrides.py", line 6, in <module> from numpy.core._multiarray_umath import ( ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
10,059
numpy/numpy
numpy__numpy-20934
7e76174901a17801dc21e832403a94ed20fc1f97
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py --- a/numpy/distutils/command/build_ext.py +++ b/numpy/distutils/command/build_ext.py @@ -393,8 +393,8 @@ def build_extension(self, ext): log.info("building '%s' extension", ext.name) extra_args = ext.extra_compile_args or [] - extra_cflags = ext.extra_c_compile_args or [] - extra_cxxflags = ext.extra_cxx_compile_args or [] + extra_cflags = getattr(ext, 'extra_c_compile_args', None) or [] + extra_cxxflags = getattr(ext, 'extra_cxx_compile_args', None) or [] macros = ext.define_macros[:] for undef in ext.undef_macros:
BUG: AttributeError: 'Extension' object has no attribute 'extra_c_compile_args' ### Describe the issue: It seems https://github.com/numpy/numpy/pull/19713 included in numpy >=1.22 is preventing to build some extensions such as in the assimulo package with the error: 'Extension' object has no attribute 'extra_c_compile_args' cc @serge-sans-paille ### Reproduce the code example: ```python curl -fSsL https://github.com/modelon-community/Assimulo/archive/Assimulo-3.2.9.tar.gz | tar xz cd Assimulo-Assimulo-3.2.9 python3 setup.py install --extra-fortran-link-flags="-shared" --sundials-home=/usr/local --lapack-home=/usr/lib64 --blas-home=/usr/lib64 ``` ``` ### Error message: ```shell Traceback (most recent call last): File "/usr/local/src/Assimulo-Assimulo-3.2.9/setup.py", line 691, in <module> ndc.setup(name=NAME, File "/usr/local/lib/python3.9/site-packages/numpy/distutils/core.py", line 169, in setup return old_setup(**new_attr) File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 155, in setup return distutils.core.setup(**attrs) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 148, in setup return run_commands(dist) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 163, in run_commands dist.run_commands() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands self.run_command(cmd) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/install.py", line 60, in run r = self.setuptools_run() File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/install.py", line 54, in setuptools_run self.do_egg_install() File "/usr/local/lib/python3.9/site-packages/setuptools/command/install.py", line 116, in do_egg_install self.run_command('bdist_egg') File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/setuptools/command/bdist_egg.py", line 164, in run cmd = self.call_command('install_lib', warn_dir=0) File "/usr/local/lib/python3.9/site-packages/setuptools/command/bdist_egg.py", line 150, in call_command self.run_command(cmdname) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/setuptools/command/install_lib.py", line 11, in run self.build() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/install_lib.py", line 107, in build self.run_command('build_ext') File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/build_ext.py", line 316, in run self.build_extensions() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 448, in build_extensions self._build_extensions_serial() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 473, in _build_extensions_serial self.build_extension(ext) File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/build_ext.py", line 380, in build_extension extra_cflags = ext.extra_c_compile_args or [] AttributeError: 'Extension' object has no attribute 'extra_c_compile_args' ``` ``` ### NumPy/Python version information: numpy 1.22.x
That's probably on me, I'll have a look this week end.
2022-01-28T18:48:00Z
[]
[]
Traceback (most recent call last): File "/usr/local/src/Assimulo-Assimulo-3.2.9/setup.py", line 691, in <module> ndc.setup(name=NAME, File "/usr/local/lib/python3.9/site-packages/numpy/distutils/core.py", line 169, in setup return old_setup(**new_attr) File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 155, in setup return distutils.core.setup(**attrs) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 148, in setup return run_commands(dist) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 163, in run_commands dist.run_commands() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands self.run_command(cmd) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/install.py", line 60, in run r = self.setuptools_run() File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/install.py", line 54, in setuptools_run self.do_egg_install() File "/usr/local/lib/python3.9/site-packages/setuptools/command/install.py", line 116, in do_egg_install self.run_command('bdist_egg') File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/setuptools/command/bdist_egg.py", line 164, in run cmd = self.call_command('install_lib', warn_dir=0) File "/usr/local/lib/python3.9/site-packages/setuptools/command/bdist_egg.py", line 150, in call_command self.run_command(cmdname) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/setuptools/command/install_lib.py", line 11, in run self.build() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/install_lib.py", line 107, in build self.run_command('build_ext') File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/build_ext.py", line 316, in run self.build_extensions() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 448, in build_extensions self._build_extensions_serial() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 473, in _build_extensions_serial self.build_extension(ext) File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/build_ext.py", line 380, in build_extension extra_cflags = ext.extra_c_compile_args or [] AttributeError: 'Extension' object has no attribute 'extra_c_compile_args'
10,085
numpy/numpy
numpy__numpy-20937
8c7484707da6b12f14f5fcd5a74e4909b1a8b559
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py --- a/numpy/distutils/command/build_ext.py +++ b/numpy/distutils/command/build_ext.py @@ -393,8 +393,8 @@ def build_extension(self, ext): log.info("building '%s' extension", ext.name) extra_args = ext.extra_compile_args or [] - extra_cflags = ext.extra_c_compile_args or [] - extra_cxxflags = ext.extra_cxx_compile_args or [] + extra_cflags = getattr(ext, 'extra_c_compile_args', None) or [] + extra_cxxflags = getattr(ext, 'extra_cxx_compile_args', None) or [] macros = ext.define_macros[:] for undef in ext.undef_macros:
BUG: AttributeError: 'Extension' object has no attribute 'extra_c_compile_args' ### Describe the issue: It seems https://github.com/numpy/numpy/pull/19713 included in numpy >=1.22 is preventing to build some extensions such as in the assimulo package with the error: 'Extension' object has no attribute 'extra_c_compile_args' cc @serge-sans-paille ### Reproduce the code example: ```python curl -fSsL https://github.com/modelon-community/Assimulo/archive/Assimulo-3.2.9.tar.gz | tar xz cd Assimulo-Assimulo-3.2.9 python3 setup.py install --extra-fortran-link-flags="-shared" --sundials-home=/usr/local --lapack-home=/usr/lib64 --blas-home=/usr/lib64 ``` ``` ### Error message: ```shell Traceback (most recent call last): File "/usr/local/src/Assimulo-Assimulo-3.2.9/setup.py", line 691, in <module> ndc.setup(name=NAME, File "/usr/local/lib/python3.9/site-packages/numpy/distutils/core.py", line 169, in setup return old_setup(**new_attr) File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 155, in setup return distutils.core.setup(**attrs) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 148, in setup return run_commands(dist) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 163, in run_commands dist.run_commands() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands self.run_command(cmd) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/install.py", line 60, in run r = self.setuptools_run() File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/install.py", line 54, in setuptools_run self.do_egg_install() File "/usr/local/lib/python3.9/site-packages/setuptools/command/install.py", line 116, in do_egg_install self.run_command('bdist_egg') File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/setuptools/command/bdist_egg.py", line 164, in run cmd = self.call_command('install_lib', warn_dir=0) File "/usr/local/lib/python3.9/site-packages/setuptools/command/bdist_egg.py", line 150, in call_command self.run_command(cmdname) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/setuptools/command/install_lib.py", line 11, in run self.build() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/install_lib.py", line 107, in build self.run_command('build_ext') File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/build_ext.py", line 316, in run self.build_extensions() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 448, in build_extensions self._build_extensions_serial() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 473, in _build_extensions_serial self.build_extension(ext) File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/build_ext.py", line 380, in build_extension extra_cflags = ext.extra_c_compile_args or [] AttributeError: 'Extension' object has no attribute 'extra_c_compile_args' ``` ``` ### NumPy/Python version information: numpy 1.22.x
That's probably on me, I'll have a look this week end.
2022-01-29T01:03:19Z
[]
[]
Traceback (most recent call last): File "/usr/local/src/Assimulo-Assimulo-3.2.9/setup.py", line 691, in <module> ndc.setup(name=NAME, File "/usr/local/lib/python3.9/site-packages/numpy/distutils/core.py", line 169, in setup return old_setup(**new_attr) File "/usr/local/lib/python3.9/site-packages/setuptools/__init__.py", line 155, in setup return distutils.core.setup(**attrs) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 148, in setup return run_commands(dist) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 163, in run_commands dist.run_commands() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands self.run_command(cmd) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/install.py", line 60, in run r = self.setuptools_run() File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/install.py", line 54, in setuptools_run self.do_egg_install() File "/usr/local/lib/python3.9/site-packages/setuptools/command/install.py", line 116, in do_egg_install self.run_command('bdist_egg') File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/setuptools/command/bdist_egg.py", line 164, in run cmd = self.call_command('install_lib', warn_dir=0) File "/usr/local/lib/python3.9/site-packages/setuptools/command/bdist_egg.py", line 150, in call_command self.run_command(cmdname) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/setuptools/command/install_lib.py", line 11, in run self.build() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/install_lib.py", line 107, in build self.run_command('build_ext') File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 986, in run_command cmd_obj.run() File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/build_ext.py", line 316, in run self.build_extensions() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 448, in build_extensions self._build_extensions_serial() File "/usr/local/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 473, in _build_extensions_serial self.build_extension(ext) File "/usr/local/lib/python3.9/site-packages/numpy/distutils/command/build_ext.py", line 380, in build_extension extra_cflags = ext.extra_c_compile_args or [] AttributeError: 'Extension' object has no attribute 'extra_c_compile_args'
10,086
numpy/numpy
numpy__numpy-21151
4526ff430df7ac07e66af90eadab176ec89e108f
diff --git a/numpy/core/_type_aliases.py b/numpy/core/_type_aliases.py --- a/numpy/core/_type_aliases.py +++ b/numpy/core/_type_aliases.py @@ -172,7 +172,7 @@ def _set_up_aliases(): allTypes[alias] = allTypes[t] sctypeDict[alias] = sctypeDict[t] # Remove aliases overriding python types and modules - to_remove = ['ulong', 'object', 'int', 'float', + to_remove = ['object', 'int', 'float', 'complex', 'bool', 'string', 'datetime', 'timedelta', 'bytes', 'str'] @@ -182,6 +182,15 @@ def _set_up_aliases(): del sctypeDict[t] except KeyError: pass + + # Additional aliases in sctypeDict that should not be exposed as attributes + attrs_to_remove = ['ulong'] + + for t in attrs_to_remove: + try: + del allTypes[t] + except KeyError: + pass _set_up_aliases() diff --git a/numpy/typing/_char_codes.py b/numpy/typing/_char_codes.py --- a/numpy/typing/_char_codes.py +++ b/numpy/typing/_char_codes.py @@ -30,7 +30,7 @@ _UShortCodes = Literal["ushort", "H", "=H", "<H", ">H"] _UIntCCodes = Literal["uintc", "I", "=I", "<I", ">I"] _UIntPCodes = Literal["uintp", "uint0", "P", "=P", "<P", ">P"] -_UIntCodes = Literal["uint", "L", "=L", "<L", ">L"] +_UIntCodes = Literal["ulong", "uint", "L", "=L", "<L", ">L"] _ULongLongCodes = Literal["ulonglong", "Q", "=Q", "<Q", ">Q"] _HalfCodes = Literal["half", "e", "=e", "<e", ">e"]
`np.dytpe("ulong")` is missing It appears that NumPy doesn't define a scalar type `numpy.ulong`. This seems like a conspicuous omission -- given that the library exports many similar types such as `long` and `ulonglong`, I assumed that `ulong` would be a valid type. Similarly, the following code snippet fails: ```python >>> import numpy as np >>> np.dtype("ulong") Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: data type 'ulong' not understood ``` Is this a deliberate omission? I wasn't able to find any info about it. Is there any reason why we couldn't (or shouldn't) add `numpy.ulong` as an alias for `numpy.uint`?
Looks like an accidental omission. @seberg Thoughts? I suppose it exists as `uint` (I know, I know, weird but `uintc` is the actual unsigned int). But yea, we have `long` and that is useful for C analogy, so I agree with adding the alias. `np.long` doesn't exist any more, does it? I suppose we should still allow it as a dtype string, but exposing it globally is likely going to set downstream users up for breakage who are used to `np.long is int`. It appears that numpy.ulong is not defined deliberately. @seberg @eric-wieser Should we close this issue? @InessaPawson yes, `np.ulong` is deliberate. But it would be fine to support `np.dtype("ulong")` since `np.dtype("long")` exists. (Not particularly high priority, but I would be in favor of merging such a PR/proposal – it is a simple change the only tricky part is finding where to change it.) >it is a simple change the only tricky part is finding where to change it I'd be happy to contribute a PR, but this is the issue I ran into. I can't find where in the codebase to make the necessary modification(s)! Could you point me in the right direction? Otherwise, I'll just leave it up to the more experienced contributors. @gmgunter it is a bit confusing/weird, but basically, that is the dictionary that does the mapping: https://github.com/numpy/numpy/blob/eeef9d4646103c3b1afd3085f1393f2b3f9575b2/numpy/core/_type_aliases.py#L26 and the code that fills it should be somewhere in the same file.
2022-03-05T04:52:29Z
[]
[]
Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: data type 'ulong' not understood
10,093
numpy/numpy
numpy__numpy-21256
beb5dedf78b96183906ec9e979ef83bb040b7b78
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py --- a/numpy/f2py/crackfortran.py +++ b/numpy/f2py/crackfortran.py @@ -2689,7 +2689,7 @@ def solve_v(s, a=a, b=b): n_checks = [] n_is_input = l_or(isintent_in, isintent_inout, isintent_inplace)(vars[n]) - if 'dimension' in vars[n]: # n is array + if isarray(vars[n]): # n is array for i, d in enumerate(vars[n]['dimension']): coeffs_and_deps = dimension_exprs.get(d) if coeffs_and_deps is None: @@ -2700,6 +2700,13 @@ def solve_v(s, a=a, b=b): # may define variables used in dimension # specifications. for v, (solver, deps) in coeffs_and_deps.items(): + def compute_deps(v, deps): + for v1 in coeffs_and_deps.get(v, [None, []])[1]: + if v1 not in deps: + deps.add(v1) + compute_deps(v1, deps) + all_deps = set() + compute_deps(v, all_deps) if ((v in n_deps or '=' in vars[v] or 'depend' in vars[v])): @@ -2708,7 +2715,7 @@ def solve_v(s, a=a, b=b): # - has user-defined initialization expression # - has user-defined dependencies continue - if solver is not None: + if solver is not None and v not in all_deps: # v can be solved from d, hence, we # make it an optional argument with # initialization expression:
BUG: [Regression 1.21.4 -> 1.22.0] f2py cannot handle negative bounds as arguments anymore ### Describe the issue: The following works fine in NumPy < 1.22, but fails in 1.22.0 and 1.22.1. Looks related to #20709. Fortran code: ```fortran subroutine foo(is_,ie_,arr) implicit none integer :: is_,ie_ real*8 :: arr(is_:ie_) end ``` Compile via f2py: ```bash $ f2py -c f2py_bug.f90 ``` Try to execute with negative bounds: ```bash $ python -c "import untitled, numpy; arr = numpy.ones(12); untitled.foo(is_=-1, ie_=10, arr=arr)" Traceback (most recent call last): File "<string>", line 1, in <module> untitled.error: (shape(arr, 0) == 1 + ie_ - is_) failed for 2nd keyword ie_: foo:ie_=10 ``` Works with positive bounds (but gives wrong results in my case): ```bash $ python -c "import untitled, numpy; arr = numpy.ones(12); untitled.foo(is_=0, ie_=11, arr=arr)" # no exception ``` ### Reproduce the code example: ```python (see above) ``` ### Error message: _No response_ ### NumPy/Python version information: 1.22.1 3.9.9 (main, Nov 21 2021, 03:23:44) [Clang 13.0.0 (clang-1300.0.29.3)]
Even in the second case, we get ``` sortvarnames: failed to compute dependencies because of cyclic dependencies between ie_, is_ ``` If I generate the pyf file, the result for NumPy 1.21.4 is <details> ``` ! -*- f90 -*- ! Note: the context of this file is case sensitive. python module f2py_bug ! in interface ! in :f2py_bug subroutine foo(is_,ie_,arr) ! in :f2py_bug:f2py_bug.f90 integer intent(in) :: is_ integer intent(in) :: ie_ real*8 dimension(ie_-is_+1),intent(inout),depend(is_,ie_) :: arr end subroutine foo end interface end python module f2py_bug ! This file was auto-generated with f2py (version:1.21.4). ! See http://cens.ioc.ee/projects/f2py2e/ ``` </details> and for NumPy 1.22 and above, the result is <details> ``` ! -*- f90 -*- ! Note: the context of this file is case sensitive. python module f2py_bug ! in interface ! in :f2py_bug subroutine foo(is_,ie_,arr) ! in :f2py_bug:f2py_bug.f90 integer, optional,intent(in),check(shape(arr, 0) == 1 + ie_ - is_),depend(arr,ie_) :: is_=(-1 - ie_ + shape(arr, 0)) / (-1) integer, optional,intent(in),check(shape(arr, 0) == 1 + ie_ - is_),depend(is_,arr) :: ie_=-1 + is_ + shape(arr, 0) real*8 dimension(1 + ie_ - is_),intent(inout) :: arr end subroutine foo end interface end python module f2py_bug ! This file was auto-generated with f2py (version:1.23.0.dev0+460.gc30876f64). ! See: ! https://web.archive.org/web/20140822061353/http://cens.ioc.ee/projects/f2py2e ``` </details> A workaround is to generate the pyf file first and then edit it to read as it would do for NumPy 1.21.4, finally do ``` $ f2py -c f2py_bug.f90 f2py_bug.pyf ``` and it should work. I'll investigate a solution. After taking a closer look it looks like this is a side effect of the new solver for array dimensions. In fact, because the intent for `arr` is not specified, it is assumed to be `intent(in)` and this causes [checks to be triggered to make sure the bounds on the array are consistent](https://github.com/numpy/numpy/blob/c900978d5e572d96ccacaa97af28e2c5f4a0b137/numpy/f2py/crackfortran.py#L2683). In this case, using, for example, `intent(out)` for `arr` solves the issue. @dionhaefner can you confirm if this solves the issue for you or if you expect something different to happen? Thanks! @melissawm thanks for investigating, but I don't quite understand the proposed solution. First of all, this comes from a Fortran code that I don't have control over, and it used to work fine until recently. Secondly, the actual intent *is* `intent(in)`. So we're back to the same issue with this modified snippet: ```fortran subroutine foo(is_,ie_,arr) implicit none integer :: is_,ie_ real*8, intent(in) :: arr(is_:ie_) end ``` Running this through ```bash $ f2py -m f2py_bug f2py_bug.py ``` I get the following C code: ```c static PyObject *f2py_rout_f2py_bug_foo(const PyObject *capi_self, PyObject *capi_args, PyObject *capi_keywds, void (*f2py_func)(int*,int*,double*)) { PyObject * volatile capi_buildvalue = NULL; volatile int f2py_success = 1; /*decl*/ int is_ = 0; /* <---- is_ is initialized to 0 */ PyObject *is__capi = Py_None; int ie_ = 0; /* <---- ie_ is initialized to 0 */ PyObject *ie__capi = Py_None; /* ... <snip> ... */ /*frompyobj*/ /* Processing variable arr */ ; capi_arr_intent |= F2PY_INTENT_IN; capi_arr_tmp = array_from_pyobj(NPY_DOUBLE,arr_Dims,arr_Rank,capi_arr_intent,arr_capi); if (capi_arr_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : f2py_bug_error,"failed in converting 1st argument `arr' of f2py_bug.foo to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { arr = (double *)(PyArray_DATA(capi_arr_tmp)); /* Processing variable ie_ */ if (ie__capi == Py_None) ie_ = -1 + is_ + shape(arr, 0); else f2py_success = int_from_pyobj(&ie_,ie__capi,"f2py_bug.foo() 2nd keyword (ie_) can't be converted to int"); if (f2py_success) { /* !!! this is what fails !!! */ CHECKSCALAR(shape(arr, 0) == 1 + ie_ - is_,"shape(arr, 0) == 1 + ie_ - is_","2nd keyword ie_","foo:ie_=%d",ie_) { /* Processing variable is_ */ if (is__capi == Py_None) is_ = (-1 - ie_ + shape(arr, 0)) / (-1); else f2py_success = int_from_pyobj(&is_,is__capi,"f2py_bug.foo() 1st keyword (is_) can't be converted to int"); if (f2py_success) { CHECKSCALAR(shape(arr, 0) == 1 + ie_ - is_,"shape(arr, 0) == 1 + ie_ - is_","1st keyword is_","foo:is_=%d",is_) { /*end of frompyobj*/ ``` The problem is that `is_` and `ie_` are initialized to 0, but are then read and consistency checked *one by one*. So when `ie_` is checked, `is_` is still 0 because `int_from_pyobj` has not been called on it yet. I assume that f2py is trying to circumvent problems like these with the `depend` keyword, but since this is a circular dependency it doesn't work. Is there anything that speaks against converting all arguments to C objects first before calling the checks? @pearu Thoughts? I'm also seeing something I suspect is related to this, at least I also see the "failed to compute dependencies because of cyclic dependencies" message before later getting a RecursionError in _get_depend_dict while in the same Block. I could not successfully isolate a failing MWE out of my codebase :-/, so I'll try again after this bug is fixed. We discussed this today at an F2PY meeting and decided that the problem is indeed with the solver for the check. In this situation none of the check statements should be generated since all the values are valid within the subroutine. 1. Disable check generation 2. Extend solver to deal with cyclic dependencies (general extension)
2022-03-27T17:52:04Z
[]
[]
Traceback (most recent call last): File "<string>", line 1, in <module> untitled.error: (shape(arr, 0) == 1 + ie_ - is_) failed for 2nd keyword ie_: foo:ie_=10
10,099
numpy/numpy
numpy__numpy-21890
b0b523ec0980e46ca735ce96c7c976c4fdd28424
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py --- a/numpy/f2py/crackfortran.py +++ b/numpy/f2py/crackfortran.py @@ -2191,7 +2191,7 @@ def analyzebody(block, args, tab=''): as_ = args b = postcrack(b, as_, tab=tab + '\t') if b['block'] in ['interface', 'abstract interface'] and \ - not b['body'] and not b['implementedby']: + not b['body'] and not b.get('implementedby'): if 'f2pyenhancements' not in b: continue if b['block'].replace(' ', '') == 'pythonmodule':
BUG: f2py crackfortran: missing dict key 'implementedby' ### Describe the issue: We have a user report at https://github.com/python-control/Slycot/issues/177 who tried to build Slycot with NumPy 1.23.0 which fails with the f2py error below. Using a system NumPy 1.21.5 or `pip install 'numpy<1.23.0' scikit-build; pip install -v --no-build-isolation slycot` does not throw the error. ### Reproduce the code example: ```python docker container run -it ubuntu bash # in docker container: apt update apt install python3 python3-dev gcc gfortran libopenblas-dev python3-pip cmake pip install -v slycot ``` ### Error message: ```shell Traceback (most recent call last): File "/usr/local/bin/f2py3", line 8, in <module> sys.exit(main()) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 704, in main run_main(sys.argv[1:]) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 441, in run_main postlist = callcrackfortran(files, options) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 342, in callcrackfortran postlist = crackfortran.crackfortran(files) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 3265, in crackfortran postlist = postcrack(grouplist[0]) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 1967, in postcrack g = postcrack(g, tab=tab + '\t') File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 1986, in postcrack block['body'] = analyzebody(block, args, tab=tab) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 2150, in analyzebody not b['body'] and not b['implementedby']: KeyError: 'implementedby' gmake[2]: *** [slycot/CMakeFiles/_wrapper.dir/build.make:79: slycot/_wrappermodule.c] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:170: slycot/CMakeFiles/_wrapper.dir/all] Error 2 gmake: *** [Makefile:136: all] Error 2 ``` ### NumPy/Python version information: 1.23.0 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0]
Failing line is here: https://github.com/numpy/numpy/blob/f9bed20bffd88bce06dbc8be200179edfe7580a4/numpy/f2py/crackfortran.py#L2194 The only assignment is here which was apparently not called in our case of scikit-build using f2py: https://github.com/numpy/numpy/blob/f9bed20bffd88bce06dbc8be200179edfe7580a4/numpy/f2py/crackfortran.py#L1273 @pearu @HaoZeke Thoughts? Thanks for the report! Introduced in https://github.com/numpy/numpy/commit/753a146a3e1b91ebe383dac7452bc6f3697fac44 for a different use-case completely, this ought to be an easy fix, adding the key should be enough (since `operator()` isn't used in Slycot)
2022-06-30T17:10:48Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/f2py3", line 8, in <module> sys.exit(main()) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 704, in main run_main(sys.argv[1:]) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 441, in run_main postlist = callcrackfortran(files, options) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 342, in callcrackfortran postlist = crackfortran.crackfortran(files) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 3265, in crackfortran postlist = postcrack(grouplist[0]) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 1967, in postcrack g = postcrack(g, tab=tab + '\t') File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 1986, in postcrack block['body'] = analyzebody(block, args, tab=tab) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 2150, in analyzebody not b['body'] and not b['implementedby']: KeyError: 'implementedby' gmake[2]: *** [slycot/CMakeFiles/_wrapper.dir/build.make:79: slycot/_wrappermodule.c] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:170: slycot/CMakeFiles/_wrapper.dir/all] Error 2 gmake: *** [Makefile:136: all] Error 2 ``` ### NumPy/Python version information: 1.23.0 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0]
10,116
numpy/numpy
numpy__numpy-21952
00f59f633402b8d31261cc75f42a8986add89659
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py --- a/numpy/f2py/crackfortran.py +++ b/numpy/f2py/crackfortran.py @@ -2147,7 +2147,7 @@ def analyzebody(block, args, tab=''): as_ = args b = postcrack(b, as_, tab=tab + '\t') if b['block'] in ['interface', 'abstract interface'] and \ - not b['body'] and not b['implementedby']: + not b['body'] and not b.get('implementedby'): if 'f2pyenhancements' not in b: continue if b['block'].replace(' ', '') == 'pythonmodule':
BUG: f2py crackfortran: missing dict key 'implementedby' ### Describe the issue: We have a user report at https://github.com/python-control/Slycot/issues/177 who tried to build Slycot with NumPy 1.23.0 which fails with the f2py error below. Using a system NumPy 1.21.5 or `pip install 'numpy<1.23.0' scikit-build; pip install -v --no-build-isolation slycot` does not throw the error. ### Reproduce the code example: ```python docker container run -it ubuntu bash # in docker container: apt update apt install python3 python3-dev gcc gfortran libopenblas-dev python3-pip cmake pip install -v slycot ``` ### Error message: ```shell Traceback (most recent call last): File "/usr/local/bin/f2py3", line 8, in <module> sys.exit(main()) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 704, in main run_main(sys.argv[1:]) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 441, in run_main postlist = callcrackfortran(files, options) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 342, in callcrackfortran postlist = crackfortran.crackfortran(files) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 3265, in crackfortran postlist = postcrack(grouplist[0]) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 1967, in postcrack g = postcrack(g, tab=tab + '\t') File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 1986, in postcrack block['body'] = analyzebody(block, args, tab=tab) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 2150, in analyzebody not b['body'] and not b['implementedby']: KeyError: 'implementedby' gmake[2]: *** [slycot/CMakeFiles/_wrapper.dir/build.make:79: slycot/_wrappermodule.c] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:170: slycot/CMakeFiles/_wrapper.dir/all] Error 2 gmake: *** [Makefile:136: all] Error 2 ``` ### NumPy/Python version information: 1.23.0 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0]
Failing line is here: https://github.com/numpy/numpy/blob/f9bed20bffd88bce06dbc8be200179edfe7580a4/numpy/f2py/crackfortran.py#L2194 The only assignment is here which was apparently not called in our case of scikit-build using f2py: https://github.com/numpy/numpy/blob/f9bed20bffd88bce06dbc8be200179edfe7580a4/numpy/f2py/crackfortran.py#L1273 @pearu @HaoZeke Thoughts? Thanks for the report! Introduced in https://github.com/numpy/numpy/commit/753a146a3e1b91ebe383dac7452bc6f3697fac44 for a different use-case completely, this ought to be an easy fix, adding the key should be enough (since `operator()` isn't used in Slycot)
2022-07-08T16:09:51Z
[]
[]
Traceback (most recent call last): File "/usr/local/bin/f2py3", line 8, in <module> sys.exit(main()) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 704, in main run_main(sys.argv[1:]) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 441, in run_main postlist = callcrackfortran(files, options) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/f2py2e.py", line 342, in callcrackfortran postlist = crackfortran.crackfortran(files) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 3265, in crackfortran postlist = postcrack(grouplist[0]) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 1967, in postcrack g = postcrack(g, tab=tab + '\t') File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 1986, in postcrack block['body'] = analyzebody(block, args, tab=tab) File "/tmp/pip-build-env-ve213n4q/overlay/local/lib/python3.10/dist-packages/numpy/f2py/crackfortran.py", line 2150, in analyzebody not b['body'] and not b['implementedby']: KeyError: 'implementedby' gmake[2]: *** [slycot/CMakeFiles/_wrapper.dir/build.make:79: slycot/_wrappermodule.c] Error 1 gmake[1]: *** [CMakeFiles/Makefile2:170: slycot/CMakeFiles/_wrapper.dir/all] Error 2 gmake: *** [Makefile:136: all] Error 2 ``` ### NumPy/Python version information: 1.23.0 3.10.4 (main, Apr 2 2022, 09:04:19) [GCC 11.2.0]
10,118
numpy/numpy
numpy__numpy-22014
5ba36b700284a8392af5be542f65ecd262fd2568
diff --git a/numpy/random/_pickle.py b/numpy/random/_pickle.py --- a/numpy/random/_pickle.py +++ b/numpy/random/_pickle.py @@ -14,19 +14,19 @@ } -def __generator_ctor(bit_generator_name='MT19937'): +def __bit_generator_ctor(bit_generator_name='MT19937'): """ - Pickling helper function that returns a Generator object + Pickling helper function that returns a bit generator object Parameters ---------- bit_generator_name : str - String containing the core BitGenerator + String containing the name of the BitGenerator Returns ------- - rg : Generator - Generator using the named core BitGenerator + bit_generator : BitGenerator + BitGenerator instance """ if bit_generator_name in BitGenerators: bit_generator = BitGenerators[bit_generator_name] @@ -34,50 +34,47 @@ def __generator_ctor(bit_generator_name='MT19937'): raise ValueError(str(bit_generator_name) + ' is not a known ' 'BitGenerator module.') - return Generator(bit_generator()) + return bit_generator() -def __bit_generator_ctor(bit_generator_name='MT19937'): +def __generator_ctor(bit_generator_name="MT19937", + bit_generator_ctor=__bit_generator_ctor): """ - Pickling helper function that returns a bit generator object + Pickling helper function that returns a Generator object Parameters ---------- bit_generator_name : str - String containing the name of the BitGenerator + String containing the core BitGenerator's name + bit_generator_ctor : callable, optional + Callable function that takes bit_generator_name as its only argument + and returns an instantized bit generator. Returns ------- - bit_generator : BitGenerator - BitGenerator instance + rg : Generator + Generator using the named core BitGenerator """ - if bit_generator_name in BitGenerators: - bit_generator = BitGenerators[bit_generator_name] - else: - raise ValueError(str(bit_generator_name) + ' is not a known ' - 'BitGenerator module.') - - return bit_generator() + return Generator(bit_generator_ctor(bit_generator_name)) -def __randomstate_ctor(bit_generator_name='MT19937'): +def __randomstate_ctor(bit_generator_name="MT19937", + bit_generator_ctor=__bit_generator_ctor): """ Pickling helper function that returns a legacy RandomState-like object Parameters ---------- bit_generator_name : str - String containing the core BitGenerator + String containing the core BitGenerator's name + bit_generator_ctor : callable, optional + Callable function that takes bit_generator_name as its only argument + and returns an instantized bit generator. Returns ------- rs : RandomState Legacy RandomState using the named core BitGenerator """ - if bit_generator_name in BitGenerators: - bit_generator = BitGenerators[bit_generator_name] - else: - raise ValueError(str(bit_generator_name) + ' is not a known ' - 'BitGenerator module.') - return RandomState(bit_generator()) + return RandomState(bit_generator_ctor(bit_generator_name))
BUG: np.random.Generator cannot be unpickled using 3rd party bit generators ### Describe the issue: The unpickling mechanism uses a hard-coded list of bit generators when unpickling a generator instance. Because of this, it cannot be used with 3rd party bit generators, or, if the name of the 3rd party bit generator is the same as the NumPy bit generator, it will unpickle using a different class than the original bit generator class ### Reproduce the code example: ```python import numpy as np import randomgen as rg import pickle # Generator(MT64) g = np.random.Generator(rg.MT64()) pickle.loads(pickle.dumps(g)) ``` ### Error message: ```shell Traceback (most recent call last): File "C:\git\randomgen\exp.py", line 7, in <module> pickle.loads(pickle.dumps(g)) File "c:\git\numpy\numpy\random\_pickle.py", line 52, in __generator_ctor raise ValueError( ValueError: MT64 is not a known NumPy BitGenerator class. ``` ### NumPy/Python version information: 1.24.0.dev0+559.g5ba36b700 3.10.4 | packaged by conda-forge | (main, Mar 30 2022, 08:38:02) [MSC v.1916 64 bit (AMD64)]
# Possible Solutions ## Let 3rd parts register bit generators Provide an official mechanism to add bit generators to the lookup table (a dict) so that the current infrastructure could be extended. ### Advantages * Continues to use same mechanism that has been around forever ### Disadvantages * Could have name conflicts with existing modules in look up table, unless protected * Requires explicit action by end users or library writers on module import * Adds to API Something like ```python np.random.register_bit_generator(bitgen: BitGenerator, name: Optional[str] = None): """ Register a bit generator for pickling/unpickling Parameters ---------- bitgen : Bit Generator The bit generator to register name : str, optional The name to use in the look up table. If not provided, bitgen.__name__ is used """ ``` ## Support looking up fully qualified names Let 3rd party bit generators name them selves using the pattern `module.class` so that the constructor can use `importlib` ### Advantages * Totally transparent * No API space * Name guaranteed to be unique ### Disadvantages * Hard to test * Requires 3rd parties to use a specific pattern (pretty minor IMO) * Requires a FQN, so unlikely to work with locally defined classes (but usually a problem for pickle) Something like ```python def __generator_ctor(bit_generator_name:str='MT19937') -> Generator: """ Pickling helper function that returns a Generator object Parameters ---------- bit_generator_name : str String containing the core BitGenerator. Can also be the full path (module.class) of a third-party bit generator. Returns ------- rg : Generator Generator using the named core BitGenerator """ bit_generator: Optional[Type[BitGenerator]] = None if bit_generator_name in BitGenerators: bit_generator = BitGenerators[bit_generator_name] elif "." in bit_generator_name: parts = bit_generator_name.split(".") mod_name = ".".join(parts[:-1]) bit_generator_name = parts[-1] import importlib try: mod = importlib.import_module(mod_name) bit_generator = getattr(mod, bit_generator_name, None) except ImportError: pass if bit_generator is None: raise ValueError( f"{bit_generator_name} is not a known NumPy BitGenerator class " f"and cannot be looked up using it's fully qualified name." ) assert bit_generator is not None return Generator(bit_generator()) ```
2022-07-19T14:24:24Z
[]
[]
Traceback (most recent call last): File "C:\git\randomgen\exp.py", line 7, in <module> pickle.loads(pickle.dumps(g)) File "c:\git\numpy\numpy\random\_pickle.py", line 52, in __generator_ctor raise ValueError( ValueError: MT64 is not a known NumPy BitGenerator class.
10,126
numpy/numpy
numpy__numpy-22372
25ed0312cfbbddb60aa8f1491248f03f9eca5caa
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -1085,8 +1085,13 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, comment. None implies no comments. For backwards compatibility, byte strings will be decoded as 'latin1'. The default is '#'. delimiter : str, optional - The string used to separate values. For backwards compatibility, byte - strings will be decoded as 'latin1'. The default is whitespace. + The character used to separate the values. For backwards compatibility, + byte strings will be decoded as 'latin1'. The default is whitespace. + + .. versionchanged:: 1.23.0 + Only single character delimiters are supported. Newline characters + cannot be used as the delimiter. + converters : dict or callable, optional Converter functions to customize value parsing. If `converters` is callable, the function is applied to all columns, else it must be a
seems that from 1.23 the 'delimiter' option of loadtxt require single unicode character ### Describe the issue: It seems that starting from 1.23 the 'delimiter' option of loadtxt requires a single unicode character where a random string was allowed before (and the doc of 1.23 doesn't tell about this new behavior) So, when running code that worked fine up before 1.23, we get the error whose stack trace is below. ### Reproduce the code example: ```python import numpy as np np.loadtxt(pos_file,comments="@",delimiter="val=",usecols=(0,)) where the text file is something like: ------ field1val=12val=13val=14 field2val=22val=23val=24 ------ ``` ### Error message: ```shell Traceback (most recent call last): File "", line 114, in <module> pos_data = np.loadtxt(pos_file,comments="@",delimiter="val=",usecols=(0,)) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/lib/npyio.py", line 1313, in loadtxt arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter, File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/lib/npyio.py", line 979, in _read arr = _load_from_filelike( TypeError: Text reading control character must be a single unicode character or None; but got: 'val=' ``` ### NumPy/Python version information: 1.23.0 ### Context for the issue: j
Thanks for reporting. `loadtxt` was re-written in C for 1.23 which resulted in a few breaks with the previous behavior. While the multi-char delimiter is not possible in 1.23, you may be able to work around this using converters, for example: ```python >>> txt = io.StringIO("field1val=12val=13val=14\nfield2val=22val=23val=24") # example from OP >>> conv = lambda s: s.removesuffix("val").removeprefix("field") >>> np.loadtxt(txt, delimiter="=", converters=conv, encoding=None) array([[ 1., 12., 13., 14.], [ 2., 22., 23., 24.]]) ``` Hi Ross thank you for your reply. I thought this was a bug because the documentation for 1.23 doesn't talk about the new single char restriction. It still tells "str" regards david > On 20 Sep 2022, at 00:53, Ross Barnowski ***@***.***> wrote: > >  > Thanks for reporting. loadtxt was re-written in C for 1.23 which resulted in a few breaks with the previous behavior. > > While the multi-char delimiter is not possible in 1.23, you may be able to work around this using converters, for example: > > >>> txt = io.StringIO("field1val=12val=13val=14\nfield2val=22val=23val=24") # example from OP > >>> conv = lambda s: s.removesuffix("val").removeprefix("field") > >>> np.loadtxt(txt, delimiter="=", converters=conv, encoding=None) > array([[ 1., 12., 13., 14.], > [ 2., 22., 23., 24.]]) > — > Reply to this email directly, view it on GitHub, or unsubscribe. > You are receiving this because you authored the thread. Not a fix but another work around would be to use `np.genfromtxt` in general it has very similar functionality to `np.loadtxt`.
2022-10-03T17:27:39Z
[]
[]
Traceback (most recent call last): File "", line 114, in <module> pos_data = np.loadtxt(pos_file,comments="@",delimiter="val=",usecols=(0,)) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/lib/npyio.py", line 1313, in loadtxt arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter, File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/lib/npyio.py", line 979, in _read arr = _load_from_filelike( TypeError: Text reading control character must be a single unicode character or None; but got: 'val='
10,133
numpy/numpy
numpy__numpy-22391
dbbf06aab54f803fb4560048d305ea182311f9b2
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -1087,8 +1087,13 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, comment. None implies no comments. For backwards compatibility, byte strings will be decoded as 'latin1'. The default is '#'. delimiter : str, optional - The string used to separate values. For backwards compatibility, byte - strings will be decoded as 'latin1'. The default is whitespace. + The character used to separate the values. For backwards compatibility, + byte strings will be decoded as 'latin1'. The default is whitespace. + + .. versionchanged:: 1.23.0 + Only single character delimiters are supported. Newline characters + cannot be used as the delimiter. + converters : dict or callable, optional A function to parse all columns strings into the desired value, or a dictionary mapping column number to a parser function.
seems that from 1.23 the 'delimiter' option of loadtxt require single unicode character ### Describe the issue: It seems that starting from 1.23 the 'delimiter' option of loadtxt requires a single unicode character where a random string was allowed before (and the doc of 1.23 doesn't tell about this new behavior) So, when running code that worked fine up before 1.23, we get the error whose stack trace is below. ### Reproduce the code example: ```python import numpy as np np.loadtxt(pos_file,comments="@",delimiter="val=",usecols=(0,)) where the text file is something like: ------ field1val=12val=13val=14 field2val=22val=23val=24 ------ ``` ### Error message: ```shell Traceback (most recent call last): File "", line 114, in <module> pos_data = np.loadtxt(pos_file,comments="@",delimiter="val=",usecols=(0,)) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/lib/npyio.py", line 1313, in loadtxt arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter, File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/lib/npyio.py", line 979, in _read arr = _load_from_filelike( TypeError: Text reading control character must be a single unicode character or None; but got: 'val=' ``` ### NumPy/Python version information: 1.23.0 ### Context for the issue: j
Thanks for reporting. `loadtxt` was re-written in C for 1.23 which resulted in a few breaks with the previous behavior. While the multi-char delimiter is not possible in 1.23, you may be able to work around this using converters, for example: ```python >>> txt = io.StringIO("field1val=12val=13val=14\nfield2val=22val=23val=24") # example from OP >>> conv = lambda s: s.removesuffix("val").removeprefix("field") >>> np.loadtxt(txt, delimiter="=", converters=conv, encoding=None) array([[ 1., 12., 13., 14.], [ 2., 22., 23., 24.]]) ``` Hi Ross thank you for your reply. I thought this was a bug because the documentation for 1.23 doesn't talk about the new single char restriction. It still tells "str" regards david > On 20 Sep 2022, at 00:53, Ross Barnowski ***@***.***> wrote: > >  > Thanks for reporting. loadtxt was re-written in C for 1.23 which resulted in a few breaks with the previous behavior. > > While the multi-char delimiter is not possible in 1.23, you may be able to work around this using converters, for example: > > >>> txt = io.StringIO("field1val=12val=13val=14\nfield2val=22val=23val=24") # example from OP > >>> conv = lambda s: s.removesuffix("val").removeprefix("field") > >>> np.loadtxt(txt, delimiter="=", converters=conv, encoding=None) > array([[ 1., 12., 13., 14.], > [ 2., 22., 23., 24.]]) > — > Reply to this email directly, view it on GitHub, or unsubscribe. > You are receiving this because you authored the thread. Not a fix but another work around would be to use `np.genfromtxt` in general it has very similar functionality to `np.loadtxt`.
2022-10-06T00:13:42Z
[]
[]
Traceback (most recent call last): File "", line 114, in <module> pos_data = np.loadtxt(pos_file,comments="@",delimiter="val=",usecols=(0,)) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/lib/npyio.py", line 1313, in loadtxt arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter, File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/lib/npyio.py", line 979, in _read arr = _load_from_filelike( TypeError: Text reading control character must be a single unicode character or None; but got: 'val='
10,136
numpy/numpy
numpy__numpy-22561
9a6d956b273fe8f4d3ecd1d1f08f8a1c2e4edc06
diff --git a/numpy/lib/histograms.py b/numpy/lib/histograms.py --- a/numpy/lib/histograms.py +++ b/numpy/lib/histograms.py @@ -970,7 +970,7 @@ def histogramdd(sample, bins=10, range=None, density=None, weights=None): sample = np.atleast_2d(sample).T N, D = sample.shape - nbin = np.empty(D, int) + nbin = np.empty(D, np.intp) edges = D*[None] dedges = D*[None] if weights is not None:
BUG: Histogramdd breaks on big arrays in Windows ### Describe the issue: numpy.histogramdd fails with large arrays on Windows 10 64-bit. This is likely due to a bizarre behavior on Windows64 where the default integer dtype returns as int32 causing numpy.prod to overflow ### Reproduce the code example: ```python >>> import numpy as np >>> sample = np.zeros([100000000, 3]) >>> xbins = 400 >>> ybins = 400 >>> zbins = np.arange(16000) >>> hist = np.histogramdd(sample=sample, bins=(xbins, ybins, zbins)) ``` ### Error message: ```shell Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<__array_function__ internals>", line 180, in histogramdd File "C:\Users\stephanies\AppData\Local\Continuum\miniconda3\envs\numpy_only\lib\site-packages\numpy\lib\histograms.py", line 1095, in histogramdd hist = np.bincount(xy, weights, minlength=nbin.prod()) File "<__array_function__ internals>", line 180, in bincount ValueError: 'minlength' must not be negative ``` ### NumPy/Python version information: 1.23.3 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:29:51) [MSC v.1929 64 bit (AMD64)] ### Context for the issue: This is a platform issue preventing the generation of large histograms. The same code above works fine on a linux machine >>> import numpy as np >>> sample = np.zeros([100000000, 3]) >>> xbins = 400 >>> ybins = 400 >>> zbins = np.arange(16000) >>> hist = np.histogramdd(sample=sample, bins=(xbins, ybins, zbins)) >>> hist[0].shape (400, 400, 15999)
I think you are right about the cause. Should be easy to fix once the bad code is located. This would seem to be the culprit; I'd expect that simply changing the datatype to `np.intp` will fix the issue. https://github.com/numpy/numpy/blob/2524a53ba30c1207770a27a513eb18a33837a145/numpy/lib/histograms.py#L973
2022-11-08T18:25:08Z
[]
[]
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<__array_function__ internals>", line 180, in histogramdd File "C:\Users\stephanies\AppData\Local\Continuum\miniconda3\envs\numpy_only\lib\site-packages\numpy\lib\histograms.py", line 1095, in histogramdd hist = np.bincount(xy, weights, minlength=nbin.prod()) File "<__array_function__ internals>", line 180, in bincount ValueError: 'minlength' must not be negative
10,142
numpy/numpy
numpy__numpy-22655
8b74aa6aa3cb3830ec0fc490d8fcee29e7c2a55e
diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py --- a/numpy/core/memmap.py +++ b/numpy/core/memmap.py @@ -59,6 +59,7 @@ class memmap(ndarray): | 'r+' | Open existing file for reading and writing. | +------+-------------------------------------------------------------+ | 'w+' | Create or overwrite existing file for reading and writing. | + | | If ``mode == 'w+'`` then `shape` must also be specified. | +------+-------------------------------------------------------------+ | 'c' | Copy-on-write: assignments affect data in memory, but | | | changes are not saved to disk. The file on disk is | @@ -220,7 +221,7 @@ def __new__(subtype, filename, dtype=uint8, mode='r+', offset=0, ) from None if mode == 'w+' and shape is None: - raise ValueError("shape must be given") + raise ValueError("shape must be given if mode == 'w+'") if hasattr(filename, 'read'): f_ctx = nullcontext(filename)
DOC: memmap doc does not mention an exception regarding 'mode' and 'shape' ### Issue with current documentation: numpy.memmap raises an exception when the parameter **mode** is 'w+' and **shape** is not specified. The documentation does not mention this requirement. [Doc v1.23](https://numpy.org/doc/stable/reference/generated/numpy.memmap.html) The code is modified from the examples in the documentation. ```python import numpy as np from tempfile import mkdtemp import os.path as path filename = path.join(mkdtemp(), 'newfile.dat') fp = np.memmap(filename, dtype='float32', mode='w+') ``` ``` Traceback (most recent call last): File "...\test.py", line 9, in <module> fp = np.memmap(filename, dtype='float32', mode='w+') File "...\Python39\lib\site-packages\numpy\core\memmap.py", line 223, in __new__ raise ValueError("shape must be given") ValueError: shape must be given ``` ### Idea or request for content: A suggestion is to mention this requirement, maybe at the end of the description of the parameter **shape**. For example, appending "If mode == 'w+' then shape must be specified" to it.
can I work on this issue? Sure, everyone can. I would tend to just expand the error message a bit. It should also be a `TypeError` probably, but that part doesn't matter much. Happy to tweak the docs, but I don't think a long note is really necessary. If you want to create a file, you can't guess the size from the files size. That may be easy to miss, but I don't think pushing the point helps a lot (compared to a clearer error when you miss it). I am new to open-source contribution.do I need to change only documentation for this issue. Hello I am also new to open source contribution and would like to try and contribute. I will have a go and any feedback would be greatly appreciated!
2022-11-23T03:14:00Z
[]
[]
Traceback (most recent call last): File "...\test.py", line 9, in <module> fp = np.memmap(filename, dtype='float32', mode='w+') File "...\Python39\lib\site-packages\numpy\core\memmap.py", line 223, in __new__ raise ValueError("shape must be given") ValueError: shape must be given
10,144
numpy/numpy
numpy__numpy-22679
d4b2d4f80060285ac085ea874aceaf9fa1bfb757
diff --git a/numpy/core/setup.py b/numpy/core/setup.py --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -770,7 +770,11 @@ def get_mathlib_info(*args): # join('src', 'npymath', 'ieee754.cpp'), join('src', 'npymath', 'ieee754.c.src'), join('src', 'npymath', 'npy_math_complex.c.src'), - join('src', 'npymath', 'halffloat.c') + join('src', 'npymath', 'halffloat.c'), + # Remove this once scipy macos arm64 build correctly + # links to the arm64 npymath library, + # see gh-22673 + join('src', 'npymath', 'arm64_exports.c'), ] config.add_installed_library('npymath',
BUG: `scipy.special` import broken with numpy 1.24.0rc1 ### Describe the issue: NumPy Rc seem to break some of SciPy ? it might be a SciPy issue, but as it's the numpy RC.. I prefer to open it here. ### Reproduce the code example: ```python conda create -n rc python==3.10 conda activate rc pip install scipy numpy --pre python -c 'from scipy.spatial.distance import euclidean' ``` ### Error message: ```shell Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/spatial/__init__.py", line 111, in <module> from ._geometric_slerp import geometric_slerp File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/spatial/_geometric_slerp.py", line 9, in <module> from scipy.spatial.distance import euclidean File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/spatial/distance.py", line 121, in <module> from ..special import rel_entr File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/special/__init__.py", line 649, in <module> from . import _ufuncs ImportError: dlopen(/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/... ...scipy/special/_ufuncs.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace (_npy_asinh) ``` ### NumPy/Python version information: ``` 1.24.0rc1 3.10.0 | packaged by conda-forge | (default, Nov 20 2021, 02:27:15) [Clang 11.1.0 ] ```
Maybe due to the npmathlib changes, but I would have thought that would turn up in the scipy CI. The last line, when formatted a little differently is ``` ImportError: dlopen(<path>/python3.10/site-packages/scipy/special/_ufuncs.cpython-310-darwin.so, 0x0002): \ symbol not found in flat namespace (_npy_asinh) ``` > I would have thought that would turn up in the scipy CI. I can't find a ``--pre`` in scipy test suite, so they may not have tested the current RC ? > The last line, when formatted a little differently is I've slightly reformatted my comment to make it more readable. What scipy version are you getting? Latest, 1.9.3 ``` >>> scipy.__version__ '1.9.3' ``` I cannot replicate the error on macos_x86_64. The npy_math functions should be linked into the scipy binary, and not depend on numpy providing them: that is the whole point of using a libnpymath.a static library. On linux and on macos, I see that `nm <path>/_ufuncs.cpython-*.so |grep npy_asinh` shows it is linked into the so. Could you try that on your problematic conda environment? I can reproduce on macos_arm64. And indeed the `nm ... |grep np_asinh` shows a `U`. I wonder what is wrong with the build there. ``` $ nm /.../scipy/special/_ufuncs.cpython-310-darwin.so |grep _npy U _npy_asinh U _npy_atan2 U _npy_cabs U _npy_cexp U _npy_clog U _npy_copysign U _npy_cpow U _npy_csqrt U _npy_log1p ``` macos_arm64 scipy 1.8.0 also does not properly link the npymath symbols. On macos_x86_64, `grep "U _npy"` is empty. numpy does link in the symbols properly on macos_arm64: ``` nm <path>/_multiarray_umath.cpython-310-darwin.so|grep "_npy_a" ``` does not show any with a "U" I think the problem is [here in the scipy build](https://github.com/scipy/scipy/actions/runs/3502905555/jobs/5867603265#step:6:967). It has gotten a x86_64 version of the library: ``` ld: warning: ignoring file <path>/numpy/core/include/../lib/libnpymath.a, \ building for macOS-arm64 but attempting to link with file built for macOS-x86_64 ``` [Earlier in the log](https://github.com/scipy/scipy/actions/runs/3502905555/jobs/5867603265#step:6:279) I see it is installing numpy for x86_64. Maybe the command should have an `arch -arm64` preface or use `python -m pip` ? ``` Downloading numpy-1.23.4-cp38-cp38-macosx_10_9_x86_64.whl ``` This is for the python3.8 macos arm64 wheel. I don't see where the python3.10 macos arm64 wheel is built. @rgommers: thoughts?
2022-11-27T10:22:06Z
[]
[]
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/spatial/__init__.py", line 111, in <module> from ._geometric_slerp import geometric_slerp File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/spatial/_geometric_slerp.py", line 9, in <module> from scipy.spatial.distance import euclidean File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/spatial/distance.py", line 121, in <module> from ..special import rel_entr File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/special/__init__.py", line 649, in <module> from . import _ufuncs ImportError: dlopen(/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/...
10,146
numpy/numpy
numpy__numpy-22700
43a4319e552ec3c958e95f81c8650fe539a03879
diff --git a/numpy/core/setup.py b/numpy/core/setup.py --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -770,7 +770,11 @@ def get_mathlib_info(*args): # join('src', 'npymath', 'ieee754.cpp'), join('src', 'npymath', 'ieee754.c.src'), join('src', 'npymath', 'npy_math_complex.c.src'), - join('src', 'npymath', 'halffloat.c') + join('src', 'npymath', 'halffloat.c'), + # Remove this once scipy macos arm64 build correctly + # links to the arm64 npymath library, + # see gh-22673 + join('src', 'npymath', 'arm64_exports.c'), ] config.add_installed_library('npymath',
BUG: `scipy.special` import broken with numpy 1.24.0rc1 ### Describe the issue: NumPy Rc seem to break some of SciPy ? it might be a SciPy issue, but as it's the numpy RC.. I prefer to open it here. ### Reproduce the code example: ```python conda create -n rc python==3.10 conda activate rc pip install scipy numpy --pre python -c 'from scipy.spatial.distance import euclidean' ``` ### Error message: ```shell Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/spatial/__init__.py", line 111, in <module> from ._geometric_slerp import geometric_slerp File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/spatial/_geometric_slerp.py", line 9, in <module> from scipy.spatial.distance import euclidean File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/spatial/distance.py", line 121, in <module> from ..special import rel_entr File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/special/__init__.py", line 649, in <module> from . import _ufuncs ImportError: dlopen(/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/... ...scipy/special/_ufuncs.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace (_npy_asinh) ``` ### NumPy/Python version information: ``` 1.24.0rc1 3.10.0 | packaged by conda-forge | (default, Nov 20 2021, 02:27:15) [Clang 11.1.0 ] ```
Maybe due to the npmathlib changes, but I would have thought that would turn up in the scipy CI. The last line, when formatted a little differently is ``` ImportError: dlopen(<path>/python3.10/site-packages/scipy/special/_ufuncs.cpython-310-darwin.so, 0x0002): \ symbol not found in flat namespace (_npy_asinh) ``` > I would have thought that would turn up in the scipy CI. I can't find a ``--pre`` in scipy test suite, so they may not have tested the current RC ? > The last line, when formatted a little differently is I've slightly reformatted my comment to make it more readable. What scipy version are you getting? Latest, 1.9.3 ``` >>> scipy.__version__ '1.9.3' ``` I cannot replicate the error on macos_x86_64. The npy_math functions should be linked into the scipy binary, and not depend on numpy providing them: that is the whole point of using a libnpymath.a static library. On linux and on macos, I see that `nm <path>/_ufuncs.cpython-*.so |grep npy_asinh` shows it is linked into the so. Could you try that on your problematic conda environment? I can reproduce on macos_arm64. And indeed the `nm ... |grep np_asinh` shows a `U`. I wonder what is wrong with the build there. ``` $ nm /.../scipy/special/_ufuncs.cpython-310-darwin.so |grep _npy U _npy_asinh U _npy_atan2 U _npy_cabs U _npy_cexp U _npy_clog U _npy_copysign U _npy_cpow U _npy_csqrt U _npy_log1p ``` macos_arm64 scipy 1.8.0 also does not properly link the npymath symbols. On macos_x86_64, `grep "U _npy"` is empty. numpy does link in the symbols properly on macos_arm64: ``` nm <path>/_multiarray_umath.cpython-310-darwin.so|grep "_npy_a" ``` does not show any with a "U" I think the problem is [here in the scipy build](https://github.com/scipy/scipy/actions/runs/3502905555/jobs/5867603265#step:6:967). It has gotten a x86_64 version of the library: ``` ld: warning: ignoring file <path>/numpy/core/include/../lib/libnpymath.a, \ building for macOS-arm64 but attempting to link with file built for macOS-x86_64 ``` [Earlier in the log](https://github.com/scipy/scipy/actions/runs/3502905555/jobs/5867603265#step:6:279) I see it is installing numpy for x86_64. Maybe the command should have an `arch -arm64` preface or use `python -m pip` ? ``` Downloading numpy-1.23.4-cp38-cp38-macosx_10_9_x86_64.whl ``` This is for the python3.8 macos arm64 wheel. I don't see where the python3.10 macos arm64 wheel is built. @rgommers: thoughts?
2022-11-30T22:14:07Z
[]
[]
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/spatial/__init__.py", line 111, in <module> from ._geometric_slerp import geometric_slerp File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/spatial/_geometric_slerp.py", line 9, in <module> from scipy.spatial.distance import euclidean File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/spatial/distance.py", line 121, in <module> from ..special import rel_entr File "/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/scipy/special/__init__.py", line 649, in <module> from . import _ufuncs ImportError: dlopen(/Users/bussonniermatthias/miniforge3/envs/dl/lib/python3.10/site-packages/...
10,147
numpy/numpy
numpy__numpy-22721
f74b3720ca6148574da40ed96d4712e221ee84bd
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -3689,7 +3689,7 @@ def msort(a): return b -def _ureduce(a, func, **kwargs): +def _ureduce(a, func, keepdims=False, **kwargs): """ Internal Function. Call `func` with `a` as first argument swapping the axes to use extended @@ -3717,13 +3717,20 @@ def _ureduce(a, func, **kwargs): """ a = np.asanyarray(a) axis = kwargs.get('axis', None) + out = kwargs.get('out', None) + + if keepdims is np._NoValue: + keepdims = False + + nd = a.ndim if axis is not None: - keepdim = list(a.shape) - nd = a.ndim axis = _nx.normalize_axis_tuple(axis, nd) - for ax in axis: - keepdim[ax] = 1 + if keepdims: + if out is not None: + index_out = tuple( + 0 if i in axis else slice(None) for i in range(nd)) + kwargs['out'] = out[(Ellipsis, ) + index_out] if len(axis) == 1: kwargs['axis'] = axis[0] @@ -3736,12 +3743,27 @@ def _ureduce(a, func, **kwargs): # merge reduced axis a = a.reshape(a.shape[:nkeep] + (-1,)) kwargs['axis'] = -1 - keepdim = tuple(keepdim) else: - keepdim = (1,) * a.ndim + if keepdims: + if out is not None: + index_out = (0, ) * nd + kwargs['out'] = out[(Ellipsis, ) + index_out] r = func(a, **kwargs) - return r, keepdim + + if out is not None: + return out + + if keepdims: + if axis is None: + index_r = (np.newaxis, ) * nd + else: + index_r = tuple( + np.newaxis if i in axis else slice(None) + for i in range(nd)) + r = r[(Ellipsis, ) + index_r] + + return r def _median_dispatcher( @@ -3831,12 +3853,8 @@ def median(a, axis=None, out=None, overwrite_input=False, keepdims=False): >>> assert not np.all(a==b) """ - r, k = _ureduce(a, func=_median, axis=axis, out=out, + return _ureduce(a, func=_median, keepdims=keepdims, axis=axis, out=out, overwrite_input=overwrite_input) - if keepdims: - return r.reshape(k) - else: - return r def _median(a, axis=None, out=None, overwrite_input=False): @@ -4452,17 +4470,14 @@ def _quantile_unchecked(a, method="linear", keepdims=False): """Assumes that q is in [0, 1], and is an ndarray""" - r, k = _ureduce(a, + return _ureduce(a, func=_quantile_ureduce_func, q=q, + keepdims=keepdims, axis=axis, out=out, overwrite_input=overwrite_input, method=method) - if keepdims: - return r.reshape(q.shape + k) - else: - return r def _quantile_is_valid(q): diff --git a/numpy/lib/nanfunctions.py b/numpy/lib/nanfunctions.py --- a/numpy/lib/nanfunctions.py +++ b/numpy/lib/nanfunctions.py @@ -1214,12 +1214,9 @@ def nanmedian(a, axis=None, out=None, overwrite_input=False, keepdims=np._NoValu if a.size == 0: return np.nanmean(a, axis, out=out, keepdims=keepdims) - r, k = function_base._ureduce(a, func=_nanmedian, axis=axis, out=out, + return function_base._ureduce(a, func=_nanmedian, keepdims=keepdims, + axis=axis, out=out, overwrite_input=overwrite_input) - if keepdims and keepdims is not np._NoValue: - return r.reshape(k) - else: - return r def _nanpercentile_dispatcher( @@ -1556,17 +1553,14 @@ def _nanquantile_unchecked( # so deal them upfront if a.size == 0: return np.nanmean(a, axis, out=out, keepdims=keepdims) - r, k = function_base._ureduce(a, + return function_base._ureduce(a, func=_nanquantile_ureduce_func, q=q, + keepdims=keepdims, axis=axis, out=out, overwrite_input=overwrite_input, method=method) - if keepdims and keepdims is not np._NoValue: - return r.reshape(q.shape + k) - else: - return r def _nanquantile_ureduce_func(a, q, axis=None, out=None, overwrite_input=False, diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py --- a/numpy/ma/extras.py +++ b/numpy/ma/extras.py @@ -732,12 +732,8 @@ def median(a, axis=None, out=None, overwrite_input=False, keepdims=False): else: return m - r, k = _ureduce(a, func=_median, axis=axis, out=out, + return _ureduce(a, func=_median, keepdims=keepdims, axis=axis, out=out, overwrite_input=overwrite_input) - if keepdims: - return r.reshape(k) - else: - return r def _median(a, axis=None, out=None, overwrite_input=False):
BUG: `numpy.median()` does not respect `keepdims=True` when the `out` argument is specified ### Describe the issue: `numpy.median()` is ignoring `keepdims=True` when the `out` argument is set. If `out` has the same number of dimensions as the input, an error is raised. If `out` has the number of dimensions consistent with `keepdims=False` no error is raised. I'm happy to try and open a PR to fix this issue if we decide that this is indeed a bug. ### Reproduce the code example: ```python import numpy as np np.median(np.random.random((11, 12, 13)), axis=~0, out=np.empty((11, 12, 1)), keepdims=True) ``` ### Error message: ```shell Traceback (most recent call last): File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\IPython\core\interactiveshell.py", line 3378, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-10-a37955de53f7>", line 1, in <module> np.median(np.random.random((11, 12, 13)), axis=~0, out=np.empty((11, 12, 1)), keepdims=True) File "<__array_function__ internals>", line 180, in median File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\lib\function_base.py", line 3816, in median r, k = _ureduce(a, func=_median, axis=axis, out=out, File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\lib\function_base.py", line 3725, in _ureduce r = func(a, **kwargs) File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\lib\function_base.py", line 3870, in _median rout = mean(part[indexer], axis=axis, out=out) File "<__array_function__ internals>", line 180, in mean File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\fromnumeric.py", line 3432, in mean return _methods._mean(a, axis=axis, dtype=dtype, File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\_methods.py", line 180, in _mean ret = umr_sum(arr, axis, dtype, out, keepdims, where=where) ValueError: output parameter for reduction operation add has the wrong number of dimensions: Found 3 but expected 2 ``` ### NumPy/Python version information: 1.23.5 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)] ### Context for the issue: _No response_
Looks like there is also similar behavior for `np.nanmedian()`, `np.percentile()`, `np.nanpercentile()`, `np.quantile()` and `np.nanquantile()`. Definitely a bug! This works correctly for `np.mean`. @mhvk, thanks for confirming that. I guess I'll look into what `np.mean` does differently.
2022-12-02T23:14:09Z
[]
[]
Traceback (most recent call last): File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\IPython\core\interactiveshell.py", line 3378, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-10-a37955de53f7>", line 1, in <module> np.median(np.random.random((11, 12, 13)), axis=~0, out=np.empty((11, 12, 1)), keepdims=True) File "<__array_function__ internals>", line 180, in median File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\lib\function_base.py", line 3816, in median r, k = _ureduce(a, func=_median, axis=axis, out=out, File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\lib\function_base.py", line 3725, in _ureduce r = func(a, **kwargs) File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\lib\function_base.py", line 3870, in _median rout = mean(part[indexer], axis=axis, out=out) File "<__array_function__ internals>", line 180, in mean File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\fromnumeric.py", line 3432, in mean return _methods._mean(a, axis=axis, dtype=dtype, File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\_methods.py", line 180, in _mean ret = umr_sum(arr, axis, dtype, out, keepdims, where=where) ValueError: output parameter for reduction operation add has the wrong number of dimensions: Found 3 but expected 2
10,148
numpy/numpy
numpy__numpy-22748
754e59d549455e81f5d4923ec2ac8d63f034bd14
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -3689,7 +3689,7 @@ def msort(a): return b -def _ureduce(a, func, **kwargs): +def _ureduce(a, func, keepdims=False, **kwargs): """ Internal Function. Call `func` with `a` as first argument swapping the axes to use extended @@ -3717,13 +3717,20 @@ def _ureduce(a, func, **kwargs): """ a = np.asanyarray(a) axis = kwargs.get('axis', None) + out = kwargs.get('out', None) + + if keepdims is np._NoValue: + keepdims = False + + nd = a.ndim if axis is not None: - keepdim = list(a.shape) - nd = a.ndim axis = _nx.normalize_axis_tuple(axis, nd) - for ax in axis: - keepdim[ax] = 1 + if keepdims: + if out is not None: + index_out = tuple( + 0 if i in axis else slice(None) for i in range(nd)) + kwargs['out'] = out[(Ellipsis, ) + index_out] if len(axis) == 1: kwargs['axis'] = axis[0] @@ -3736,12 +3743,27 @@ def _ureduce(a, func, **kwargs): # merge reduced axis a = a.reshape(a.shape[:nkeep] + (-1,)) kwargs['axis'] = -1 - keepdim = tuple(keepdim) else: - keepdim = (1,) * a.ndim + if keepdims: + if out is not None: + index_out = (0, ) * nd + kwargs['out'] = out[(Ellipsis, ) + index_out] r = func(a, **kwargs) - return r, keepdim + + if out is not None: + return out + + if keepdims: + if axis is None: + index_r = (np.newaxis, ) * nd + else: + index_r = tuple( + np.newaxis if i in axis else slice(None) + for i in range(nd)) + r = r[(Ellipsis, ) + index_r] + + return r def _median_dispatcher( @@ -3831,12 +3853,8 @@ def median(a, axis=None, out=None, overwrite_input=False, keepdims=False): >>> assert not np.all(a==b) """ - r, k = _ureduce(a, func=_median, axis=axis, out=out, + return _ureduce(a, func=_median, keepdims=keepdims, axis=axis, out=out, overwrite_input=overwrite_input) - if keepdims: - return r.reshape(k) - else: - return r def _median(a, axis=None, out=None, overwrite_input=False): @@ -4452,17 +4470,14 @@ def _quantile_unchecked(a, method="linear", keepdims=False): """Assumes that q is in [0, 1], and is an ndarray""" - r, k = _ureduce(a, + return _ureduce(a, func=_quantile_ureduce_func, q=q, + keepdims=keepdims, axis=axis, out=out, overwrite_input=overwrite_input, method=method) - if keepdims: - return r.reshape(q.shape + k) - else: - return r def _quantile_is_valid(q): diff --git a/numpy/lib/nanfunctions.py b/numpy/lib/nanfunctions.py --- a/numpy/lib/nanfunctions.py +++ b/numpy/lib/nanfunctions.py @@ -1214,12 +1214,9 @@ def nanmedian(a, axis=None, out=None, overwrite_input=False, keepdims=np._NoValu if a.size == 0: return np.nanmean(a, axis, out=out, keepdims=keepdims) - r, k = function_base._ureduce(a, func=_nanmedian, axis=axis, out=out, + return function_base._ureduce(a, func=_nanmedian, keepdims=keepdims, + axis=axis, out=out, overwrite_input=overwrite_input) - if keepdims and keepdims is not np._NoValue: - return r.reshape(k) - else: - return r def _nanpercentile_dispatcher( @@ -1556,17 +1553,14 @@ def _nanquantile_unchecked( # so deal them upfront if a.size == 0: return np.nanmean(a, axis, out=out, keepdims=keepdims) - r, k = function_base._ureduce(a, + return function_base._ureduce(a, func=_nanquantile_ureduce_func, q=q, + keepdims=keepdims, axis=axis, out=out, overwrite_input=overwrite_input, method=method) - if keepdims and keepdims is not np._NoValue: - return r.reshape(q.shape + k) - else: - return r def _nanquantile_ureduce_func(a, q, axis=None, out=None, overwrite_input=False, diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py --- a/numpy/ma/extras.py +++ b/numpy/ma/extras.py @@ -732,12 +732,8 @@ def median(a, axis=None, out=None, overwrite_input=False, keepdims=False): else: return m - r, k = _ureduce(a, func=_median, axis=axis, out=out, + return _ureduce(a, func=_median, keepdims=keepdims, axis=axis, out=out, overwrite_input=overwrite_input) - if keepdims: - return r.reshape(k) - else: - return r def _median(a, axis=None, out=None, overwrite_input=False):
BUG: `numpy.median()` does not respect `keepdims=True` when the `out` argument is specified ### Describe the issue: `numpy.median()` is ignoring `keepdims=True` when the `out` argument is set. If `out` has the same number of dimensions as the input, an error is raised. If `out` has the number of dimensions consistent with `keepdims=False` no error is raised. I'm happy to try and open a PR to fix this issue if we decide that this is indeed a bug. ### Reproduce the code example: ```python import numpy as np np.median(np.random.random((11, 12, 13)), axis=~0, out=np.empty((11, 12, 1)), keepdims=True) ``` ### Error message: ```shell Traceback (most recent call last): File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\IPython\core\interactiveshell.py", line 3378, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-10-a37955de53f7>", line 1, in <module> np.median(np.random.random((11, 12, 13)), axis=~0, out=np.empty((11, 12, 1)), keepdims=True) File "<__array_function__ internals>", line 180, in median File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\lib\function_base.py", line 3816, in median r, k = _ureduce(a, func=_median, axis=axis, out=out, File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\lib\function_base.py", line 3725, in _ureduce r = func(a, **kwargs) File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\lib\function_base.py", line 3870, in _median rout = mean(part[indexer], axis=axis, out=out) File "<__array_function__ internals>", line 180, in mean File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\fromnumeric.py", line 3432, in mean return _methods._mean(a, axis=axis, dtype=dtype, File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\_methods.py", line 180, in _mean ret = umr_sum(arr, axis, dtype, out, keepdims, where=where) ValueError: output parameter for reduction operation add has the wrong number of dimensions: Found 3 but expected 2 ``` ### NumPy/Python version information: 1.23.5 3.10.8 (tags/v3.10.8:aaaf517, Oct 11 2022, 16:50:30) [MSC v.1933 64 bit (AMD64)] ### Context for the issue: _No response_
Looks like there is also similar behavior for `np.nanmedian()`, `np.percentile()`, `np.nanpercentile()`, `np.quantile()` and `np.nanquantile()`. Definitely a bug! This works correctly for `np.mean`. @mhvk, thanks for confirming that. I guess I'll look into what `np.mean` does differently.
2022-12-06T22:21:54Z
[]
[]
Traceback (most recent call last): File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\IPython\core\interactiveshell.py", line 3378, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-10-a37955de53f7>", line 1, in <module> np.median(np.random.random((11, 12, 13)), axis=~0, out=np.empty((11, 12, 1)), keepdims=True) File "<__array_function__ internals>", line 180, in median File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\lib\function_base.py", line 3816, in median r, k = _ureduce(a, func=_median, axis=axis, out=out, File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\lib\function_base.py", line 3725, in _ureduce r = func(a, **kwargs) File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\lib\function_base.py", line 3870, in _median rout = mean(part[indexer], axis=axis, out=out) File "<__array_function__ internals>", line 180, in mean File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\fromnumeric.py", line 3432, in mean return _methods._mean(a, axis=axis, dtype=dtype, File "C:\Users\royts\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\_methods.py", line 180, in _mean ret = umr_sum(arr, axis, dtype, out, keepdims, where=where) ValueError: output parameter for reduction operation add has the wrong number of dimensions: Found 3 but expected 2
10,151
numpy/numpy
numpy__numpy-23269
d92cc2d1c7c7153525e03c4d10377714d85cfde6
diff --git a/numpy/ma/core.py b/numpy/ma/core.py --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -2870,7 +2870,13 @@ def __new__(cls, data=None, mask=nomask, dtype=None, copy=False, _data._mask = _data._mask.copy() # Reset the shape of the original mask if getmask(data) is not nomask: - data._mask.shape = data.shape + # gh-21022 encounters an issue here + # because data._mask.shape is not writeable, but + # the op was also pointless in that case, because + # the shapes were the same, so we can at least + # avoid that path + if data._mask.shape != data.shape: + data._mask.shape = data.shape else: # Case 2. : With a mask in input. # If mask is boolean, create an array of True or False @@ -6300,6 +6306,12 @@ def __deepcopy__(self, memo=None): memo[id(self)] = copied for (k, v) in self.__dict__.items(): copied.__dict__[k] = deepcopy(v, memo) + # as clearly documented for np.copy(), you need to use + # deepcopy() directly for arrays of object type that may + # contain compound types--you cannot depend on normal + # copy semantics to do the right thing here + if self.dtype.hasobject: + copied._data[...] = deepcopy(copied._data) return copied
BUG: Error while trying to create a deepcopy of numpy masked_array ### Describe the issue: We faced an issue when trying to create a deepcopy of numpy masked_array which was created from masked constant - the result of `numpy.prod` operation. But when we create masked array with same shape (variable `array` from the example below) not from conversion it deepcopied successfully. ### Reproduce the code example: ```python import numpy as np from copy import deepcopy source = np.ma.masked_array(data=[-1, -1], mask=True, dtype=np.float64) axis = np.array(0) result = np.prod(source, axis=axis, keepdims=False) result = np.ma.masked_array(result, mask=np.ones(result.shape, dtype=np.bool)) array = np.ma.masked_array(data=-1, mask=True, dtype=np.float64) deepcopy(array) deepcopy(result) ``` ### Error message: ```shell Traceback (most recent call last): File "C:\...\JetBrains\PyCharmCE2021.1\scratches\scratch.py", line 12, in <module> deepcopy(result) File "C:\...\Python\Python39\lib\copy.py", line 153, in deepcopy y = copier(memo) File "C:\...\lib\site-packages\numpy\ma\core.py", line 6218, in __deepcopy__ copied = MaskedArray.__new__(type(self), self, copy=True) File "C:\...\lib\site-packages\numpy\ma\core.py", line 2880, in __new__ data._mask.shape = data.shape AttributeError: attribute 'shape' of 'numpy.generic' objects is not writable Process finished with exit code 1 ``` ### NumPy/Python version information: 1.22.2 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]
2023-02-24T00:30:32Z
[]
[]
Traceback (most recent call last): File "C:\...\JetBrains\PyCharmCE2021.1\scratches\scratch.py", line 12, in <module> deepcopy(result) File "C:\...\Python\Python39\lib\copy.py", line 153, in deepcopy y = copier(memo) File "C:\...\lib\site-packages\numpy\ma\core.py", line 6218, in __deepcopy__ copied = MaskedArray.__new__(type(self), self, copy=True) File "C:\...\lib\site-packages\numpy\ma\core.py", line 2880, in __new__ data._mask.shape = data.shape AttributeError: attribute 'shape' of 'numpy.generic' objects is not writable
10,168
numpy/numpy
numpy__numpy-23275
b4f6b0b9d2af3e5a7ed0bfb51c8d692298bc2dde
diff --git a/numpy/core/function_base.py b/numpy/core/function_base.py --- a/numpy/core/function_base.py +++ b/numpy/core/function_base.py @@ -3,6 +3,7 @@ import operator import types +import numpy as np from . import numeric as _nx from .numeric import result_type, NaN, asanyarray, ndim from numpy.core.multiarray import add_docstring @@ -183,7 +184,7 @@ def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None, def _logspace_dispatcher(start, stop, num=None, endpoint=None, base=None, dtype=None, axis=None): - return (start, stop) + return (start, stop, base) @array_function_dispatch(_logspace_dispatcher) @@ -199,6 +200,9 @@ def logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None, .. versionchanged:: 1.16.0 Non-scalar `start` and `stop` are now supported. + .. versionchanged:: 1.25.0 + Non-scalar 'base` is now supported + Parameters ---------- start : array_like @@ -223,9 +227,10 @@ def logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None, an integer; `float` is chosen even if the arguments would produce an array of integers. axis : int, optional - The axis in the result to store the samples. Relevant only if start - or stop are array-like. By default (0), the samples will be along a - new axis inserted at the beginning. Use -1 to get an axis at the end. + The axis in the result to store the samples. Relevant only if start, + stop, or base are array-like. By default (0), the samples will be + along a new axis inserted at the beginning. Use -1 to get an axis at + the end. .. versionadded:: 1.16.0 @@ -247,7 +252,7 @@ def logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None, Notes ----- - Logspace is equivalent to the code + If base is a scalar, logspace is equivalent to the code >>> y = np.linspace(start, stop, num=num, endpoint=endpoint) ... # doctest: +SKIP @@ -262,6 +267,9 @@ def logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None, array([100. , 177.827941 , 316.22776602, 562.34132519]) >>> np.logspace(2.0, 3.0, num=4, base=2.0) array([4. , 5.0396842 , 6.34960421, 8. ]) + >>> np.logspace(2.0, 3.0, num=4, base=[2.0, 3.0], axis=-1) + array([[ 4. , 5.0396842 , 6.34960421, 8. ], + [ 9. , 12.98024613, 18.72075441, 27. ]]) Graphical illustration: @@ -279,7 +287,13 @@ def logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None, >>> plt.show() """ + ndmax = np.broadcast(start, stop, base).ndim + start, stop, base = ( + np.array(a, copy=False, subok=True, ndmin=ndmax) + for a in (start, stop, base) + ) y = linspace(start, stop, num=num, endpoint=endpoint, axis=axis) + base = np.expand_dims(base, axis=axis) if dtype is None: return _nx.power(base, y) return _nx.power(base, y).astype(dtype, copy=False)
BUG: `numpy.logspace` sometimes fails with a broadcasting error if `base` is array-like. ### Describe the issue: Two related failure modes here. If `start` and `stop` are both scalars and `base` is array-like then there is always a broadcasting error. If `start`/`stop`, and `base` are array-like and `axis != 0` then there is also a broadcasting error. I think this could be fixed pretty easily by inserting a new axis into `base` so that it broadcasts correctly. ### Reproduce the code example: ```python import numpy as np np.logspace(0, 1, base=[1, 2, 3]) ``` ### Error message: ```shell Traceback (most recent call last): File "C:\Users\byrdie\AppData\Local\Programs\Python\Python311\Lib\site-packages\IPython\core\interactiveshell.py", line 3442, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-17-817fad8c0c56>", line 1, in <module> b = np.logspace(0, 1, base=[1, 2, 3]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<__array_function__ internals>", line 200, in logspace File "C:\Users\byrdie\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\function_base.py", line 284, in logspace return _nx.power(base, y) ^^^^^^^^^^^^^^^^^^ ValueError: operands could not be broadcast together with shapes (3,) (50,) ``` ### Runtime information: ``` import sys, numpy; print(numpy.__version__); print(sys.version) 1.24.1 3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)] ``` ``` print(numpy.show_runtime()) WARNING: `threadpoolctl` not found in system! Install it by `pip install threadpoolctl`. Once installed, try `np.show_runtime` again for more detailed build information [{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'], 'found': ['SSSE3', 'SSE41', 'POPCNT', 'SSE42', 'AVX', 'F16C', 'FMA3', 'AVX2'], 'not_found': ['AVX512F', 'AVX512CD', 'AVX512_SKX', 'AVX512_CLX', 'AVX512_CNL', 'AVX512_ICL']}}] None ``` ### Context for the issue: If we think this is a good idea I'm happy to open a PR to try and resolve this issue.
2023-02-25T00:18:24Z
[]
[]
Traceback (most recent call last): File "C:\Users\byrdie\AppData\Local\Programs\Python\Python311\Lib\site-packages\IPython\core\interactiveshell.py", line 3442, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-17-817fad8c0c56>", line 1, in <module> b = np.logspace(0, 1, base=[1, 2, 3]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<__array_function__ internals>", line 200, in logspace File "C:\Users\byrdie\AppData\Local\Programs\Python\Python311\Lib\site-packages\numpy\core\function_base.py", line 284, in logspace return _nx.power(base, y) ^^^^^^^^^^^^^^^^^^ ValueError: operands could not be broadcast together with shapes (3,) (50,)
10,169
numpy/numpy
numpy__numpy-23335
857c64a95339bd937fbcc5398246fd2dcf78f3ab
diff --git a/numpy/ma/core.py b/numpy/ma/core.py --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -2857,7 +2857,7 @@ def __new__(cls, data=None, mask=nomask, dtype=None, copy=False, mask = np.array( [getmaskarray(np.asanyarray(m, dtype=_data.dtype)) for m in data], dtype=mdtype) - except ValueError: + except (ValueError, TypeError): # If data is nested mask = nomask # Force shrinking of the mask if needed (and possible)
BUG: Masked array creation fails with structured array ### Describe the issue: When trying to create a mask array with a structured dtype a `TypeError` is thrown. However, the same code with `np.array` instead of `np.ma.array` works fine. I suspect [this](https://github.com/numpy/numpy/blob/45bc13e6d922690eea43b9d807d476e0f243f836/numpy/ma/core.py#L2868) might just need to catch `TypeError` too. ### Reproduce the code example: ```python import numpy as np np.ma.array((1, (b"", b"")), dtype=[("x", np.int_), ("y", [("i", np.void), ("j", np.void)])]) ``` ### Error message: ```shell Traceback (most recent call last): File "<string>", line 1, in <module> File "venv\lib\site-packages\numpy\ma\core.py", line 6610, in array return MaskedArray(data, mask=mask, dtype=dtype, copy=copy, File "venv\lib\site-packages\numpy\ma\core.py", line 2865, in __new__ [getmaskarray(np.asanyarray(m, dtype=_data.dtype)) File "venv\lib\site-packages\numpy\ma\core.py", line 2865, in <listcomp> [getmaskarray(np.asanyarray(m, dtype=_data.dtype)) TypeError: a bytes-like object is required, not 'int' ``` ### NumPy/Python version information: numpy: 1.23.0 python: 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)]
> I suspect [this](https://github.com/numpy/numpy/blob/45bc13e6d922690eea43b9d807d476e0f243f836/numpy/ma/core.py#L2868) might just need to catch TypeError too. Could you put a PR together to test that hypothesis? It should include a test. We have had problems changing masked array since the tests do not cover the uses by downstream libraries, so we would need to check this kind of a change against astropy to make sure it does not break anything. Ok, will do. In case anyone else hits this, the workaround I'm using is to create the plain array first and then create the masked array from that.
2023-03-03T23:28:04Z
[]
[]
Traceback (most recent call last): File "<string>", line 1, in <module> File "venv\lib\site-packages\numpy\ma\core.py", line 6610, in array return MaskedArray(data, mask=mask, dtype=dtype, copy=copy, File "venv\lib\site-packages\numpy\ma\core.py", line 2865, in __new__ [getmaskarray(np.asanyarray(m, dtype=_data.dtype)) File "venv\lib\site-packages\numpy\ma\core.py", line 2865, in <listcomp> [getmaskarray(np.asanyarray(m, dtype=_data.dtype)) TypeError: a bytes-like object is required, not 'int'
10,171
numpy/numpy
numpy__numpy-23599
a5262604c89c61c8db93241f280c69367c493945
diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py --- a/numpy/f2py/crackfortran.py +++ b/numpy/f2py/crackfortran.py @@ -613,15 +613,15 @@ def readfortrancode(ffile, dowithline=show, istop=1): groupends = (r'end|endprogram|endblockdata|endmodule|endpythonmodule|' r'endinterface|endsubroutine|endfunction') endpattern = re.compile( - beforethisafter % ('', groupends, groupends, r'.*'), re.I), 'end' + beforethisafter % ('', groupends, groupends, '.*'), re.I), 'end' endifs = r'end\s*(if|do|where|select|while|forall|associate|block|' + \ r'critical|enum|team)' endifpattern = re.compile( - beforethisafter % (r'[\w]*?', endifs, endifs, r'[\w\s]*'), re.I), 'endif' + beforethisafter % (r'[\w]*?', endifs, endifs, '.*'), re.I), 'endif' # moduleprocedures = r'module\s*procedure' moduleprocedurepattern = re.compile( - beforethisafter % ('', moduleprocedures, moduleprocedures, r'.*'), re.I), \ + beforethisafter % ('', moduleprocedures, moduleprocedures, '.*'), re.I), \ 'moduleprocedure' implicitpattern = re.compile( beforethisafter % ('', 'implicit', 'implicit', '.*'), re.I), 'implicit'
BUG: f2py.crackfortran fails on comment after endif statement ### Describe the issue: Hey there! `numpy.f2py.crackfortran.crackfortran` fails, when there is a comment after an `END <IF|DO|etc.>` statement. I'm guessing that this is due to [the `endifpattern` here](https://github.com/numpy/numpy/blob/c16a05ce3877bed28b9880829c169271051ef734/numpy/f2py/crackfortran.py#LL619C13-L619C13) only checking for `r'[\w\s]*'` after the statement, while comments start with a `!`. In contrast to this, `endpattern` a few lines above uses the more generalized `r'.*'`. ### Reproduce the code example: ```python import tempfile from numpy.f2py import crackfortran FORTRAN = """\ SUBROUTINE EXAMPLE( ) IF( .TRUE. ) THEN CALL DO_SOMETHING() END IF ! ** .TRUE. ** END """ with tempfile.NamedTemporaryFile('w', suffix=".f", delete=False) as file: file.write(FORTRAN) crackfortran.crackfortran(file.name) ``` ### Error message: ```shell Reading fortran codes... Reading file '/var/folders/qv/js92y9x526sdmsmjdrylwkx80000gn/T/tmpmdqwsj7t.f' (format:fix,strict) Traceback (most recent call last): File "/Users/lysnikolaou/repos/python/scipy/reexport.py", line 16, in <module> crackfortran.crackfortran(file.name) File "/Users/lysnikolaou/anaconda3/envs/scipy-dev/lib/python3.10/site-packages/numpy/f2py/crackfortran.py", line 3303, in crackfortran readfortrancode(files, crackline) File "/Users/lysnikolaou/anaconda3/envs/scipy-dev/lib/python3.10/site-packages/numpy/f2py/crackfortran.py", line 583, in readfortrancode dowithline(finalline) File "/Users/lysnikolaou/anaconda3/envs/scipy-dev/lib/python3.10/site-packages/numpy/f2py/crackfortran.py", line 822, in crackline raise Exception('crackline: groupcounter(=%s) is nonpositive. ' Exception: crackline: groupcounter(=0) is nonpositive. Check the blocks. ``` ### Runtime information: ```python3 >>> import sys, numpy; print(numpy.__version__); print(sys.version) 1.24.2 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:17:34) [Clang 14.0.6 ] >>> print(numpy.show_runtime()) [{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'], 'found': ['SSSE3', 'SSE41', 'POPCNT', 'SSE42'], 'not_found': ['AVX', 'F16C', 'FMA3', 'AVX2', 'AVX512F', 'AVX512CD', 'AVX512_KNL', 'AVX512_SKX', 'AVX512_CLX', 'AVX512_CNL', 'AVX512_ICL']}}, {'architecture': 'Nehalem', 'filepath': '/Users/lysnikolaou/anaconda3/envs/scipy-dev/lib/libopenblasp-r0.3.21.dylib', 'internal_api': 'openblas', 'num_threads': 10, 'prefix': 'libopenblas', 'threading_layer': 'openmp', 'user_api': 'blas', 'version': '0.3.21'}, {'filepath': '/Users/lysnikolaou/anaconda3/envs/scipy-dev/lib/libomp.dylib', 'internal_api': 'openmp', 'num_threads': 10, 'prefix': 'libomp', 'user_api': 'openmp', 'version': None}] ``` ### Context for the issue: I'm currently working on scipy/scipy#14262, where I'm trying to regenerate scipy's Cython signatures for BLAS/LAPACK. The script that does this uses `f2py` to extract info from the BLAS/LAPACK fortran code. In four cases (`dbdsvdx`, `dtrevc3`, `sbdsvdx`, `strevc3`) `f2py` failed, because of this issue. For example, in `dbdsvdx`, the script fails due to [this line on LAPACK](https://github.com/Reference-LAPACK/lapack/blob/9f7abc2cc93fac3a5a8905307447c70163abdef2/SRC/dbdsvdx.f#LL697C37-L697C37).
2023-04-16T17:28:25Z
[]
[]
Traceback (most recent call last): File "/Users/lysnikolaou/repos/python/scipy/reexport.py", line 16, in <module> crackfortran.crackfortran(file.name) File "/Users/lysnikolaou/anaconda3/envs/scipy-dev/lib/python3.10/site-packages/numpy/f2py/crackfortran.py", line 3303, in crackfortran readfortrancode(files, crackline) File "/Users/lysnikolaou/anaconda3/envs/scipy-dev/lib/python3.10/site-packages/numpy/f2py/crackfortran.py", line 583, in readfortrancode dowithline(finalline) File "/Users/lysnikolaou/anaconda3/envs/scipy-dev/lib/python3.10/site-packages/numpy/f2py/crackfortran.py", line 822, in crackline raise Exception('crackline: groupcounter(=%s) is nonpositive. ' Exception: crackline: groupcounter(=0) is nonpositive. Check the blocks.
10,177
numpy/numpy
numpy__numpy-23650
2a66cbb1d760d6072716edfef86a2ede4c770e2b
diff --git a/numpy/core/_add_newdocs_scalars.py b/numpy/core/_add_newdocs_scalars.py --- a/numpy/core/_add_newdocs_scalars.py +++ b/numpy/core/_add_newdocs_scalars.py @@ -204,7 +204,11 @@ def add_newdoc_for_scalar_type(obj, fixed_aliases, doc): r""" A unicode string. - When used in arrays, this type strips trailing null codepoints. + This type strips trailing null codepoints. + + >>> s = np.str_("abc\x00") + >>> s + 'abc' Unlike the builtin `str`, this supports the :ref:`python:bufferobjects`, exposing its contents as UCS4:
DOC: Strings containing a single null byte are equal to empty string ### Describe the issue: ndarrays containing strings that contain a single null byte, `'\x00'`, compare equal to empty strings. ### Reproduce the code example: ```python import numpy as np print(f'numpy: {np.version.full_version}') assert '\x00' != '' # ok assert np.all(np.array(['\x00']) != np.array([''])) # fails ``` ### Error message: ```shell Traceback (most recent call last): File "----", line 9, in <module> assert np.all(np.array(['\x00']) != np.array([''])) AssertionError ``` ### NumPy/Python version information: python: 3.9.7 (default, Sep 3 2021, 12:37:55) [Clang 12.0.5 (clang-1205.0.22.9)] numpy: 1.21.2
This is a consequence of how NumPy stores strings (Unicode string and `bytes`). In a NumPy array with dtype, say, `U6`, there is storage allocated for 6 Unicode characters for each element. So the *maximum* length of a string that can be stored in such an array is 6. Shorter strings are stored by *padding with 0*. This means NumPy ignores any trailing characters that are 0, because they are assumed to be part of the padding. NumPy has no way to indicate that some or all of the trailing 0 values are supposed to be part of the string. The NumPy array does not explicitly store the length of each string. The length is implied by ignoring any trailing 0 values. For example, here `a` is an array with dtype `U6`--each element can hold a string up to length 6. I'll try to include some strings that have trailing 0 characters, but those zeros will be ignored: ``` In [33]: a = np.array(["AAAAAA", "BB", "BB\x00", "", "\x00"]) In [34]: a Out[34]: array(['AAAAAA', 'BB', 'BB', '', ''], dtype='<U6') ``` The trailing zeros are gone. We can see this clearly when we view the array as an array of 32 bit integers with shape (5, 6): ``` In [35]: a.view(np.uint32).reshape(-1, 6) Out[35]: array([[65, 65, 65, 65, 65, 65], [66, 66, 0, 0, 0, 0], [66, 66, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0]], dtype=uint32) ``` Both `'BB'` and `'BB\x00'` are stored as ` [66, 66, 0, 0, 0, 0]`. The significance of the trailing `'\x00'` in `'BB\x00'` has been lost, and NumPy treats both strings as `'BB'`. Similary, both `''` and `'\x00'` are treated as `''`. This is how NumPy was designed, so the issue doesn't quite qualify as a *bug*. It is a known limitation of the representation of strings in NumPy arrays. I understand. It is still confusing behaviour, though. Is the fact that traling null bytes are ignored documented anywhere? If not, that would be helpful.
2023-04-23T22:21:44Z
[]
[]
Traceback (most recent call last): File "----", line 9, in <module> assert np.all(np.array(['\x00']) != np.array([''])) AssertionError
10,180
numpy/numpy
numpy__numpy-23757
a5262604c89c61c8db93241f280c69367c493945
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -260,7 +260,7 @@ def __getitem__(self, key): else: return self.zip.read(key) else: - raise KeyError("%s is not a file in the archive" % key) + raise KeyError(f"{key} is not a file in the archive") def __contains__(self, key): return (key in self._files or key in self.files)
BUG: `NpzFile.__getitem__` should use safer string formatting when generating error messages. ### Describe the issue: Trying to index a NpzFile with two indices (which can happen e.g. if one confuses the NpzFile object with a 2D array in the file) results in a TypeError when generating the error message, due to the "classical" bug of passing a tuple to %-formatting. ### Reproduce the code example: ```python import numpy as np; np.savez("/tmp/test.npz", foo=42); np.load("/tmp/test.npz")[1, 2] ``` ### Error message: ```shell Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/path/to/python3.11/site-packages/numpy/lib/npyio.py", line 260, in __getitem__ raise KeyError("%s is not a file in the archive" % key) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ TypeError: not all arguments converted during string formatting ``` ### Runtime information: 1.24.2 3.11.3 | packaged by conda-forge | (main, Apr 6 2023, 08:58:31) [Clang 14.0.6 ] [{'simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'], 'found': ['ASIMDHP', 'ASIMDDP'], 'not_found': ['ASIMDFHM']}}, {'architecture': 'armv8', 'filepath': '/Users/antony/.local/lib/python3.11/site-packages/numpy/.dylibs/libopenblas64_.0.dylib', 'internal_api': 'openblas', 'num_threads': 8, 'prefix': 'libopenblas', 'threading_layer': 'pthreads', 'user_api': 'blas', 'version': '0.3.21'}] ### Context for the issue: Obviously this can easily be worked around, but also seems simple to fix (replace `... % key` by `... % (key,)`, or switch to f-strings, etc.).
2023-05-12T19:31:23Z
[]
[]
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/path/to/python3.11/site-packages/numpy/lib/npyio.py", line 260, in __getitem__ raise KeyError("%s is not a file in the archive" % key) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~ TypeError: not all arguments converted during string formatting
10,187