Update to python3 and fix ssl.wrap_socket removal in 3.12

This commit is contained in:
2026-03-01 11:48:40 -08:00
parent ea1ad60f1c
commit d07483c17b
2 changed files with 6 additions and 4 deletions

View File

@@ -10,7 +10,7 @@
supportedSystems = with flake-utils.lib.system; [ x86_64-linux i686-linux aarch64-linux ];
in {
overlay = final: prev: {
drastikbot = prev.python311.pkgs.buildPythonApplication rec {
drastikbot = prev.python3.pkgs.buildPythonApplication rec {
pname = "drastikbot";
version = "v2.1";
@@ -29,8 +29,8 @@
cp -r $src/src/* $out
mkdir -p $out/bin
makeWrapper ${prev.python311}/bin/python3 $out/bin/drastikbot \
--prefix PYTHONPATH : ${with prev.python311.pkgs; makePythonPath [requests beautifulsoup4]} \
makeWrapper ${prev.python3}/bin/python3 $out/bin/drastikbot \
--prefix PYTHONPATH : ${with prev.python3.pkgs; makePythonPath [requests beautifulsoup4]} \
--add-flags "$out/drastikbot.py"
'';
};

View File

@@ -205,7 +205,9 @@ class Drastikbot():
self.irc_socket = socket.create_connection(
(self.var.host, self.var.port), 300)
if self.var.ssl:
self.irc_socket = ssl.wrap_socket(self.irc_socket)
context = ssl.create_default_context()
self.irc_socket = context.wrap_socket(
self.irc_socket, server_hostname=self.var.host)
except OSError:
if self.var.sigint:
return