Skip to content

Commit 3acf4db

Browse files
relativisticelectronk9ert
and
k9ert
authored
Bugfix: Corrected build instructions and made virtuelenv name dynamic (#1735)
* Corrected readme * Made the ".buildenv" name not hard-coded but read from os.environ["VIRTUAL_ENV"] * Added the virtualenv instructions also to build-instructions.md Co-authored-by: k9ert <[email protected]>
1 parent 4bcc25b commit 3acf4db

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

docs/build-instructions.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,16 @@ If someone does not want the download, he can manually choose a specterd-binary
2222

2323
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.
2424

25-
### specterd Linux and MacOS
25+
First set the virtualenv:
2626

27+
```bash
28+
virtualenv --python=python3 .buildenv
29+
source .buildenv/bin/activate
2730
```
31+
32+
### specterd Linux and MacOS
33+
34+
```bash
2835
cd pyinstaller
2936
# prerequisites
3037
pip3 install -r requirements.txt --require-hashes
@@ -50,7 +57,7 @@ pyinstaller.exe specterd.spec
5057

5158
### Electron Linux
5259
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:
53-
```
60+
```bash
5461
cd electron
5562
# You have to decide about a version
5663
npm i

pyinstaller/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@ This will update the file hash and version name the Specter Desktop app expects
99

1010
# Pyinstaller build
1111

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

1414
```bash
15-
$ pip3 install -r requirements.txt --require-hashes
15+
virtualenv --python=python3 .buildenv
16+
source .buildenv/bin/activate
17+
cd pyinstaller
18+
pip3 install -r requirements.txt --require-hashes
1619
```
1720

1821
Now run:
1922

2023
```bash
21-
$ pyinstaller specterd.spec
24+
pyinstaller specterd.spec
2225
```
2326

2427
And for HWIBridge, run:

src/cryptoadvance/specter/managers/service_manager.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,15 @@ def get_service_x_dirs(cls, x):
308308
# Those pathes are absolute. Let's make them relative:
309309
arr = [Path(*path.parts[-6:]) for path in arr]
310310

311+
virtuelenv_path = os.path.relpath(os.environ["VIRTUAL_ENV"], ".")
312+
311313
if os.name == "nt":
312-
virtualenv_search_path = Path("..", ".buildenv", "Lib")
314+
virtualenv_search_path = Path(virtuelenv_path, "Lib")
313315
else:
314316
# let's calcultate so that we get something like:
315317
# virtualenv_search_path = Path("..", ".buildenv", "lib", "python3.8")
316318
site_package = [path for path in sys.path if "site-packages" in path][0]
317-
site_package = Path("..", ".buildenv", *(Path(site_package).parts[-3:-1]))
319+
site_package = Path(virtuelenv_path, *(Path(site_package).parts[-3:-1]))
318320
virtualenv_search_path = site_package
319321

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

0 commit comments

Comments
 (0)