A default `npm run build` or a `scripts/build.sh` invocation would
not compile or sign `native_main.exe` anymore. This is a departure
from the previous logic where `PYINSTALLER=0` was needed to prevent
compile+signing of `native_main.exe`.
The following is achieved with this commit:
```
$ ## following does _not_ compile/sign `native_main.exe`
$ npm run build
$ PYINSTALLER=0 npm run build
$ ## following _does_ compile/sign `native_main.exe`
$ PYINSTALLER=1 npm run build
```
This patch replaces the previous `-UsePython` flag with `-NoPython`.
Essentially this flag replaces the native messenger installation
behavior with the following new strategy on Windows:
* Look for Python-3 in user's Windows environment
- If Python-3 is found, install `native_main.py` as the native
messenger binary
- If Python-3 is _not_ found, install `native_main.exe` as the
native messenger binary
This commit adds support for comiling `native_main.py` into
`native_main.exe` using [PyInstaller][0].
By default, the Powershell installer script would use the compiled
EXE version for Windows. However, the old behaviour can achieved by
using the `-UsePython` flag to `win_install.ps1`.
Currently, the `native_main.exe` is built every time
`scripts/build.sh` is invoked. However, this behavior can be
adjusted by invoking the build script as shown below:
```
PYINSTALLER="0" npm run build
```
[0]: https://www.pyinstaller.org
We are passing None value to mkstemp which is only possible since python
3.5.0 [1]. Let's use our own mask with empty string as the prefix when
None is given. That works with both python API versions.
[1]
ad577b938b
The double-equals introduced by de39d704a5 and 19e3363c92
are bash-isms, and cause the script to complain when run
with another POSIX shell (e.g. dash, which is the default
/bin/sh on Debian).
We can just use "=" here, as the two are equivalent.
Powershell by default would prevent execution of unsigned external
scripts. In order to perform the copy/paste installation found via
`:installnative`, we would need to adjust `ExecutationPolicy` to
`Bypass` temporarily under the `Process` scope to allow the initial
installation.