From 75dc224a4dde7f920da3d4a9fc73566e4edbf2e0 Mon Sep 17 00:00:00 2001 From: Believethehype Date: Wed, 20 Dec 2023 18:21:40 +0100 Subject: [PATCH] fixes for venvs on windows --- nostr_dvm/dvm.py | 10 ++++++---- nostr_dvm/interfaces/dvmtaskinterface.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/nostr_dvm/dvm.py b/nostr_dvm/dvm.py index 44febf7..8a5110a 100644 --- a/nostr_dvm/dvm.py +++ b/nostr_dvm/dvm.py @@ -1,9 +1,8 @@ -import importlib import json import os import subprocess from datetime import timedelta -from pathlib import Path +from sys import platform from nostr_sdk import PublicKey, Keys, Client, Tag, Event, EventBuilder, Filter, HandleNotification, Timestamp, \ init_logger, LogLevel, Options, nip04_encrypt @@ -475,8 +474,11 @@ class DVM: request_form = dvm.create_request_from_nostr_event(job_event, self.client, self.dvm_config) if dvm_config.USE_OWN_VENV: - python_bin = (r'cache/venvs/' + os.path.basename(dvm_config.SCRIPT).split(".py")[0] - + "/bin/python") + python_location = "/bin/python" + if platform == "win32": + python_location = "/Scripts/python" + python_bin = ( r'cache/venvs/' + os.path.basename(dvm_config.SCRIPT).split(".py")[0] + + python_location) retcode = subprocess.call([python_bin, dvm_config.SCRIPT, '--request', json.dumps(request_form), '--identifier', dvm_config.IDENTIFIER, diff --git a/nostr_dvm/interfaces/dvmtaskinterface.py b/nostr_dvm/interfaces/dvmtaskinterface.py index 0058591..b4f720c 100644 --- a/nostr_dvm/interfaces/dvmtaskinterface.py +++ b/nostr_dvm/interfaces/dvmtaskinterface.py @@ -71,7 +71,7 @@ class DVMTaskInterface: self.dependencies.append(("nostr-dvm", "nostr-dvm")) for (module, package) in self.dependencies: print("Installing Venv Module: " + module) - run([pip_location, "install", "--force-reinstall", package], cwd=dir) + run([pip_location, "install", "--upgrade", package], cwd=dir) else: for module, package in self.dependencies: if module != "nostr-dvm":