From 46df744170ee3c7599d48845db092c1456fb4dca Mon Sep 17 00:00:00 2001 From: Riku Lindblad Date: Wed, 2 Mar 2016 15:46:25 +0200 Subject: [PATCH] run.sh now uses virtualenv properly --- pyfibot/modules/module_update.py | 7 +++++-- run.sh | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pyfibot/modules/module_update.py b/pyfibot/modules/module_update.py index 6891d25..932b2f2 100644 --- a/pyfibot/modules/module_update.py +++ b/pyfibot/modules/module_update.py @@ -1,3 +1,4 @@ + from __future__ import unicode_literals, print_function, division import subprocess import sys @@ -38,7 +39,7 @@ def command_update(bot, user, channel, args): bot.say(channel, "Errors: %s" % err) # fetch new required packages if needed - cmd = ['../bin/pip', 'install', '-r', '../requirements.txt'] + cmd = ['pip', 'install', '--upgrade', '--requirement', '../requirements.txt'] log.debug("executing pip install in %s" % cwd) p = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -46,9 +47,11 @@ def command_update(bot, user, channel, args): out, err = p.communicate() if res: - bot.say(channel, "Update failed:") + bot.say(channel, "Package update failed:") for line in out.split("\n"): bot.say(channel, "%s" % line) + for line in err.split("\n"): + bot.say(channel, "%s" % line) else: bot.say(channel, "Package status OK") pip_ok = True diff --git a/run.sh b/run.sh index 978e84a..16078c2 100755 --- a/run.sh +++ b/run.sh @@ -1,6 +1,7 @@ -#!/bin/sh +#!/bin/bash if [ ! -x databases/ ]; then mkdir databases fi; -bin/python pyfibot/pyfibot.py config.yml +source bin/activate +python pyfibot/pyfibot.py config.yml