Handles cases where pip may not be wanted

This commit is contained in:
Thomas Williams 2024-07-08 14:59:35 +01:00
parent f2249c4f6c
commit 7e2900ad78
Signed by: thomas
GPG key ID: EB8F975CF60BCBFF
3 changed files with 7 additions and 3 deletions

View file

@ -38,4 +38,4 @@ See the available configuration options, which should be specified in config.py.
- **hostMonitorEndTime** - the end time which the host monitor should shut down. This does not stop the script itself and this monitor will restart at the start time.
- **urlMonitorStartTime** - the start time which the url monitor should start at the earliest.
- **urlMonitorEndTime** - the end time which the url monitor would shut down. This does not stop the script itself and this monitor will restart at the start time.
- **usePip** - whether or not to use pip to install dependencies. Set to false if your environment is externally managed

View file

@ -25,3 +25,4 @@ hostMonitorStartTime = "00:00:00"
hostMonitorEndTime = "23:59:59"
urlMonitorStartTime = "00:00:00"
urlMonitorEndTime = "23:59:59"
usePip = True

View file

@ -34,6 +34,9 @@ def get_pip_command():
def install_dependencies():
if not config.usePip:
return
pip_command = get_pip_command()
with open('requirements.txt', 'r') as req_file:
@ -250,12 +253,12 @@ if __name__ == "__main__":
import sys
import subprocess
import config
install_dependencies()
import config
import psutil
import os
import psutil
import time
import log
import requests