summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/__init__.py0
-rw-r--r--pkg/leap_mx50
-rw-r--r--pkg/mx-requirements.pip4
-rw-r--r--pkg/requirements.pip12
-rw-r--r--pkg/utils/__init__.py0
-rw-r--r--pkg/utils/reqs.py72
6 files changed, 134 insertions, 4 deletions
diff --git a/pkg/__init__.py b/pkg/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pkg/__init__.py
diff --git a/pkg/leap_mx b/pkg/leap_mx
new file mode 100644
index 0000000..d2c4bc3
--- /dev/null
+++ b/pkg/leap_mx
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+pidfile=/var/run/leap_mx.pid \
+rundir=/var/lib/leap_mx/ \
+file=/etc/leap/mx \
+logfile=/var/log/leap_mx.log
+
+[ -r /etc/default/leap_mx ] && . /etc/default/leap_mx
+
+test -x /usr/bin/twistd || exit 0
+test -r $file || exit 0
+test -r /etc/leap/ || exit 0
+
+
+case "$1" in
+ start)
+ echo -n "Starting leap_mx: twistd"
+ start-stop-daemon --start --quiet --exec /usr/bin/twistd -- \
+ --pidfile=$pidfile \
+ --rundir=$rundir \
+ --python=$file \
+ --logfile=$logfile
+ echo "."
+ ;;
+
+ stop)
+ echo -n "Stopping leap_mx: twistd"
+ start-stop-daemon --stop --quiet \
+ --pidfile $pidfile
+ echo "."
+ ;;
+
+ restart)
+ $0 stop
+ $0 start
+ ;;
+
+ force-reload)
+ $0 restart
+ ;;
+
+ *)
+ echo "Usage: /etc/init.d/leap_mx {start|stop|restart|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0 \ No newline at end of file
diff --git a/pkg/mx-requirements.pip b/pkg/mx-requirements.pip
deleted file mode 100644
index a05ac98..0000000
--- a/pkg/mx-requirements.pip
+++ /dev/null
@@ -1,4 +0,0 @@
-Twisted
-paisley>=0.3.1
-## xxx change me to whatever you name the package in pypi
-python-gnupg>=0.3.0
diff --git a/pkg/requirements.pip b/pkg/requirements.pip
new file mode 100644
index 0000000..dc39dca
--- /dev/null
+++ b/pkg/requirements.pip
@@ -0,0 +1,12 @@
+Twisted>=12.0.2
+paisley>=0.3.1
+## XXX change me to whatever you name the package in pypi
+python-gnupg>=0.3.0
+leap.common>=0.0.2-dev
+
+###############
+# Development #
+###############
+
+#leap.soledad # make this a dep as soon as it is installable from pypi !!
+-e git://github.com/andrejb/soledad.git@develop#egg=leap.soledad
diff --git a/pkg/utils/__init__.py b/pkg/utils/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/pkg/utils/__init__.py
diff --git a/pkg/utils/reqs.py b/pkg/utils/reqs.py
new file mode 100644
index 0000000..5e2324f
--- /dev/null
+++ b/pkg/utils/reqs.py
@@ -0,0 +1,72 @@
+# -*- coding: utf-8 -*-
+# reqs.py
+# Copyright (C) 2013 LEAP
+#
+# This program 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 3 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+Utils to help in the setup process
+"""
+import os
+import re
+import sys
+
+
+def get_reqs_from_files(reqfiles):
+ """
+ Returns the contents of the top requirement file listed as a
+ string list with the lines
+
+ @param reqfiles: requirement files to parse
+ @type reqfiles: list of str
+ """
+ for reqfile in reqfiles:
+ if os.path.isfile(reqfile):
+ return open(reqfile, 'r').read().split('\n')
+
+
+def parse_requirements(reqfiles=['requirements.txt',
+ 'requirements.pip',
+ 'pkg/requirements.pip']):
+ """
+ Parses the requirement files provided.
+
+ @param reqfiles: requirement files to parse
+ @type reqfiles: list of str
+ """
+
+ requirements = []
+ for line in get_reqs_from_files(reqfiles):
+ # -e git://foo.bar/baz/master#egg=foobar
+ if re.match(r'\s*-e\s+', line):
+ pass
+ # do not try to do anything with externals on vcs
+ #requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1',
+ #line))
+ # http://foo.bar/baz/foobar/zipball/master#egg=foobar
+ elif re.match(r'\s*https?:', line):
+ requirements.append(re.sub(r'\s*https?:.*#egg=(.*)$', r'\1',
+ line))
+ # -f lines are for index locations, and don't get used here
+ elif re.match(r'\s*-f\s+', line):
+ pass
+
+ # argparse is part of the standard library starting with 2.7
+ # adding it to the requirements list screws distro installs
+ elif line == 'argparse' and sys.version_info >= (2, 7):
+ pass
+ else:
+ if line != '':
+ requirements.append(line)
+
+ return requirements