Packaging for PyPi; updated README
This commit is contained in:
parent
7e5922e8db
commit
20b14625ad
|
@ -4,3 +4,4 @@ __pycache__
|
|||
localhost/
|
||||
docs/_build/
|
||||
/.vscode
|
||||
/dist/
|
||||
|
|
18
README.md
18
README.md
|
@ -1,18 +1,26 @@
|
|||
# GmCapsule
|
||||
GmCapsule is an extensible Server for [Gemini](https://gemini.circumlunar.space/) and [Titan](gemini://transjovian.org/titan).
|
||||
|
||||
## Extensible Server for Gemini and Titan
|
||||
See the [User manual](https://geminispace.org/gmcapsule/) for configuration and usage instructions.
|
||||
|
||||
The [User manual](https://geminispace.org/gmcapsule/) is generated out of the Python module docstrings.
|
||||
## Installation
|
||||
|
||||
## License
|
||||
Install "gmcapsule" via `pip`:
|
||||
|
||||
This software is under the [BSD 2-Clause](https://opensource.org/licenses/BSD-2-Clause) license.
|
||||
pip install gmcapsule
|
||||
|
||||
Then run the server daemon:
|
||||
|
||||
gmcapsuled
|
||||
|
||||
## Change log
|
||||
|
||||
### v0.2.1
|
||||
* Fixed error handling. Exceptions are now caught and the error message is printed.
|
||||
|
||||
### v0.2
|
||||
* Added `[cgi] bin_root` configuration option for automatically and dynamically mapping all executables in a directory tree to URL entry points.
|
||||
* Minor documentation updates.
|
||||
* Published on PyPi as "gmcapsule".
|
||||
|
||||
### v0.1
|
||||
* Initial public release.
|
|
@ -437,7 +437,7 @@ from .gemini import Server, Cache
|
|||
from .markdown import to_gemtext as markdown_to_gemtext
|
||||
|
||||
|
||||
__version__ = '0.2'
|
||||
__version__ = '0.2.1'
|
||||
__all__ = [
|
||||
'Config', 'Capsule', 'Cache',
|
||||
'get_mime_type', 'markdown_to_gemtext'
|
||||
|
@ -690,3 +690,30 @@ def get_mime_type(path):
|
|||
]).decode('utf-8').strip()
|
||||
except:
|
||||
return 'application/octet-stream'
|
||||
|
||||
|
||||
def run_server():
|
||||
print(f"GmCapsule v{__version__}")
|
||||
|
||||
import argparse
|
||||
argp = argparse.ArgumentParser(
|
||||
description='GmCapsule is an extensible server for Gemini and Titan.')
|
||||
argp.add_argument('-c', '--config',
|
||||
dest='config_file',
|
||||
default=Path.home() / '.gmcapsulerc',
|
||||
help='Configuration file to load at startup')
|
||||
argp.add_argument('--trace-malloc',
|
||||
action='store_true',
|
||||
help='Enable memory allocation tracing (for debugging)')
|
||||
args = argp.parse_args()
|
||||
|
||||
cfg = Config(args.config_file)
|
||||
cfg.debug_memtrace = args.trace_malloc
|
||||
|
||||
try:
|
||||
capsule = Capsule(cfg)
|
||||
capsule.run()
|
||||
return 0
|
||||
except Exception as er:
|
||||
print('ERROR:', er)
|
||||
return -1
|
||||
|
|
|
@ -5,6 +5,7 @@ import fnmatch
|
|||
import gc
|
||||
import hashlib
|
||||
import queue
|
||||
import os.path
|
||||
import select
|
||||
import socket
|
||||
import threading
|
||||
|
@ -540,6 +541,11 @@ class Server:
|
|||
self.caches.append(cache)
|
||||
self.max_upload_size = max_upload_size
|
||||
self.require_upload_identity = require_upload_identity
|
||||
|
||||
if not os.path.exists(cert_path):
|
||||
raise Exception("certificate file not found: " + str(cert_path))
|
||||
if not os.path.exists(key_path):
|
||||
raise Exception("private key file not found: " + str(key_path))
|
||||
|
||||
self.context = SSL.Context(SSL.TLS_SERVER_METHOD)
|
||||
self.context.use_certificate_file(str(cert_path))
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "gmcapsule"
|
||||
description = 'Extensible Gemini/Titan server'
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.7"
|
||||
license = "BSD-2-Clause"
|
||||
keywords = ['server', 'internet', 'gemini', 'titan']
|
||||
authors = [
|
||||
{ name = "Jaakko Keränen", email = "jaakko.keranen@iki.fi" },
|
||||
]
|
||||
classifiers = [
|
||||
"Development Status :: 4 - Beta",
|
||||
"Intended Audience :: Information Technology",
|
||||
"Intended Audience :: System Administrators",
|
||||
"License :: OSI Approved :: BSD License",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Topic :: Internet",
|
||||
"Topic :: System :: Networking"
|
||||
]
|
||||
dependencies = ["pyOpenSSL>=21"]
|
||||
dynamic = ["version"]
|
||||
|
||||
[project.urls]
|
||||
Documentation = "https://geminispace.org/gmcapsule/"
|
||||
Source = "https://git.skyjake.fi/gemini/gmcapsule"
|
||||
Issues = "https://git.skyjake.fi/gemini/gmcapsule/issues"
|
||||
|
||||
[project.scripts]
|
||||
gmcapsuled = "gmcapsule:run_server"
|
||||
|
||||
[tool.hatch.version]
|
||||
path = "gmcapsule/__init__.py"
|
||||
|
||||
[tool.hatch.build]
|
||||
include = [
|
||||
"example.ini",
|
||||
"gmcapsule/*.py",
|
||||
"gmcapsule/modules/*.py"
|
||||
]
|
||||
|
||||
#[tool.hatch.envs.default]
|
||||
#dependencies = [
|
||||
# "pytest",
|
||||
# "pytest-cov",
|
||||
#]
|
||||
#[tool.hatch.envs.default.scripts]
|
||||
#cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=gmcapsule --cov=tests {args}"
|
||||
#no-cov = "cov --no-cov {args}"
|
||||
|
||||
#[[tool.hatch.envs.test.matrix]]
|
||||
#python = ["37", "38", "39", "310", "311"]
|
||||
|
||||
#[tool.coverage.run]
|
||||
#branch = true
|
||||
#parallel = true
|
||||
#omit = [
|
||||
# "gmcapsule/__init__.py",
|
||||
#]
|
||||
|
||||
# [tool.coverage.report]
|
||||
# exclude_lines = [
|
||||
# "no cov",
|
||||
# "if __name__ == .__main__.:",
|
||||
# "if TYPE_CHECKING:",
|
||||
# ]
|
Loading…
Reference in New Issue