3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

Merge branch 'py37-base'

This commit is contained in:
James Lu 2021-12-25 00:33:45 -08:00
commit d3ccdca3d1
3 changed files with 11 additions and 25 deletions

View File

@ -28,7 +28,7 @@ There is also an IRC channel available: `#pylink @ irc.libera.chat`
## Installation
### Pre-requisites
* CPython 3.5 or above (other interpreters are untested and unsupported)
* Python 3.7 or above - prefer the newest Python 3.x when available
* A Unix-like operating system: PyLink is actively developed on Linux only, so we cannot guarantee that things will work properly on other systems.
If you are a developer and want to help make PyLink more portable, patches are welcome.

View File

@ -4,8 +4,8 @@ import subprocess
import sys
from codecs import open
if sys.version_info < (3, 4):
raise RuntimeError("PyLink requires Python 3.4 or higher.")
if sys.version_info < (3, 7):
raise RuntimeError("PyLink requires Python 3.7 or higher.")
try:
from setuptools import setup, find_packages
@ -30,14 +30,8 @@ with open('__init__.py', 'w') as f:
f.write('real_version = %r\n' % real_version)
try:
if sys.version_info >= (3, 5):
with open('README.md') as f:
long_description = f.read()
else:
# Work around "TypeError: a bytes-like object is required, not 'str'" errors on Python 3.4
# when the README has Unicode characters (error in distutils.util.rfc822_escape)
import codecs
long_description = codecs.open('README.md', encoding='utf-8').read()
with open('README.md') as f:
long_description = f.read()
except OSError:
print('WARNING: Failed to read readme, skipping writing long_description')
long_description = None
@ -76,10 +70,10 @@ setup(
'Natural Language :: English',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
keywords='IRC services relay',

View File

@ -4,7 +4,6 @@ Runs IRC parser tests from ircdocs/parser-tests.
This test suite runs static code only.
"""
from pathlib import Path
import sys
import unittest
import yaml
@ -18,20 +17,13 @@ from pylinkirc.protocols.ircs2s_common import IRCCommonProtocol
class MessageParserTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
if sys.version_info >= (3, 6):
_open = open
else:
def _open(f): # Coerse pathlib paths to str for py3.5 compat
return open(str(f))
with _open(PARSER_DATA_PATH / 'msg-split.yaml') as f:
with open(PARSER_DATA_PATH / 'msg-split.yaml') as f:
cls.MESSAGE_SPLIT_TEST_DATA = yaml.safe_load(f)
with _open(PARSER_DATA_PATH / 'userhost-split.yaml') as f:
with open(PARSER_DATA_PATH / 'userhost-split.yaml') as f:
cls.USER_HOST_SPLIT_TEST_DATA = yaml.safe_load(f)
with _open(PARSER_DATA_PATH / 'mask-match.yaml') as f:
with open(PARSER_DATA_PATH / 'mask-match.yaml') as f:
cls.MASK_MATCH_TEST_DATA = yaml.safe_load(f)
with _open(PARSER_DATA_PATH / 'validate-hostname.yaml') as f:
with open(PARSER_DATA_PATH / 'validate-hostname.yaml') as f:
cls.VALIDATE_HOSTNAME_TEST_DATA = yaml.safe_load(f)
def testMessageSplit(self):