zephyr/scripts
Torsten Rasmussen ef3c5e5516 cmake: west: invoke west using same python as rest of build system
When running CMake, then Python3 will be used.
This is detected through FindPython3, with a preference for using the
python or python3 in path, if any of those matches the required Python
minimal version in Zephyr.

It is also possible for users to specify a different Python, as example
by using:
`cmake -DPYTHON_PREFER=/usr/bin/python3.x`

However, when running `west` as native command, then west will be
invoked on linux based on the python defined in:
`west` launcher, which could be: `#!/usr/bin/python3.y`

Thus there could be mismatch in Pythons used for `west` and the python
used for other scripts.

This is even worse on windows, where a user might experience:
```
>.\opt\bin\Scripts\west.exe --version
Traceback (most recent call last):
  File "C:\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  ...
  File "C:\Python37\lib\socket.py", line 49, in <module>
    import _socket
ImportError: Module use of python38.dll conflicts with this version of
Python.
```

when testing out a newer Python, but the python in path is still a 3.7.

By importing `west` into zephyr_module.py and by using, as example
`python -c "from west.util import west_topdir; print(topdir())"`
we ensure the same python is used in all python scripts.

Also it allows the user to control the python to use for west.

It also ensures that the west version being tested, is also the version
being used, where old code would test the version imported by python,
but using the west in path (which could be a different version)

If the west version installed in the current Python, and west invocation
is using a different Python interpreter, then an additional help text
is printed, to easier assist users with debugging.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-07-08 23:23:04 -04:00
..
checkpatch
ci build: remove dead stores to environment 2020-07-08 14:02:44 -05:00
coccinelle zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
dts edtlib: Fold _binding_compat into _init_compat2binding 2020-07-08 22:03:24 -04:00
footprint
gitlint
kconfig kconfig: load edt from edt.pickle 2020-07-08 14:02:44 -05:00
net scripts: net: Fix incorrect error messages 2020-05-21 14:45:07 +02:00
release
sanity_chk sanitylib: pacify pylint 2020-07-08 20:19:02 -04:00
support
tests/sanitycheck sanitycheck: Testcases for report functions of TestSuite Class 2020-07-03 12:20:35 -04:00
tracing scripts: add script for usb backend to receive tracing data 2020-02-05 23:54:26 -05:00
west_commands cmake: west: invoke west using same python as rest of build system 2020-07-08 23:23:04 -04:00
.gitignore scripts: tests: sanitycheck: Add basic foundation for sanitycheck testsuite 2020-03-24 22:32:26 -04:00
checkpatch.pl Revert "checkpatch: update checkpatch to warn about C99 type usage" 2020-06-08 08:23:57 -05:00
checkstack.pl
coccicheck scripts: Fix documunt referenc for coccicheck 2020-05-08 17:44:44 +02:00
dir_is_writeable.py
file2hex.py scripts: file2hex.py: PEP 8 style fix 2020-06-12 11:09:58 +02:00
filter-known-issues.py
gen_app_partitions.py
gen_cfb_font_header.py zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
gen_gcov_files.py scripts: gen_gcov_files.py: add argument help text 2020-06-13 16:33:22 -04:00
gen_kobject_list.py zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
gen_offset_header.py scripts: gen_offset_header: add argument help text 2020-05-21 14:45:24 +02:00
gen_relocate_app.py zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
gen_syscalls.py scripts: gen_syscalls: typo fix 2020-06-09 10:39:49 +02:00
mergehex.py
parse_syscalls.py userspace: net sockets are kernel objects 2020-06-03 22:33:32 +02:00
process_gperf.py scripts: process_gperf: typo fix 2020-06-09 10:40:58 +02:00
requirements-base.txt scripts: west: add CANopen flash runner 2020-05-08 10:53:42 +02:00
requirements-build-test.txt tests: sanitycheck: Testcases for load_from_file and apply_filters 2020-06-15 22:27:18 -04:00
requirements-doc.txt ci: do not use latest breathe release for docs 2020-04-07 18:51:13 -04:00
requirements-extras.txt scripts/requirements: Split & document requirement.txt 2020-03-19 15:41:08 +01:00
requirements-run-test.txt requirements: add psutil, needed by sanitycheck 2020-05-06 11:07:22 -05:00
requirements.txt scripts/requirements: Split & document requirement.txt 2020-03-19 15:41:08 +01:00
sanitycheck sanitycheck: fix --failed-only handling 2020-07-03 07:25:49 -04:00
series-push-hook.sh
spelling.txt
subfolder_list.py python: subfolder_list.py now generates shorter link names 2020-04-22 17:24:04 +02:00
tags.sh
user_wordsize.py posix arch: build on aarch64 / allow host-specific cmake includes 2020-05-09 12:17:24 +02:00
valgrind.supp
west-commands.yml cmake: West extension command for Zephyr config package registration 2020-03-27 16:23:46 +01:00
zephyr_module.py cmake: west: invoke west using same python as rest of build system 2020-07-08 23:23:04 -04:00