From 0d4faa08593ebe1fd0c00092d72245b5f0f30093 Mon Sep 17 00:00:00 2001 From: Balakrishnan Balasubramanian Date: Wed, 14 Jun 2023 11:00:09 -0400 Subject: [PATCH] get compiling with python 3.10 and remove pipenv for build --- Makefile | 11 +++++++---- mail4one/config.py | 2 +- mail4one/smtp.py | 10 +++++----- requirements.txt | 5 +++++ 4 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 requirements.txt diff --git a/Makefile b/Makefile index e5bd2e4..095e237 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,14 @@ shell: test: pipenv run python -m unittest discover -build: clean - pipenv run python -m pip install -r <(pipenv requirements ) --target build +requirements.txt: Pipfile.lock + pipenv requirements > requirements.txt + +build: clean requirements.txt + python3 -m pip install -r requirements.txt --target build cp -r mail4one/ build/ - pipenv run python -m compileall build/mail4one -f - pipenv run python -m zipapp \ + python3 -m compileall build/mail4one -f + python3 -m zipapp \ --output mail4one.pyz \ --python "/usr/bin/env python3" \ --main mail4one.server:main \ diff --git a/mail4one/config.py b/mail4one/config.py index 1b30710..1da0e25 100644 --- a/mail4one/config.py +++ b/mail4one/config.py @@ -125,6 +125,6 @@ def get_mboxes(addr: str, checks: list[Checker]) -> list[str]: return list(inner()) -def gen_addr_to_mboxes(cfg: Config) -> Callable[[str], [str]]: +def gen_addr_to_mboxes(cfg: Config) -> Callable[[str], list[str]]: checks = parse_checkers(cfg) return lambda addr: get_mboxes(addr, checks) diff --git a/mail4one/smtp.py b/mail4one/smtp.py index cb167b6..d28730b 100644 --- a/mail4one/smtp.py +++ b/mail4one/smtp.py @@ -23,7 +23,7 @@ from aiosmtpd.smtp import Session as SMTPSession class MyHandler(AsyncMessage): - def __init__(self, mails_path: Path, mbox_finder: Callable[[str], [str]]): + def __init__(self, mails_path: Path, mbox_finder: Callable[[str], list[str]]): super().__init__() self.mails_path = mails_path self.mbox_finder = mbox_finder @@ -54,7 +54,7 @@ class MyHandler(AsyncMessage): def protocol_factory_starttls(mails_path: Path, - mbox_finder: Callable[[str], [str]], + mbox_finder: Callable[[str], list[str]], context: ssl.SSLContext): logging.info("Got smtp client cb starttls") try: @@ -69,7 +69,7 @@ def protocol_factory_starttls(mails_path: Path, return smtp -def protocol_factory(mails_path: Path, mbox_finder: Callable[[str], [str]]): +def protocol_factory(mails_path: Path, mbox_finder: Callable[[str], list[str]]): logging.info("Got smtp client cb") try: handler = MyHandler(mails_path, mbox_finder) @@ -83,7 +83,7 @@ def protocol_factory(mails_path: Path, mbox_finder: Callable[[str], [str]]): async def create_smtp_server_starttls(host: str, port: int, mails_path: Path, - mbox_finder: Callable[[str], [str]], + mbox_finder: Callable[[str], list[str]], ssl_context: ssl.SSLContext) -> asyncio.Server: loop = asyncio.get_event_loop() return await loop.create_server(partial(protocol_factory_starttls, @@ -96,7 +96,7 @@ async def create_smtp_server_starttls(host: str, async def create_smtp_server(host: str, port: int, mails_path: Path, - mbox_finder: Callable[[str], [str]], + mbox_finder: Callable[[str], list[str]], ssl_context: ssl.SSLContext | None = None) -> asyncio.Server: loop = asyncio.get_event_loop() return await loop.create_server(partial(protocol_factory, mails_path, mbox_finder), diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..068384e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +-i https://pypi.org/simple +aiosmtpd==1.4.4.post2 +atpublic==4.0 ; python_version >= '3.8' +attrs==23.1.0 ; python_version >= '3.7' +python-jata==1.2