Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Commit

Permalink
Merge pull request #62 from videlec/master
Browse files Browse the repository at this point in the history
Create the log directory during the __init__
  • Loading branch information
fchapoton committed Apr 24, 2015
2 parents 74ec81e + 4e4ca6c commit e097569
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/patchbot.py
Expand Up @@ -294,6 +294,14 @@ def __init__(self, sage_root, server, config_path, dry_run,
self.dry_run = dry_run
self.plugin_only = plugin_only
self.config_path = config_path

self.log_dir = os.path.join(self.sage_root, 'logs', 'patchbot')
if not os.path.exists(self.log_dir):
os.makedirs(self.log_dir)
# Make sure this file is writable.
handle = open(os.path.join(self.log_dir, 'install.log'), 'a')
handle.close()

self.reload_config()
self.last_pull = 0
self.to_skip = {}
Expand Down Expand Up @@ -718,9 +726,6 @@ def test_a_ticket(self, ticket=None, verbose=False):
print(ticket['title'])
print("score", rating)
print("\n" * 2)
self.log_dir = self.sage_root + "/logs/patchbot"
if not os.path.exists(self.log_dir):
os.makedirs(self.log_dir)
log = '%s/%s-log.txt' % (self.log_dir, ticket['id'])
history = open("%s/history.txt" % self.log_dir, "a")
history.write("%s %s\n" % (datetime(), ticket['id']))
Expand Down Expand Up @@ -1110,13 +1115,6 @@ def main(args):
print "WARNING: Do not use this copy of sage while the patchbot is running."
ensure_free_space(options.sage_root)

log_dir = options.sage_root + "/logs"
if not os.path.exists(log_dir):
os.makedirs(log_dir)
# Make sure this file is writable.
handle = open(os.path.join(log_dir, 'install.log'), 'a')
handle.close()

if conf['use_ccache']:
do_or_die("'%s'/sage -i ccache" % options.sage_root, exn_class=ConfigException)
# If we rebuild the (same) compiler we still want to share the cache.
Expand Down

0 comments on commit e097569

Please sign in to comment.