Skip to content

Commit

Permalink
Updated to Python 3.13 and fixed some warnings along the way. (#212)
Browse files Browse the repository at this point in the history
* Updated to Python 3.13 (datetime timezone changes amongst others) and fixed some warnings along the way.
* Fixed test errors in setup.
* Fixed a missing package in the installer (maybe new version of dnsresolver?).
* Fixed some more .
* Minor tidyup in the installer from some old boilerplate.
  • Loading branch information
joncage authored Feb 2, 2025
1 parent 4e5f674 commit fb032ce
Show file tree
Hide file tree
Showing 8 changed files with 616 additions and 399 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
- name: Set up Python 3.13
uses: actions/setup-python@v2
with:
python-version: 3.7
python-version: 3.13
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
6 changes: 3 additions & 3 deletions EDScoutCore/OutputRecorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import platform
from pathlib import Path
from datetime import datetime
from datetime import datetime, timezone


class OutputRecorder:
Expand All @@ -18,14 +18,14 @@ def __init__(self, file_name_prefix):

if not os.path.isdir(recording_dir):
Path(recording_dir).mkdir(parents=True, exist_ok=True)
timestamp = datetime.utcnow().strftime('%Y-%m-%d-%H-%M-%S')
timestamp = datetime.now(timezone.utc).strftime('%Y-%m-%d-%H-%M-%S')
file_name = file_name_prefix + '-' + timestamp + ".json"
file_path = os.path.join(recording_dir, file_name)
self.output = open(file_path, "w")

def record(self, stream_point, new_entry):
new_record = {
'timestamp': datetime.utcnow().isoformat(),
'timestamp': datetime.now(timezone.utc).isoformat(),
'stream_point': stream_point,
'entry': new_entry
}
Expand Down
15 changes: 6 additions & 9 deletions EDScoutWebUI/EDScout.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@
import platform
import psutil
import time
import threading
import requests
import re

from datetime import datetime
from datetime import datetime, timezone
from pathlib import Path

from flask import Flask, render_template, send_from_directory
Expand Down Expand Up @@ -96,7 +93,7 @@ def configure_logger(logger_to_configure, log_path, log_level_override=None):
def version_check(current_version):
version_check_response = check_version()
if version_check_response:
socketio.emit('version', version_check_response, broadcast=True)
socketio.emit('version', version_check_response)


# Work out where to stick the logs and make sure it exists
Expand All @@ -109,7 +106,7 @@ def version_check(current_version):
raise Exception(f"EDScout does not support {osname}")
if not os.path.isdir(logging_dir):
Path(logging_dir).mkdir(parents=True, exist_ok=True)
timestamp = datetime.utcnow().strftime('%Y-%m-%d-%H-%M-%S')
timestamp = datetime.now().strftime('%Y-%m-%d-%H-%M-%S')
logging_path = os.path.join(logging_dir, f"EDScout-{timestamp}.log")

# Configure logging
Expand Down Expand Up @@ -160,7 +157,7 @@ def version_check(current_version):
# Configure socketIO and the WebUI we use to encapsulate the window
socketio = SocketIO(app)
if args.run_as_app:
ui = FlaskUI(app, socketio=socketio, host=args.host, port=args.port)
ui = FlaskUI(app=app, socketio=socketio, port=args.port, server="flask_socketio")
else:
ui = None

Expand All @@ -187,7 +184,7 @@ def receive_and_forward(scout):
log.debug("Received: '" + message + "'")
content = dict(data=json.loads(message))
log.debug("Forwarding: '" + str(content) + "'")
socketio.emit('log', content, broadcast=True)
socketio.emit('log', content)
except Exception as pass_on_failure:
log.exception(pass_on_failure)

Expand All @@ -196,7 +193,7 @@ def receive_and_forward(scout):
def index():
return render_template('index.html',
version=__version__,
timestamp=str(datetime.utcnow()),
timestamp=str(datetime.now(timezone.utc)),
disable_nav_route=args.disable_nav_route)


Expand Down
4 changes: 0 additions & 4 deletions Installer/EdScoutInstaller.iss
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
; -- Example2.iss --
; Same as Example1.iss, but creates its icon in the Programs folder of the
; Start Menu instead of in a subfolder, and also creates a desktop icon.

; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!
#define Version GetVersionNumbersString('dist-singlefile\EdScout.exe')
#define FullVersion GetStringFileInfo('dist-singlefile\EDScout.exe', 'ProductVersion')
Expand Down
1 change: 1 addition & 0 deletions Installer/PackageIt.bat
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pipenv run pyinstaller ^
--hidden-import=dns.update ^
--hidden-import=dns.version ^
--hidden-import=dns.zone ^
--hidden-import=dns.versioned ^
--hidden-import=engineio.async_drivers ^
--hidden-import=engineio.async_drivers.eventlet ^
--hidden-import=engineio.server ^
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ dnspython = "*"
[dev-packages]

[requires]
python_version = "3.7"
python_version = "3.13"
979 changes: 601 additions & 378 deletions Pipfile.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from . import EDScoutCore
from . import EDScoutWebUI
#from . import EDScoutCore
#from . import EDScoutWebUI

0 comments on commit fb032ce

Please sign in to comment.