From 5ff29dc57e2877a14e705d09b7042cddf4165d0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Wed, 6 Mar 2013 15:27:23 -0300 Subject: Remove everything to start from scratch --- pkg/utils.py | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 pkg/utils.py (limited to 'pkg/utils.py') diff --git a/pkg/utils.py b/pkg/utils.py deleted file mode 100644 index 52680ae5..00000000 --- a/pkg/utils.py +++ /dev/null @@ -1,42 +0,0 @@ -""" -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 -- cgit v1.2.3 From caba70c5cee5e772761f9bbb2e4a9c5beab0be1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Thu, 7 Mar 2013 19:38:42 -0300 Subject: Add setup script and linux distribution files --- pkg/utils.py | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 pkg/utils.py (limited to 'pkg/utils.py') diff --git a/pkg/utils.py b/pkg/utils.py new file mode 100644 index 00000000..c6c57652 --- /dev/null +++ b/pkg/utils.py @@ -0,0 +1,55 @@ +""" +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): + 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 -- cgit v1.2.3 From 51624331cdc592c322eb8ab2aad8c0e889cca0bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Touceda?= Date: Mon, 11 Mar 2013 16:53:39 -0300 Subject: Add PySide as a dependency and a way to skip it through an env var --- pkg/utils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'pkg/utils.py') diff --git a/pkg/utils.py b/pkg/utils.py index c6c57652..0b1ea019 100644 --- a/pkg/utils.py +++ b/pkg/utils.py @@ -23,13 +23,18 @@ def parse_requirements(reqfiles=['requirements.txt', 'requirements.pip', 'pkg/requirements.pip']): """ - Parses the requirement files provided + Parses the requirement files provided. + + 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. @param reqfiles: requirement files to parse @type reqfiles: list of str """ requirements = [] + skip_pyside = os.getenv("LEAP_VENV_SKIP_PYSIDE", "0") != "0" for line in get_reqs_from_files(reqfiles): # -e git://foo.bar/baz/master#egg=foobar if re.match(r'\s*-e\s+', line): @@ -47,6 +52,8 @@ def parse_requirements(reqfiles=['requirements.txt', # adding it to the requirements list screws distro installs elif line == 'argparse' and sys.version_info >= (2, 7): pass + elif line == 'PySide' and skip_pyside: + pass else: if line != '': requirements.append(line) -- cgit v1.2.3 From 9de7e4be688e7c951552b7e75d4b25e7dded0a15 Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 14 Mar 2013 10:32:00 +0900 Subject: add external leap.common to requirements and modify parse_requirements to skip it for now. --- pkg/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pkg/utils.py') diff --git a/pkg/utils.py b/pkg/utils.py index 0b1ea019..5090f2bd 100644 --- a/pkg/utils.py +++ b/pkg/utils.py @@ -38,8 +38,10 @@ def parse_requirements(reqfiles=['requirements.txt', 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)) + 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', -- cgit v1.2.3 From 534f8a43d74f486629f5046021792868bee2a06a Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 30 May 2013 15:55:01 -0300 Subject: Add comment filter for the requirements parser - filter comments for the result - add licence - remove unused comment --- pkg/utils.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'pkg/utils.py') diff --git a/pkg/utils.py b/pkg/utils.py index 5090f2bd..deace14b 100644 --- a/pkg/utils.py +++ b/pkg/utils.py @@ -1,6 +1,24 @@ +# -*- coding: utf-8 -*- +# utils.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 . + """ Utils to help in the setup process """ + import os import re import sys @@ -56,9 +74,11 @@ def parse_requirements(reqfiles=['requirements.txt', pass elif line == 'PySide' and skip_pyside: pass + # do not include comments + elif line.lstrip().startswith('#'): + pass else: if line != '': requirements.append(line) - #print 'REQUIREMENTS', requirements return requirements -- cgit v1.2.3