summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANIFEST.in2
-rw-r--r--pkg/__init__.py0
-rw-r--r--pkg/install_venv.py (renamed from setup/install_venv.py)0
-rw-r--r--pkg/linux/leap.desktop (renamed from setup/linux/leap.desktop)0
-rw-r--r--pkg/linux/polkit/net.openvpn.gui.leap.policy (renamed from setup/linux/polkit/net.openvpn.gui.leap.policy)0
-rw-r--r--pkg/requirements.pip (renamed from setup/requirements.pip)0
-rwxr-xr-xpkg/scripts/leap (renamed from setup/scripts/leap)0
-rw-r--r--pkg/test-requirements.pip (renamed from setup/test-requirements.pip)0
-rwxr-xr-xpkg/tools/with_venv.sh (renamed from setup/tools/with_venv.sh)0
-rw-r--r--pkg/utils.py42
-rwxr-xr-xrun_tests.sh6
-rwxr-xr-xsetup.py15
12 files changed, 51 insertions, 14 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index 3ce64e45..7feaa2b1 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,3 +1,3 @@
# ??? not needed from win
-include setup/linux/polkit/*
+include pkg/linux/polkit/*
include docs/*
diff --git a/pkg/__init__.py b/pkg/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/pkg/__init__.py
diff --git a/setup/install_venv.py b/pkg/install_venv.py
index 15385beb..15385beb 100644
--- a/setup/install_venv.py
+++ b/pkg/install_venv.py
diff --git a/setup/linux/leap.desktop b/pkg/linux/leap.desktop
index 7a6d39d9..7a6d39d9 100644
--- a/setup/linux/leap.desktop
+++ b/pkg/linux/leap.desktop
diff --git a/setup/linux/polkit/net.openvpn.gui.leap.policy b/pkg/linux/polkit/net.openvpn.gui.leap.policy
index 70a22b65..70a22b65 100644
--- a/setup/linux/polkit/net.openvpn.gui.leap.policy
+++ b/pkg/linux/polkit/net.openvpn.gui.leap.policy
diff --git a/setup/requirements.pip b/pkg/requirements.pip
index 96e76d34..96e76d34 100644
--- a/setup/requirements.pip
+++ b/pkg/requirements.pip
diff --git a/setup/scripts/leap b/pkg/scripts/leap
index 6e62b597..6e62b597 100755
--- a/setup/scripts/leap
+++ b/pkg/scripts/leap
diff --git a/setup/test-requirements.pip b/pkg/test-requirements.pip
index 26db61c8..26db61c8 100644
--- a/setup/test-requirements.pip
+++ b/pkg/test-requirements.pip
diff --git a/setup/tools/with_venv.sh b/pkg/tools/with_venv.sh
index 0e58f1ab..0e58f1ab 100755
--- a/setup/tools/with_venv.sh
+++ b/pkg/tools/with_venv.sh
diff --git a/pkg/utils.py b/pkg/utils.py
new file mode 100644
index 00000000..52680ae5
--- /dev/null
+++ b/pkg/utils.py
@@ -0,0 +1,42 @@
+"""
+utils to help in the setup process
+"""
+import os
+import re
+import sys
+
+
+# gets reqs from the first matching file
+def get_reqs_from_files(reqfiles):
+ 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']):
+ 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):
+ 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)
+
+ #print 'REQUIREMENTS', requirements
+ return requirements
diff --git a/run_tests.sh b/run_tests.sh
index ebea30b2..96121d3e 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -39,7 +39,7 @@ function process_option {
}
venv=.venv
-with_venv=setup/tools/with_venv.sh
+with_venv=pkg/tools/with_venv.sh
always_venv=0
never_venv=0
force=0
@@ -99,14 +99,14 @@ then
else
if [ $always_venv -eq 1 ]; then
# Automatically install the virtualenv
- python setup/install_venv.py $installvenvopts
+ python pkg/install_venv.py $installvenvopts
wrapper="${with_venv}"
else
echo -e "No virtual environment found...create one? (Y/n) \c"
read use_ve
if [ "x$use_ve" = "xY" -o "x$use_ve" = "x" -o "x$use_ve" = "xy" ]; then
# Install the virtualenv and run the test suite in it
- python setup/install_venv.py $installvenvopts
+ python pkg/install_venv.py $installvenvopts
wrapper=${with_venv}
fi
fi
diff --git a/setup.py b/setup.py
index d907ab58..eea9b801 100755
--- a/setup.py
+++ b/setup.py
@@ -15,6 +15,8 @@ except ImportError:
from setuptools import setup, find_packages
import os
+from pkg import utils
+
# XXX get version from somewhere else
version = '0.1.0'
@@ -63,14 +65,7 @@ setup(
# XXX fixme move resource reloading
# to this setup script.
- # XXX should implement a parse_requirements
- # and get them from the pip reqs. workaround needed
- # for argparse and <=2.6
- install_requires=[
- # -*- Extra requirements: -*-
- "configuration",
- "requests",
- ],
+ install_requires=utils.parse_requirements(),
test_suite='nose.collector',
# XXX change to parse_test_requirements and
@@ -95,10 +90,10 @@ setup(
("share/man/man1",
["docs/leap.1"]),
("share/polkit-1/actions",
- ["setup/linux/polkit/net.openvpn.gui.leap.policy"])
+ ["pkg/linux/polkit/net.openvpn.gui.leap.policy"])
],
platforms="all",
- scripts=["setup/scripts/leap"],
+ scripts=["pkg/scripts/leap"],
entry_points="""
# -*- Entry points: -*-
""",