diff options
author | Kali Kaneko <kali@leap.se> | 2015-07-22 12:23:18 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2015-07-22 16:38:30 -0400 |
commit | 46de0ce8859d9fb5265b90e38bbc05138a254cc3 (patch) | |
tree | f805e2e55af3c9c6879eddd09c3b85ac5502be94 | |
parent | 1646b018bda0d40b38c747932029a41b8a7c8536 (diff) |
[pkg] separate leap requirements
this is part of a process to make the setup of the development mode less
troublesome. from now on, setting up a virtualenv in pure development
mode will be as easy as telling pip to just install the external
dependencies::
pip install -r pkg/requirements.pip
and traversing all the leap repos for the needed leap dependencies doing::
python setup.py develop
- Related: #7288
-rw-r--r-- | mail/pkg/requirements-leap.pip | 3 | ||||
-rw-r--r-- | mail/pkg/requirements.pip | 3 | ||||
-rw-r--r-- | mail/pkg/utils.py | 29 | ||||
-rw-r--r-- | mail/setup.py | 18 |
4 files changed, 43 insertions, 10 deletions
diff --git a/mail/pkg/requirements-leap.pip b/mail/pkg/requirements-leap.pip new file mode 100644 index 0000000..f50487e --- /dev/null +++ b/mail/pkg/requirements-leap.pip @@ -0,0 +1,3 @@ +leap.common>=0.4.0 +leap.soledad.client>=0.7.0 +leap.keymanager>=0.4.0 diff --git a/mail/pkg/requirements.pip b/mail/pkg/requirements.pip index d77059a..0caa66b 100644 --- a/mail/pkg/requirements.pip +++ b/mail/pkg/requirements.pip @@ -1,7 +1,4 @@ zope.interface -leap.soledad.client>=0.7.0 -leap.common>=0.4.0 -leap.keymanager>=0.4.0 twisted # >= 12.0.3 ?? zope.proxy service-identity diff --git a/mail/pkg/utils.py b/mail/pkg/utils.py index deace14..d168010 100644 --- a/mail/pkg/utils.py +++ b/mail/pkg/utils.py @@ -14,20 +14,34 @@ # # 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 is_develop_mode(): + """ + Returns True if we're calling the setup script using the argument for + setuptools development mode. + + This avoids messing up with dependency pinning and order, the + responsibility of installing the leap dependencies is left to the + developer. + """ + args = sys.argv + devflags = "setup.py", "develop" + if (args[0], args[1]) == devflags: + return True + return False + + def get_reqs_from_files(reqfiles): """ Returns the contents of the top requirement file listed as a - string list with the lines + string list with the lines. @param reqfiles: requirement files to parse @type reqfiles: list of str @@ -43,6 +57,9 @@ def parse_requirements(reqfiles=['requirements.txt', """ Parses the requirement files provided. + The passed reqfiles list is a list of possible locations to try, the + function will return the contents of the first path found. + Checks the value of LEAP_VENV_SKIP_PYSIDE to see if it should return PySide as a dep or not. Don't set, or set to 0 if you want to install it through pip. @@ -58,9 +75,9 @@ def parse_requirements(reqfiles=['requirements.txt', 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 + # 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)) diff --git a/mail/setup.py b/mail/setup.py index 499a9ee..ead8982 100644 --- a/mail/setup.py +++ b/mail/setup.py @@ -111,6 +111,22 @@ cmdclass["freeze_debianver"] = freeze_debianver # XXX add ref to docs +requirements = utils.parse_requirements() + +if utils.is_develop_mode(): + print + print ("[WARNING] Skipping leap-specific dependencies " + "because development mode is detected.") + print ("[WARNING] You can install " + "the latest published versions with " + "'pip install -r pkg/requirements-leap.pip'") + print ("[WARNING] Or you can instead do 'python setup.py develop' " + "from the parent folder of each one of them.") + print +else: + requirements += utils.parse_requirements( + reqfiles=["pkg/requirements-leap.pip"]) + setup( name='leap.mail', version=VERSION, @@ -130,7 +146,7 @@ setup( package_dir={'': 'src'}, packages=find_packages('src'), test_suite='leap.mail.load_tests.load_tests', - install_requires=utils.parse_requirements(), + install_requires=requirements, tests_require=utils.parse_requirements( reqfiles=['pkg/requirements-testing.pip']), ) |