Skip to content

Commit

Permalink
more config path fixes, #1064
Browse files Browse the repository at this point in the history
  • Loading branch information
pefoley2 committed Apr 26, 2015
1 parent e2cbe6e commit 349df78
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
3 changes: 1 addition & 2 deletions helpers/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def reload_handler(self, c, e):
self.reload_event.clear()


def init(confdir=None):
def init(confdir="/etc/cslbot"):
"""The bot's main entry point.
| Initialize the bot and start processing messages.
Expand All @@ -175,7 +175,6 @@ def init(confdir=None):
loglevel = logging.DEBUG if args.debug else logging.INFO
logging.basicConfig(level=loglevel)

confdir = confdir if confdir is not None else "/etc/cslbot"
config_file = path.join(confdir, 'config.cfg')
if not path.exists(config_file):
logging.info("Setting up config file")
Expand Down
8 changes: 4 additions & 4 deletions scripts/gen_babble.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
from helpers.sql import get_session


def main(srcdir=None):
def main(confdir="/etc/cslbot"):
config = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation())
srcdir = srcdir if srcdir is not None else "FIXME"
with open(join(srcdir, '../config.cfg')) as f:
with open(join(confdir, 'config.cfg')) as f:
config.read_file(f)
parser = argparse.ArgumentParser()
parser.add_argument('--nick', help='The nick to generate babble cache for (testing only).')
Expand All @@ -52,4 +51,5 @@ def main(srcdir=None):


if __name__ == '__main__':
main(dirname(__file__))
# If we're running from a git checkout, override the config path.
main(join(dirname(__file__), '..'))
8 changes: 4 additions & 4 deletions scripts/parsedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,9 @@ def output_urls(env, session, outdir, time):
f.write(output)


def main(srcdir=None):
def main(confdir="/etc/cslbot"):
config = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation())
srcdir = srcdir if srcdir is not None else "FIXME"
with open(join(srcdir, '../config.cfg')) as f:
with open(join(confdir, 'config.cfg')) as f:
config.read_file(f)
parser = argparse.ArgumentParser()
parser.add_argument('outdir', help='The output dir.')
Expand All @@ -142,4 +141,5 @@ def main(srcdir=None):


if __name__ == '__main__':
main(dirname(__file__))
# If we're running from a git checkout, override the config path.
main(join(dirname(__file__), '..'))
8 changes: 4 additions & 4 deletions scripts/parselogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,9 @@ def gen_log(row):
return log


def main(srcdir=None):
def main(confdir="/etc/cslbot"):
config = configparser.ConfigParser(interpolation=configparser.ExtendedInterpolation())
srcdir = srcdir if srcdir is not None else "FIXME"
with open(join(srcdir, '../config.cfg')) as f:
with open(join(confdir, 'config.cfg')) as f:
config.read_file(f)
session = get_session(config)()
parser = argparse.ArgumentParser()
Expand All @@ -126,4 +125,5 @@ def main(srcdir=None):


if __name__ == '__main__':
main(dirname(__file__))
# If we're running from a git checkout, override the config path.
main(join(dirname(__file__), '..'))

0 comments on commit 349df78

Please sign in to comment.