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