forked from certtools/intelmq
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
44 lines (36 loc) · 1.51 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""Example IntelMQ extension package
SPDX-FileCopyrightText: 2023 CERT.at GmbH <https://cert.at/>
SPDX-License-Identifier: AGPL-3.0-or-later
"""
from pathlib import Path
from setuptools import find_packages, setup
# Instead of the bot-autodiscovery below, you can also just manually declare entrypoints
# (regardless of packaging solution, even in pyproject.toml etc.), e.g.:
#
# 'intelmq.bots.collectors.custom.collector = mybots.bots.collectors.custom.collector:BOT.run'
#
# Important is:
# - entry point has to start with `intelmq.bots.{type}` (type: collectors, experts, parsers, outputs)
# - target has to end with `:BOT.run`
# - entry points have to be in `console_scripts` group
BOTS = []
base_path = Path(__file__).parent / 'mybots/bots'
botfiles = [botfile for botfile in Path(base_path).glob('**/*.py') if botfile.is_file() and not botfile.name.startswith('_')]
for file in botfiles:
file = Path(str(file).replace(str(base_path), 'intelmq/bots'))
entry_point = '.'.join(file.with_suffix('').parts)
file = Path(str(file).replace('intelmq/bots', 'mybots/bots'))
module = '.'.join(file.with_suffix('').parts)
BOTS.append(f'{entry_point} = {module}:BOT.run')
setup(
name='intelmq-example-extension',
version='1.0.0', # noqa: F821
maintainer='Your Name',
maintainer_email='[email protected]',
packages=find_packages(),
license='AGPLv3',
description='This is an example package to demonstrate how ones can extend IntelMQ.',
entry_points={
'console_scripts': BOTS
},
)