get compiling with python 3.10 and remove pipenv for build

This commit is contained in:
Balakrishnan Balasubramanian 2023-06-14 11:00:09 -04:00
parent eacb03f84e
commit 0d4faa0859
4 changed files with 18 additions and 10 deletions

View File

@ -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 \

View File

@ -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)

View File

@ -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),

5
requirements.txt Normal file
View File

@ -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