Unix: Disable 'crypt' command on Python >= 3.13

The module is not available anymore
This commit is contained in:
Valentin Lorentz 2024-05-05 20:41:57 +02:00 committed by Val Lorentz
parent e18332efde
commit 9ae7690484
3 changed files with 33 additions and 22 deletions

View File

@ -40,7 +40,6 @@ class InternetTestCase(PluginTestCase):
'Host not found.')
def testWhois(self):
self.assertNotError('internet whois ohio-state.edu')
self.assertNotError('internet whois microsoft.com')
self.assertNotError('internet whois inria.fr')
self.assertNotError('internet whois slime.com.au')

View File

@ -33,7 +33,6 @@ import os
import re
import pwd
import sys
import crypt
import errno
import random
import select
@ -41,6 +40,12 @@ import struct
import subprocess
import shlex
try:
import crypt
except ImportError:
# Python >= 3.13
crypt = None
import supybot.conf as conf
import supybot.utils as utils
from supybot.commands import *
@ -119,6 +124,7 @@ class Unix(callbacks.Plugin):
irc.reply(format('%i', os.getpid()), private=True)
pid = wrap(pid, [('checkCapability', 'owner')])
if crypt is not None: # Python < 3.13
_cryptre = re.compile(b'[./0-9A-Za-z]')
@internationalizeDocstring
def crypt(self, irc, msg, args, password, salt):

View File

@ -31,6 +31,11 @@
import os
import socket
try:
import crypt
except ImportError:
crypt = None
from supybot.test import *
try:
@ -106,6 +111,7 @@ if os.name == 'posix':
def testProgstats(self):
self.assertNotError('progstats')
if crypt is not None: # Python < 3.13
def testCrypt(self):
self.assertNotError('crypt jemfinch')