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