Bump python requirement to 3.7
This commit is contained in:
parent
69923c0e7a
commit
d478ec7222
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Requires Python 3.6+ and OpenSSL
|
Requires Python 3.7+ and OpenSSL
|
||||||
|
|
||||||
### pip
|
### pip
|
||||||
|
|
||||||
|
|
36
jetforce.py
36
jetforce.py
|
@ -6,7 +6,7 @@ import mimetypes
|
||||||
import os
|
import os
|
||||||
import ssl
|
import ssl
|
||||||
import sys
|
import sys
|
||||||
from typing import Any, Callable, Dict, Iterator, Optional, Union
|
import typing
|
||||||
|
|
||||||
__version__ = "0.0.1"
|
__version__ = "0.0.1"
|
||||||
__title__ = "Jetforce Gemini Server"
|
__title__ = "Jetforce Gemini Server"
|
||||||
|
@ -43,11 +43,11 @@ class EchoApp:
|
||||||
A simple application that echos back the requested path.
|
A simple application that echos back the requested path.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, environ: dict, send_status: Callable) -> None:
|
def __init__(self, environ: dict, send_status: typing.Callable) -> None:
|
||||||
self.environ = environ
|
self.environ = environ
|
||||||
self.send_status = send_status
|
self.send_status = send_status
|
||||||
|
|
||||||
def __iter__(self) -> Iterator[bytes]:
|
def __iter__(self) -> typing.Iterator[bytes]:
|
||||||
self.send_status(STATUS_SUCCESS, "text/plain")
|
self.send_status(STATUS_SUCCESS, "text/plain")
|
||||||
path = self.environ["PATH"]
|
path = self.environ["PATH"]
|
||||||
yield f"Received path: {path}".encode()
|
yield f"Received path: {path}".encode()
|
||||||
|
@ -64,13 +64,13 @@ class StaticDirectoryApp:
|
||||||
|
|
||||||
root: str = "/var/gemini"
|
root: str = "/var/gemini"
|
||||||
|
|
||||||
def __init__(self, environ: dict, send_status: Callable) -> None:
|
def __init__(self, environ: dict, send_status: typing.Callable) -> None:
|
||||||
self.environ = environ
|
self.environ = environ
|
||||||
self.send_status = send_status
|
self.send_status = send_status
|
||||||
|
|
||||||
self.mimetypes = mimetypes.MimeTypes()
|
self.mimetypes = mimetypes.MimeTypes()
|
||||||
|
|
||||||
def __iter__(self) -> Iterator[bytes]:
|
def __iter__(self) -> typing.Iterator[bytes]:
|
||||||
filename = self.environ["PATH"]
|
filename = self.environ["PATH"]
|
||||||
filename = filename.lstrip("/")
|
filename = filename.lstrip("/")
|
||||||
|
|
||||||
|
@ -134,20 +134,20 @@ class GeminiRequestHandler:
|
||||||
removed or slimmed-down.
|
removed or slimmed-down.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, server: "GeminiServer", app: Callable) -> None:
|
def __init__(self, server: "GeminiServer", app: typing.Callable) -> None:
|
||||||
self.server = server
|
self.server = server
|
||||||
self.app = app
|
self.app = app
|
||||||
|
|
||||||
self.reader: Optional[asyncio.StreamReader] = None
|
self.reader: typing.Optional[asyncio.StreamReader] = None
|
||||||
self.writer: Optional[asyncio.StreamWriter] = None
|
self.writer: typing.Optional[asyncio.StreamWriter] = None
|
||||||
|
|
||||||
self.received_timestamp: Optional[datetime.datetime] = None
|
self.received_timestamp: typing.Optional[datetime.datetime] = None
|
||||||
self.client_ip: Optional[str] = None
|
self.client_ip: typing.Optional[str] = None
|
||||||
self.client_port: Optional[int] = None
|
self.client_port: typing.Optional[int] = None
|
||||||
self.path: Optional[str] = None
|
self.path: typing.Optional[str] = None
|
||||||
self.status: Optional[int] = None
|
self.status: typing.Optional[int] = None
|
||||||
self.mimetype: Optional[str] = None
|
self.mimetype: typing.Optional[str] = None
|
||||||
self.response_buffer: Optional[str] = None
|
self.response_buffer: typing.Optional[str] = None
|
||||||
self.response_size: int = 0
|
self.response_size: int = 0
|
||||||
|
|
||||||
async def handle(
|
async def handle(
|
||||||
|
@ -186,7 +186,7 @@ class GeminiRequestHandler:
|
||||||
self.log_request()
|
self.log_request()
|
||||||
await writer.drain()
|
await writer.drain()
|
||||||
|
|
||||||
def build_environ(self) -> Dict[str, Any]:
|
def build_environ(self) -> typing.Dict[str, typing.Any]:
|
||||||
"""
|
"""
|
||||||
Construct a dictionary that will be passed to the application handler.
|
Construct a dictionary that will be passed to the application handler.
|
||||||
"""
|
"""
|
||||||
|
@ -272,8 +272,8 @@ class GeminiServer:
|
||||||
self,
|
self,
|
||||||
host: str,
|
host: str,
|
||||||
port: int,
|
port: int,
|
||||||
ssl_context: Union[tuple, ssl.SSLContext],
|
ssl_context: typing.Union[tuple, ssl.SSLContext],
|
||||||
app: Callable,
|
app: typing.Callable,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
self.host = host
|
self.host = host
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -19,7 +19,7 @@ setuptools.setup(
|
||||||
long_description=long_description(),
|
long_description=long_description(),
|
||||||
py_modules=["jetforce"],
|
py_modules=["jetforce"],
|
||||||
entry_points={"console_scripts": ["jetforce=jetforce:run_server"]},
|
entry_points={"console_scripts": ["jetforce=jetforce:run_server"]},
|
||||||
python_requires=">=3.6",
|
python_requires=">=3.7",
|
||||||
keywords="gemini server tcp gopher asyncio",
|
keywords="gemini server tcp gopher asyncio",
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"Environment :: Web Environment",
|
"Environment :: Web Environment",
|
||||||
|
|
Loading…
Reference in New Issue