Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
0f4da248e7
|
|||
|
9e7106ff0b
|
|||
|
91144643f3
|
|||
|
a4c2ec3952
|
|||
|
375728e452
|
@@ -2,7 +2,7 @@
|
|||||||
# Distributed under the terms of the GNU General Public License v2
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
EAPI=7
|
EAPI=7
|
||||||
PYTHON_COMPAT=( python3_{9,10} )
|
PYTHON_COMPAT=( python3_{9..10} )
|
||||||
DISTUTILS_USE_SETUPTOOLS=rdepend
|
DISTUTILS_USE_SETUPTOOLS=rdepend
|
||||||
|
|
||||||
SCM=""
|
SCM=""
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ __all__ = [
|
|||||||
"whitelist",
|
"whitelist",
|
||||||
"QuarantineMilter"]
|
"QuarantineMilter"]
|
||||||
|
|
||||||
__version__ = "2.0.2"
|
__version__ = "2.0.4"
|
||||||
|
|
||||||
from pyquarantine import _runtime_patches
|
from pyquarantine import _runtime_patches
|
||||||
|
|
||||||
|
|||||||
@@ -21,14 +21,18 @@ import shutil
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
SYSTEMD_PATH = "/lib/systemd/system"
|
SYSTEMD_PATHS = ["/lib/systemd/system", "/usr/lib/systemd/system"]
|
||||||
OPENRC = "/sbin/openrc"
|
OPENRC = "/sbin/openrc"
|
||||||
|
|
||||||
|
|
||||||
def _systemd_files(pkg_dir, name):
|
def _systemd_files(pkg_dir, name):
|
||||||
|
for path in SYSTEMD_PATHS:
|
||||||
|
if os.path.isdir(path):
|
||||||
|
break
|
||||||
|
|
||||||
return [
|
return [
|
||||||
(f"{pkg_dir}/misc/systemd/{name}-milter.service",
|
(f"{pkg_dir}/misc/systemd/{name}-milter.service",
|
||||||
f"{SYSTEMD_PATH}/{name}-milter.service", True)]
|
f"{path}/{name}-milter.service", True)]
|
||||||
|
|
||||||
|
|
||||||
def _openrc_files(pkg_dir, name):
|
def _openrc_files(pkg_dir, name):
|
||||||
@@ -117,7 +121,11 @@ def _check_root():
|
|||||||
|
|
||||||
|
|
||||||
def _check_systemd():
|
def _check_systemd():
|
||||||
systemd = os.path.isdir(SYSTEMD_PATH)
|
for path in SYSTEMD_PATHS:
|
||||||
|
systemd = os.path.isdir(path)
|
||||||
|
if systemd:
|
||||||
|
break
|
||||||
|
|
||||||
if systemd:
|
if systemd:
|
||||||
logging.info("systemd detected")
|
logging.info("systemd detected")
|
||||||
|
|
||||||
|
|||||||
@@ -162,8 +162,9 @@ class MilterMessage(MIMEPart):
|
|||||||
def inject_body_part(part, content, subtype="plain"):
|
def inject_body_part(part, content, subtype="plain"):
|
||||||
parts = []
|
parts = []
|
||||||
text_body = None
|
text_body = None
|
||||||
|
text_content = None
|
||||||
if subtype == "html":
|
if subtype == "html":
|
||||||
text_body = part.get_body(preferencelist=("plain"))
|
text_body, text_content = part.get_body_content("plain")
|
||||||
|
|
||||||
for p in part.iter_parts():
|
for p in part.iter_parts():
|
||||||
if text_body and p == text_body:
|
if text_body and p == text_body:
|
||||||
@@ -173,8 +174,8 @@ def inject_body_part(part, content, subtype="plain"):
|
|||||||
boundary = part.get_boundary()
|
boundary = part.get_boundary()
|
||||||
p_subtype = part.get_content_subtype()
|
p_subtype = part.get_content_subtype()
|
||||||
part.clear_content()
|
part.clear_content()
|
||||||
if text_body:
|
if text_content != None:
|
||||||
part.set_content(content)
|
part.set_content(text_content)
|
||||||
part.add_alternative(content, subtype=subtype)
|
part.add_alternative(content, subtype=subtype)
|
||||||
else:
|
else:
|
||||||
part.set_content(content, subtype=subtype)
|
part.set_content(content, subtype=subtype)
|
||||||
|
|||||||
4
setup.py
4
setup.py
@@ -18,7 +18,7 @@ setup(name = "pyquarantine",
|
|||||||
# 3 - Alpha
|
# 3 - Alpha
|
||||||
# 4 - Beta
|
# 4 - Beta
|
||||||
# 5 - Production/Stable
|
# 5 - Production/Stable
|
||||||
"Development Status :: 4 - Beta",
|
"Development Status :: 5 - Production/Stable",
|
||||||
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
|
"License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
@@ -49,5 +49,5 @@ setup(name = "pyquarantine",
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
install_requires = ["pymilter", "jsonschema", "netaddr", "beautifulsoup4[lxml]", "peewee"],
|
install_requires = ["pymilter", "jsonschema", "netaddr", "beautifulsoup4[lxml]", "peewee"],
|
||||||
python_requires = ">=3.8"
|
python_requires = ">=3.9"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user