fix issues with config file and package files
This commit is contained in:
parent
f8f666f365
commit
7d88234987
@ -21,6 +21,7 @@ import os
|
||||
import subprocess
|
||||
import sys
|
||||
import yaml
|
||||
import pkg_resources
|
||||
import platformdirs
|
||||
|
||||
from sqlalchemy import create_engine, delete, select, or_
|
||||
@ -71,11 +72,11 @@ class BBS():
|
||||
platformdirs.user_config_dir(appname='rsbbs', ensure_exists=True),
|
||||
'config.yaml'
|
||||
)
|
||||
print(config_path)
|
||||
# If the file doesn't exist there, create it
|
||||
if not os.path.exists(config_path):
|
||||
config_template_path = os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
'config_default.yaml')
|
||||
config_template_path = pkg_resources.resource_filename(
|
||||
__name__, 'config_default.yaml')
|
||||
try:
|
||||
with open(config_template_path, 'r') as f:
|
||||
config_template = yaml.load(f, Loader=yaml.FullLoader)
|
||||
@ -442,7 +443,7 @@ class BBS():
|
||||
# Show greeting
|
||||
greeting = []
|
||||
greeting.append(f"[RSBBS-1.0.0] listening on "
|
||||
f"{self.config['callsign']}")
|
||||
f"{self.config['callsign']} ")
|
||||
greeting.append(f"Welcome to {self.config['bbs_name']}, "
|
||||
f"{self.calling_station}")
|
||||
greeting.append(self.config['banner_message'])
|
||||
|
||||
@ -5,9 +5,10 @@
|
||||
# Basic BBS info
|
||||
|
||||
bbs_name: Really Simple BBS
|
||||
callsign: KI5QKX-10
|
||||
banner_message: KI5QKX-10 welcomes you
|
||||
command_prompt: "ENTER COMMAND >"
|
||||
callsign: N0CALL
|
||||
banner_message: Leave a message!
|
||||
|
||||
command_prompt: ENTER COMMAND >
|
||||
|
||||
|
||||
# Logging
|
||||
@ -35,9 +35,9 @@ def main():
|
||||
['-d', '--debug', 'store_true', None, 'debug',
|
||||
'Enable debugging output to stdout', False],
|
||||
['-s', '--calling-station', 'store', 'N0CALL', 'calling_station',
|
||||
'The callsign of the calling station', True],
|
||||
['-f', '--config-file', 'store', 'config.yaml', 'config_file',
|
||||
'specify path to config.yaml file', False],
|
||||
'Callsign of the calling station', True],
|
||||
['-f', '--config-file', 'store', None, 'config_file',
|
||||
'Path to config.yaml file', False],
|
||||
]
|
||||
for arg in args_list:
|
||||
sysv_parser.add_argument(
|
||||
|
||||
4
setup.py
4
setup.py
@ -35,7 +35,9 @@ setup(
|
||||
url='https://git.b-wells.us/jmbwell/rsbbs',
|
||||
license=license,
|
||||
packages=find_packages(exclude=('tests', 'docs')),
|
||||
data_files=[('config', ['config/config_default.yaml'])],
|
||||
package_data={
|
||||
'rsbbs': ['config_default.yaml'],
|
||||
},
|
||||
entry_points="""
|
||||
[console_scripts]
|
||||
rsbbs=rsbbs.rsbbs:main
|
||||
|
||||
Loading…
Reference in New Issue
Block a user