tidy up
This commit is contained in:
parent
b3af55572e
commit
b951e9c453
@ -1 +1,4 @@
|
||||
greenlet==2.0.2
|
||||
PyYAML==6.0
|
||||
SQLAlchemy==2.0.10
|
||||
typing_extensions==4.5.0
|
||||
|
||||
@ -1 +1 @@
|
||||
__all__ = ["bbs", "message", "project_root"]
|
||||
__all__ = ["bbs", "message", "parser", "project_root"]
|
||||
20
rsbbs/bbs.py
20
rsbbs/bbs.py
@ -6,7 +6,6 @@ import yaml
|
||||
|
||||
from sqlalchemy import create_engine, delete, select
|
||||
from sqlalchemy.orm import Session
|
||||
from typing import *
|
||||
|
||||
from rsbbs.message import Message, Base
|
||||
from rsbbs.parser import Parser
|
||||
@ -18,10 +17,15 @@ class BBS():
|
||||
|
||||
def __init__(self, sysv_args):
|
||||
|
||||
self.config = self.load_config(sysv_args.config_file)
|
||||
self.sysv_args = sysv_args
|
||||
|
||||
self.config = self.load_config(sysv_args.config_file)
|
||||
|
||||
self.calling_station = sysv_args.calling_station
|
||||
|
||||
self.engine = self.init_engine()
|
||||
self.parser = self.init_parser()
|
||||
|
||||
logging.config.dictConfig(self.config['logging'])
|
||||
|
||||
@property
|
||||
@ -56,8 +60,7 @@ class BBS():
|
||||
|
||||
# Set up the BBS command parser
|
||||
|
||||
@property
|
||||
def parser(self):
|
||||
def init_parser(self):
|
||||
commands = [
|
||||
# (name, aliases, helpmsg, function, {arg: {arg attributes}, ...})
|
||||
('bye', ['b', 'q'], 'Sign off and disconnect', self.bye, {}),
|
||||
@ -93,18 +96,13 @@ class BBS():
|
||||
|
||||
# Database
|
||||
|
||||
@property
|
||||
def engine(self):
|
||||
def init_engine(self):
|
||||
engine = create_engine('sqlite:///messages.db', echo=self.sysv_args.debug)
|
||||
Base.metadata.create_all(engine)
|
||||
return engine
|
||||
|
||||
|
||||
# Input and output
|
||||
|
||||
@property
|
||||
def input_stream(self):
|
||||
return sys.stdin
|
||||
|
||||
def read_line(self, prompt):
|
||||
output = None
|
||||
@ -260,7 +258,7 @@ class BBS():
|
||||
self.write_output(self.config['command_prompt'])
|
||||
|
||||
# Parse the BBS interactive commands for the rest of time
|
||||
for line in self.input_stream:
|
||||
for line in sys.stdin:
|
||||
try:
|
||||
args = self.parser.parse_args(line.split())
|
||||
args.func(args)
|
||||
|
||||
@ -1,10 +1,7 @@
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from sqlalchemy import *
|
||||
from sqlalchemy.orm import *
|
||||
from typing import *
|
||||
|
||||
# engine = create_engine('sqlite:///messages.db', echo=True)
|
||||
from sqlalchemy import Boolean, DateTime, String
|
||||
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
|
||||
|
||||
class Base(DeclarativeBase):
|
||||
pass
|
||||
|
||||
9
setup.py
9
setup.py
@ -11,7 +11,7 @@ setup(
|
||||
author='John Burwell',
|
||||
author_email='john@atatdotdot.com',
|
||||
|
||||
url='https://github.com/jmbwell/really-simple-bbs',
|
||||
url='https://git.b-wells.us/jmbwell/rsbbs',
|
||||
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3",
|
||||
@ -31,12 +31,15 @@ setup(
|
||||
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'really-simple-bbs = main:main',
|
||||
'main.py = main:main',
|
||||
],
|
||||
},
|
||||
|
||||
install_requires=[
|
||||
'PyYAML==4.2b1',
|
||||
'greenlet==2.0.2',
|
||||
'PyYAML==6.0',
|
||||
'SQLAlchemy==2.0.10',
|
||||
'typing_extensions==4.5.0',
|
||||
],
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user