Skip to content

Corrected build instructions and made virtuelenv name dynamic #1735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions docs/build-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@ If someone does not want the download, he can manually choose a specterd-binary

So let's cover the build of the specterd-binary first. Below is a manual description of the build-process. There are acripts which are doing this but they are partially optimized for the CI-system. Check the `pyinstaller/build-*` scripts for details.

### specterd Linux and MacOS
First set the virtualenv:

```bash
virtualenv --python=python3 .buildenv
source .buildenv/bin/activate
```

### specterd Linux and MacOS

```bash
cd pyinstaller
# prerequisites
pip3 install -r requirements.txt --require-hashes
Expand All @@ -50,7 +57,7 @@ pyinstaller.exe specterd.spec

### Electron Linux
The prerequisite for an electron build is a successfull specterd-build above. So now we need to bake the hash and a way how to retrieve the specterd-file when the electron-app is started:
```
```bash
cd electron
# You have to decide about a version
npm i
Expand Down
9 changes: 6 additions & 3 deletions pyinstaller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ This will update the file hash and version name the Specter Desktop app expects

# Pyinstaller build

`cd` into this directory (`specter-desktop/pyinstaller`) and install requirements:
Install requirements:

```bash
$ pip3 install -r requirements.txt --require-hashes
virtualenv --python=python3 .buildenv
source .buildenv/bin/activate
cd pyinstaller
pip3 install -r requirements.txt --require-hashes
```

Now run:

```bash
$ pyinstaller specterd.spec
pyinstaller specterd.spec
```

And for HWIBridge, run:
Expand Down
6 changes: 4 additions & 2 deletions src/cryptoadvance/specter/managers/service_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,15 @@ def get_service_x_dirs(cls, x):
# Those pathes are absolute. Let's make them relative:
arr = [Path(*path.parts[-6:]) for path in arr]

virtuelenv_path = os.path.relpath(os.environ["VIRTUAL_ENV"], ".")

if os.name == "nt":
virtualenv_search_path = Path("..", ".buildenv", "Lib")
virtualenv_search_path = Path(virtuelenv_path, "Lib")
else:
# let's calcultate so that we get something like:
# virtualenv_search_path = Path("..", ".buildenv", "lib", "python3.8")
site_package = [path for path in sys.path if "site-packages" in path][0]
site_package = Path("..", ".buildenv", *(Path(site_package).parts[-3:-1]))
site_package = Path(virtuelenv_path, *(Path(site_package).parts[-3:-1]))
virtualenv_search_path = site_package

# ... and as the classes are in the .buildenv (see build-unix.sh) let's add ..
Expand Down