Skip to content

Commit

Permalink
Use spawn instead of fork on windows -> not sure about the implecations.
Browse files Browse the repository at this point in the history
  • Loading branch information
antarcticrainforest committed Jul 22, 2024
1 parent 14f131d commit a7027a1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
15 changes: 11 additions & 4 deletions docs/deployment/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ from the [release page](release:{{version}}).

- **Windows**
- [amd64](exe:windows-x64.zip)
> ``💡`` This version uses a patched version of ansible. We can't guaranty
> a working deployment software on windows.
- **macOS**
- [amd64](exe:osx-x64.tar.gz)
- [arm64](exe:osx-arm64.tar.gz)

After downloading version {{version}} file for your operating system and architecture,
you can you have to extract the archived folder (zip on windows, tar.gz on Unix)
and run the run the `deploy-freva` (`deploy-freva.exe` on windows) command
in the folder:
After downloading version {{version}} file for your operating system and
architecture, you have to extract the archived folder (zip on windows,
tar.gz on Unix) and run the `deploy-freva` (`deploy-freva.exe` on windows)
command in the extracted folder:

```console
Usage: deploy-freva [-h] [-v] [-V] [--cowsay] {cmd,migrate} ...
Expand All @@ -59,6 +61,7 @@ Options:
--cowsay Let the cow speak! (default: False)
```


## 2. Installation via pip.
If you're using Linux, OsX or a Windows subsystem for Linux (WSL) you can
use *pip* to install the deployment software:
Expand All @@ -70,6 +73,10 @@ python3 -m pip install -U freva-deployment
This command installs ansible and all required python packages.
> ``💡`` On *CentOS* python SELinux libraries need to be installed.
> You will need to install libselinux for your CentOS version.
>
> The ansible library is not supported on *Windows* and needs to be patched.
> you can either use the above mentioned pre compiled windows binary or install
> the deployment software on Windows Subsystem for Linux - WSL (preferred).
```console
python3 -m pip install libselinux-python3
Expand Down
19 changes: 17 additions & 2 deletions pyinstaller/pre-win.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
try:
import ansible

ansible_cli_path = Path(ansible.__file__).parent / "cli" / "__init__.py"
ansible_cli_path = (
Path(ansible.__file__).parent / "cli" / "__init__.py"
)
finally:
sys.getfilesystemencoding = getfilesystemencoding
locale.getlocale = getlocale
Expand All @@ -27,8 +29,21 @@
if f"os.{call}" in content:
write = True
if "import os, termios" not in content:
content = content.replace("import os", "import os, termios")
content = content.replace(
"import os", "import os, termios"
)
content = content.replace(f"os.{call}", f"termios.{call}")
if (
"get_context('fork')" in content
or 'get_context("fork")' in content
):
write = True
content = content.repalce(
"get_context('fork')", "get_context('spawn')"
)
content = content.replace(
'get_context("fork")', 'get_context("spwan")'
)
if write:
inp_file.write_text(content, encoding="utf-8")
else:
Expand Down

0 comments on commit a7027a1

Please sign in to comment.