Skip to content
Permalink
Browse files

DEP: Drop Python 3.4 compatibility

  • Loading branch information
wagner-certat committed Dec 9, 2019
1 parent 71dea2f commit 7535edaeac47e323b24127c1eb3185cb88329bcf
@@ -8,13 +8,12 @@ python:
- 3.5
- 3.6
- 3.7
- 3.8
matrix:
include:
- python: 3.4
- python: 3.5
env: mode=debian
- python: 3.4
env: requirements=false
- python: 3.6
- python: 3.8
env: mode=codestyle
install:
- set -e
@@ -20,8 +20,11 @@ CHANGELOG

#### Collectors
- `intelmq.bots.collectors.misp.collector`: Deprecate parameter `misp_verify` in favor of generic parameter `http_verify_cert`.
- `intelmq.bots.collectors.tcp.collector`: Drop compatibility with Python 3.4.

#### Parsers
- `intelmq.bots.parsers.autoshun.parser`: Drop compatibility with Python 3.4.
- `intelmq.bots.parsers.html_table.parser`: Drop compatibility with Python 3.4.

#### Experts
- `intelmq.bots.experts.csv_converter`: Added as converter to CSV.
@@ -45,6 +48,9 @@ CHANGELOG
### Tests
- Travis: Use `intelmqsetup` here too.
- Install required build dependencies for the Debian package build test.
- This version is no longer automatically tested on Python `<` 3.5.
- Also run the tests on Python 3.8.
- Run the debian packaging tests on Python 3.5 and the codestyle test on 3.8.
- Added tests for the new bot `intelmq.bots.outputs.misp.output_feed` (#1473).
- Added tests for the new bot `intelmq.bots.experts.misp.expert` (#1473).

@@ -7,6 +7,7 @@ See the changelog for a full list of changes.
----------------------------------

### Requirements
- IntelMQ no longer supports Python 3.4, Python `>=` 3.5 is required.

### Tools

@@ -3,7 +3,7 @@ Maintainer: Sebastian Wagner <wagner@cert.at>
Section: python
Priority: optional
Build-Depends: debhelper (>= 4.1.16), python3-all, python3-setuptools, quilt, dh-python, python-setuptools, dh-systemd, safe-rm, python3-requests, python3-redis, python3-dnspython, python3-psutil, python3-dateutil, python3-termstyle, python3-tz, lsb-release
X-Python3-Version: >= 3.4
X-Python3-Version: >= 3.5
Standards-Version: 3.9.6
Homepage: https://github.com/certtools/intelmq/

@@ -1,7 +1,6 @@
**Table of Contents:**
- [Requirements](#requirements)
- [Install Dependencies](#install-dependencies)
- [Debian 8](#debian-8)
- [Ubuntu 16.04 / Ubuntu 18.04 / Debian 9](#ubuntu-1604--ubuntu-1804--debian-9)
- [CentOS 7 / RHEL 7](#centos-7--rhel-7)
- [openSUSE Leap 15.0 / 15.1](#opensuse-leap-150--151)
@@ -34,23 +33,6 @@ Other distributions which are (most probably) supported include RHEL, Fedora and

If you are using native packages, you can simply skip this section as all dependencies are installed automatically.

## Debian 8

```bash
apt-get install python3 python3-pip
apt-get install build-essential libffi-dev
apt-get install python3-dev
apt-get install redis-server
```

**Special note for Debian 8**:
if you are using Debian 8, you need to install this package extra: ``apt-get install libgnutls28-dev``.
In addition, Debian 8 has an old version of pip3. Please get a current one via:
```bash
curl "https://bootstrap.pypa.io/get-pip.py" -o "/tmp/get-pip.py"
python3.4 /tmp/get-pip.py
```

## Ubuntu 16.04 / Ubuntu 18.04 / Debian 9

```bash
@@ -73,12 +55,6 @@ yum install gcc gcc-c++
yum install redis
```

Install the last pip version:
```bash
curl "https://bootstrap.pypa.io/get-pip.py" -o "/tmp/get-pip.py"
python3.4 /tmp/get-pip.py
```

## openSUSE 15.0 / 15.1

```bash
@@ -183,7 +183,7 @@
}
},
"TCP": {
"description": "TCP is the bot responsible to receive events on a TCP port (ex: from TCP Output of another IntelMQ instance). Might not be working on Python3.4.6.",
"description": "TCP is the bot responsible to receive events on a TCP port (ex: from TCP Output of another IntelMQ instance).",
"module": "intelmq.bots.collectors.tcp.collector",
"parameters": {
"ip": "<ip>",
@@ -60,10 +60,7 @@ def connect(self):
struct.pack('ii', 1, 0)) # immediately unbind port after closing so that we can restart
self.con.bind(self.address)
self.con.settimeout(15)
if sys.version_info[1] > 4: # remove when we're having Python 3.5+, let here `self.con.listen()`
self.con.listen()
else:
self.con.listen(1)
self.con.listen()
self.logger.info("Connected successfully to %s:%s.", self.address[0], self.address[1])

def shutdown(self):
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
import html
import html.parser
import sys

from intelmq.lib import utils
from intelmq.lib.bot import ParserBot
@@ -19,14 +18,6 @@
class AutoshunParserBot(ParserBot):

def parse(self, report):
if sys.version_info[:2] == (3, 4):
# See https://docs.python.org/3/whatsnew/3.4.html#html
# https://docs.python.org/3/whatsnew/3.5.html#changes-in-the-python-api
# raises DeprecationWarning otherwise on 3.4, True by default in 3.5
self.parser = html.parser.HTMLParser(convert_charrefs=True)
else:
self.parser = html.parser.HTMLParser()

raw_report = utils.base64_decode(report.get("raw"))
splitted = raw_report.split("</tr>")
self.tempdata = ['</tr>'.join(splitted[:2])]
@@ -43,10 +34,7 @@ def parse_line(self, line, report):

ip = info[1].split('</td>')[0].strip()
last_seen = info[2].split('</td>')[0].strip() + '-05:00'
if sys.version_info < (3, 4):
description = self.parser.unescape(info[3].split('</td>')[0].strip())
else:
description = html.unescape(info[3].split('</td>')[0].strip())
description = html.parser.HTMLParser().unescape(info[3].split('</td>')[0].strip())

for key in ClassificationType.allowed_values:
if description.lower().find(key.lower()) > -1:
@@ -1,3 +1,2 @@
beautifulsoup4
lxml<4.4.0; python_version < '3.5'
lxml; python_version >= '3.5'
lxml
@@ -80,11 +80,6 @@ def _delayed_start(self):
self.run_bot(iterations=len(self.input_message))


major, minor, micro, *_ = sys.version_info


@unittest.skipIf((major, minor) == (3, 4) and micro < 8, "Travis CI failed with Python3.4.6. "
"However, the developer managed to successfully test it on 3.4.8.")
class TestTCPCollectorBot(test.BotTestCase, unittest.TestCase):
"""
A TestCase for TCPCollectorBot.
@@ -114,8 +114,6 @@ def test_stream_logger_given(self):
line_format = [line.format(name) for line in LINES['short']]
self.assertSequenceEqual(line_format, stream_lines)

@unittest.skipIf(sys.version_info < (3, 5),
"contextlib.redirect_* is not supported in Python 3.4.")
def test_stream_logger(self):
stdout = io.StringIO()
stderr = io.StringIO()
@@ -14,9 +14,6 @@
'pytz>=2012c',
'redis>=2.10',
]
if sys.version_info < (3, 5):
REQUIRES.append('typing')


exec(open(os.path.join(os.path.dirname(__file__),
'intelmq/version.py')).read()) # defines __version__
@@ -36,7 +33,7 @@
version=__version__,
maintainer='Sebastian Wagner',
maintainer_email='wagner@cert.at',
python_requires='>=3.4',
python_requires='>=3.5',
install_requires=REQUIRES,
tests_require=[
'Cerberus!=1.3',
@@ -71,10 +68,10 @@
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Security',

0 comments on commit 7535eda

Please sign in to comment.
You can’t perform that action at this time.