[packages/python-oyoyo] - rel 9, patch python3 fixes since 2to3 does not exist anymore
baggins
baggins at pld-linux.org
Fri Jun 6 22:40:52 CEST 2025
commit 35d6ebfb072aed53b630e0a4259984eba27f5425
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Sat Jun 7 00:38:50 2025 +0200
- rel 9, patch python3 fixes since 2to3 does not exist anymore
python-oyoyo.spec | 7 +-
python3.patch | 293 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
version.patch | 11 ++
3 files changed, 309 insertions(+), 2 deletions(-)
---
diff --git a/python-oyoyo.spec b/python-oyoyo.spec
index 6912c96..2d20685 100644
--- a/python-oyoyo.spec
+++ b/python-oyoyo.spec
@@ -7,19 +7,20 @@ Summary: Fast, simple IRC module suitable for clients, bots and games
Summary(pl.UTF-8): Szybki, prosty moduł IRC odpowiedni dla klientów, botów i gier
Name: python-oyoyo
Version: 0.0.0
-Release: 8
+Release: 9
License: MIT
Group: Libraries/Python
#Source0Download: https://pypi.org/simple/oyoyo/
Source0: https://files.pythonhosted.org/packages/source/o/oyoyo/oyoyo-%{version}dev.tar.gz
# Source0-md5: ab5d74a96de284239cc0624dd5c1f8b5
+Patch0: python3.patch
+Patch1: version.patch
URL: https://pypi.org/project/oyoyo/
%if %{with python2}
BuildRequires: python-modules >= 1:2.5
BuildRequires: python-setuptools
%endif
%if %{with python3}
-BuildRequires: python3-2to3 >= 1:3.2
BuildRequires: python3-modules >= 1:3.2
BuildRequires: python3-setuptools
%endif
@@ -53,6 +54,8 @@ się na potrzeby botów, klientów i czegokolwiek innego (nawet gier).
%prep
%setup -q -n oyoyo-%{version}dev
+%patch -P0 -p1
+%patch -P1 -p1
%build
%if %{with python2}
diff --git a/python3.patch b/python3.patch
new file mode 100644
index 0000000..633b8b1
--- /dev/null
+++ b/python3.patch
@@ -0,0 +1,293 @@
+--- oyoyo-0.0.0dev.orig/setup.py 2025-06-07 00:31:45.266660131 +0200
++++ oyoyo-0.0.0dev/setup.py 2012-07-31 08:54:07.000000000 +0200
+@@ -14,11 +14,6 @@
+ use_setuptools()
+ from setuptools import setup, find_packages
+
+-# Call setup function, adding use_2to3 kwarg if under python 3
+-extras = {}
+-if is_py3:
+- extras['use_2to3'] = True
+-
+ setup(
+ name='oyoyo',
+ version="",
+@@ -30,5 +35,4 @@
+ [console_scripts]
+ oyoyo_example_bot = oyoyo.examplebot:main
+ """,
+- **extras
+ )
+--- oyoyo-0.0.0dev.orig/oyoyo/client.py 2012-07-31 08:54:07.000000000 +0200
++++ oyoyo-0.0.0dev/oyoyo/client.py 2021-11-21 18:13:00.000000000 +0100
+@@ -62,7 +51,7 @@
+ means if you use a plain while loop your app will consume 100% cpu.
+ To enable blocking pass blocking=True.
+
+- >>> class My_Handler(DefaultCommandHandler):
++ >>> from oyoyo import helpers >>> class My_Handler(DefaultCommandHandler):
+ ... def privmsg(self, prefix, command, args):
+ ... print "%s said %s" % (prefix, args[1])
+ ...
+@@ -138,7 +127,10 @@
+ try:
+ logging.info('connecting to %s:%s' % (self.host, self.port))
+ self.socket.connect(("%s" % self.host, self.port))
+- if not self.blocking:
++ if self.blocking:
++ # this also overrides default timeout
++ self.socket.setblocking(1)
++ else:
+ self.socket.setblocking(0)
+
+ helpers.nick(self, self.nick)
+@@ -151,7 +143,7 @@
+ while not self._end:
+ try:
+ buffer += self.socket.recv(1024)
+- except socket.error, e:
++ except socket.error as e:
+ try: # a little dance of compatibility to get the errno
+ errno = e.errno
+ except AttributeError:
+@@ -179,6 +171,7 @@
+ self.socket.close()
+
+
++# noinspection PyPep8Naming
+ class IRCApp:
+ """ This class manages several IRCClient instances without the use of threads.
+ (Non-threaded) Timer functionality is also included.
+@@ -223,13 +216,13 @@
+ while self.running:
+ found_one_alive = False
+
+- for client, clientdesc in self._clients.iteritems():
++ for client, clientdesc in self._clients.items():
+ if clientdesc.con is None:
+ clientdesc.con = client.connect()
+
+ try:
+ clientdesc.con.next()
+- except Exception, e:
++ except Exception as e:
+ logging.error('client error %s' % e)
+ logging.error(traceback.format_exc())
+ if clientdesc.autoreconnect:
+--- oyoyo-0.0.0dev.orig/oyoyo/cmdhandler.py 2012-07-31 08:54:07.000000000 +0200
++++ oyoyo-0.0.0dev/oyoyo/cmdhandler.py 2021-11-21 18:13:00.000000000 +0100
+@@ -66,12 +61,12 @@
+ ["command", "sub", "func"].
+ """
+ if isinstance(in_command_parts, (str, bytes)):
+- in_command_parts = in_command_parts.split(bytes('.', 'ascii'))
++ in_command_parts = in_command_parts.split(".")
+ command_parts = in_command_parts[:]
+
+ p = self
+ while command_parts:
+- cmd = command_parts.pop(0).decode('ascii')
++ cmd = command_parts.pop(0)
+ if cmd.startswith('_'):
+ raise ProtectedCommandError(in_command_parts)
+
+@@ -93,6 +88,7 @@
+ def run(self, command, *args):
+ """ finds and runs a command """
+ logging.debug("processCommand %s(%s)" % (command, args))
++ # print(command, args)
+
+ try:
+ f = self.get(command)
+@@ -104,7 +100,7 @@
+
+ try:
+ f(*args)
+- except Exception, e:
++ except Exception as e:
+ logging.error('command raised %s' % e)
+ logging.error(traceback.format_exc())
+ raise CommandError(command)
+@@ -126,13 +122,14 @@
+ self.client.send('PONG', server)
+
+
++# noinspection PyPep8Naming
+ class DefaultBotCommandHandler(CommandHandler):
+ """ default command handler for bots. methods/attributes are made
+ available as commands """
+
+ @protected
+ def getVisibleCommands(self, obj=None):
+- test = (lambda x: isinstance(x, CommandHandler) or \
++ test = (lambda x: isinstance(x, CommandHandler) or
+ inspect.ismethod(x) or inspect.isfunction(x))
+ members = inspect.getmembers(obj or self, test)
+ return [m for m, _ in members
+@@ -150,20 +147,21 @@
+ else:
+ try:
+ f = self.get(arg)
+- except CommandError, e:
++ except CommandError as e:
+ helpers.msg(self.client, dest, str(e))
+ return
+
+ doc = f.__doc__.strip() if f.__doc__ else "No help available"
+
+ if not inspect.ismethod(f):
+- subcommands = self.getVisibleCommands(f)
+- if subcommands:
+- doc += " [sub commands: %s]" % " ".join(subcommands)
++ sub_commands = self.getVisibleCommands(f)
++ if sub_commands:
++ doc += " [sub commands: %s]" % " ".join(sub_commands)
+
+ helpers.msg(self.client, dest, "%s: %s" % (arg, doc))
+
+
++# noinspection PyPep8Naming
+ class BotCommandHandler(DefaultCommandHandler):
+ """ complete command handler for bots """
+
+@@ -197,7 +195,7 @@
+
+ try:
+ self.command_handler.run(command, prefix, dest, *arg)
+- except CommandError, e:
++ except CommandError as e:
+ helpers.msg(self.client, dest, str(e))
+ return True
+
+--- oyoyo-0.0.0dev.orig/oyoyo/helpers.py 2012-07-31 08:54:07.000000000 +0200
++++ oyoyo-0.0.0dev/oyoyo/helpers.py 2021-11-21 18:13:00.000000000 +0100
+@@ -19,6 +19,22 @@
+
+ import random
+
++
++def join(client, channel):
++ # Dummy function - replaced later
++ pass
++
++
++def part(client, channel):
++ # Dummy function - replaced later
++ pass
++
++
++def nick(client, nick):
++ # Dummy function - replaced later
++ pass
++
++
+ def msg(cli, user, msg):
+ for line in msg.split('\n'):
+ cli.send("PRIVMSG", user, ":%s" % line)
+@@ -51,9 +72,10 @@
+ cli.send("QUIT :%s" % msg)
+ cli._end = 1
+
++
+ def user(cli, username, realname=None):
+- cli.send("USER", username, cli.host, cli.host,
+- realname or username)
++ cli.send("USER", username, cli.host, cli.host, realname or username)
++
+
+ _simple = (
+ 'join',
+@@ -70,8 +94,12 @@
+ m = sys.modules[__name__]
+ for t in _simple:
+ setattr(m, t, simplecmd(t.upper()))
++
++
+ _addsimple()
+
++
++# noinspection PyPep8Naming
+ def _addNumerics():
+ import sys
+ from oyoyo import ircevents
+@@ -79,9 +108,10 @@
+ def f(cli, *args):
+ cli.send(cmd_num, *args)
+ return f
++
+ m = sys.modules[__name__]
+- for num, name in ircevents.numeric_events.iteritems():
++ for num, name in ircevents.numeric_events.items():
+ setattr(m, name, numericcmd(num, name))
+
+-_addNumerics()
+
++_addNumerics()
+--- oyoyo-0.0.0dev.orig/oyoyo/ircevents.py 2012-07-31 08:54:07.000000000 +0200
++++ oyoyo-0.0.0dev/oyoyo/ircevents.py 2021-11-21 18:13:00.000000000 +0100
+@@ -205,5 +205,5 @@
+ "pong",
+ ]
+
+-all_events = generated_events + protocol_events + numeric_events.values()
++all_events = generated_events + protocol_events + list(numeric_events.values())
+
+--- oyoyo-0.0.0dev.orig/oyoyo/parse.py 2012-07-31 08:54:07.000000000 +0200
++++ oyoyo-0.0.0dev/oyoyo/parse.py 2021-11-21 18:13:00.000000000 +0100
+@@ -46,8 +39,10 @@
+
+ <crlf> ::= CR LF
+ """
+- parts = element.strip().split(bytes(" ", "ascii"))
+- if parts[0].startswith(bytes(':', 'ascii')):
++ print(element)
++ element = element.decode("UTF-8", errors="replace")
++ parts = element.strip().split(" ")
++ if parts[0].startswith(":"):
+ prefix = parts[0][1:]
+ command = parts[1]
+ args = parts[2:]
+@@ -60,18 +55,18 @@
+ try:
+ command = numeric_events[command]
+ except KeyError:
+- logging.warn('unknown numeric event %s' % command)
++ logging.warning('unknown numeric event %s' % command)
+ command = command.lower()
+
+- if args[0].startswith(bytes(':', 'ascii')):
+- args = [bytes(" ", "ascii").join(args)[1:]]
++ if args[0].startswith(":"):
++ args = [" ".join(args)[1:]]
+ else:
+ for idx, arg in enumerate(args):
+- if arg.startswith(bytes(':', 'ascii')):
+- args = args[:idx] + [bytes(" ", 'ascii').join(args[idx:])[1:]]
++ if arg.startswith(":"):
++ args = args[:idx] + [" ".join(args[idx:])[1:]]
+ break
+
+- return (prefix, command, args)
++ return prefix, command, args
+
+
+ def parse_nick(name):
+@@ -83,7 +78,7 @@
+ try:
+ nick, rest = name.split('!')
+ except ValueError:
+- return (name, None, None, None)
++ return name, None, None, None
+ try:
+ mode, rest = rest.split('=')
+ except ValueError:
+@@ -91,7 +86,6 @@
+ try:
+ user, host = rest.split('@')
+ except ValueError:
+- return (name, mode, rest, None)
+-
+- return (name, mode, user, host)
++ return name, mode, rest, None
+
++ return name, mode, user, host
diff --git a/version.patch b/version.patch
new file mode 100644
index 0000000..2822b39
--- /dev/null
+++ b/version.patch
@@ -0,0 +1,11 @@
+--- oyoyo-0.0.0dev/setup.py~ 2025-06-07 00:31:45.000000000 +0200
++++ oyoyo-0.0.0dev/setup.py 2025-06-07 00:35:41.436660123 +0200
+@@ -16,7 +16,7 @@
+
+ setup(
+ name='oyoyo',
+- version="",
++ version="0.0.0",
+ description='a fast, simple irc module suitable for clients, bots and games',
+ author='Dunk Fordyce, Daniel da Silva (current)',
+ author_email='dunkfordyce at gmail.com, meltingwax at gmail.com',
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-oyoyo.git/commitdiff/35d6ebfb072aed53b630e0a4259984eba27f5425
More information about the pld-cvs-commit
mailing list