new file mode 100644
@@ -0,0 +1,15 @@
+"""Add the <patchwork>/apps and <patchwork>/lib/python directories to
+sys.path.
+
+Also sets the DJANGO_SETTINGS_MODULE environment variable to 'settings'.
+"""
+import os
+import sys
+
+
+patchwork_bin = os.path.dirname(__file__)
+patchwork_base = os.path.abspath(
+ os.path.join(patchwork_bin, '..', '..', '..'))
+sys.path.insert(0, '%s/lib/python' % patchwork_base)
+sys.path.insert(0, '%s/apps' % patchwork_base)
+os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
@@ -41,5 +41,5 @@ ls -1rt "$mail_dir" |
while read line;
do
echo $line
- $PATCHWORK_BINDIR/parsemail.sh < "$mail_dir/$line"
+ $PATCHWORK_BINDIR/parsemail.py < "$mail_dir/$line"
done
@@ -19,6 +19,7 @@
# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+import _pythonpath
import sys
import re
import datetime
deleted file mode 100755
@@ -1,29 +0,0 @@
-#!/bin/sh
-#
-# Patchwork - automated patch tracking system
-# Copyright (C) 2008 Jeremy Kerr <jk@ozlabs.org>
-#
-# This file is part of the Patchwork package.
-#
-# Patchwork is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# Patchwork is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Patchwork; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-BIN_DIR=`dirname $0`
-PATCHWORK_BASE=`readlink -e $BIN_DIR/../../..`
-
-PYTHONPATH="$PATCHWORK_BASE/apps":"$PATCHWORK_BASE/lib/python" \
- DJANGO_SETTINGS_MODULE=settings \
- "$PATCHWORK_BASE/apps/patchwork/bin/parsemail.py"
-
-exit 0
This is so that we don't have to write a wrapper shell script for every python script we have in app/patchwork/bin/. Signed-off-by: Guilherme Salgado <guilherme.salgado@linaro.org> --- apps/patchwork/bin/_pythonpath.py | 15 +++++++++++++++ apps/patchwork/bin/parsemail-batch.sh | 2 +- apps/patchwork/bin/parsemail.py | 1 + apps/patchwork/bin/parsemail.sh | 29 ----------------------------- 4 files changed, 17 insertions(+), 30 deletions(-) create mode 100644 apps/patchwork/bin/_pythonpath.py delete mode 100755 apps/patchwork/bin/parsemail.sh