Repository: nephila/djangocms-installer (python)

Issue:
allow passing custom `pip install` options like `--no-index --find-links=~/wheels/`
I usually pass `--find-links=~/wheels/` to `pip install` to cache all downloaded packages. please add `--pip-options` so I can type something like this 

```
djangocms-installer --pip-options="--no-index --find-links=~/wheels/" -p my_demo -f my_demo 
```


Pull request:
fixes #201: allow passing custom pip options

Patch:
diff --git a/.gitignore b/.gitignore
index 3b69057..355ecd1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,7 +17,6 @@ develop-eggs
 .installed.cfg
 lib
 lib64
-.eggs
 
 # Installer logs
 pip-log.txt
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
deleted file mode 100644
index c9ed0a3..0000000
--- a/.gitlab-ci.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file is generated by GitLab CI
-ci:
-  script:
-    - COMMAND="coverage run" tox -epy26,py27,py33,py34
-    - if [[ $? -eq 0 ]]; then coverage report; fi
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index d638e92..793d556 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,6 @@ language: python
 sudo: false
 
 python:
-  - 3.5
   - 3.4
   - 3.3
   - 2.7
@@ -21,9 +20,13 @@ install:
   - "if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then export TOX_ENV=py27; fi"
   - "if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then export TOX_ENV=py33; fi"
   - "if [[ $TRAVIS_PYTHON_VERSION == '3.4' ]]; then export TOX_ENV=py34; fi"
-  - "if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then export TOX_ENV=py35; fi"
 
 # command to run tests, e.g. python setup.py test
 script: COMMAND='coverage run --source=djangocms_installer' tox -e$TOX_ENV
 
 after_success: coveralls
+
+matrix:
+  allow_failures:
+    - python: 3.3
+    - python: 3.4
diff --git a/config.ini.sample b/config.ini.sample
index ec33ae2..25cf9bf 100644
--- a/config.ini.sample
+++ b/config.ini.sample
@@ -9,6 +9,7 @@ languages =
 django-version = stable
 cms-version = stable
 parent-dir = .
+pip-options =
 bootstrap = no
 templates = no
 starting-page = no
diff --git a/djangocms_installer/config/__init__.py b/djangocms_installer/config/__init__.py
index c0475c0..50a228b 100644
--- a/djangocms_installer/config/__init__.py
+++ b/djangocms_installer/config/__init__.py
@@ -44,6 +44,7 @@ def parse(args):
     parser.add_argument('--permissions', dest='permissions', action='store',
                         choices=('yes', 'no'),
                         default='yes', help='Activate CMS permission management')
+    parser.add_argument('--pip-options', help='pass custom pip options', default='')
     parser.add_argument('--languages', '-l', dest='languages', action='append',
                         help='Languages to enable. Option can be provided multiple times, or as a comma separated list. '
                         'Only language codes supported by Django can be used here')
diff --git a/djangocms_installer/config/data.py b/djangocms_installer/config/data.py
index 27247f8..f6111ef 100644
--- a/djangocms_installer/config/data.py
+++ b/djangocms_installer/config/data.py
@@ -24,15 +24,15 @@ CMS_VERSION_MATRIX = {
 }
 DJANGO_VERSION_MATRIX = {
     'stable': 1.7,
-    'rc': 1.9,
-    'beta': 1.9,
-    'develop': 1.9
+    'rc': 1.8,
+    'beta': 1.8,
+    'develop': 1.8
 }
 VERSION_MATRIX = {
     2.4: (1.4, 1.5),
     3.0: (1.4, 1.7),
-    3.1: (1.6, 1.9),
-    3.2: (1.6, 1.9),
+    3.1: (1.6, 1.8),
+    3.2: (1.6, 1.8),
 }
 
 REQUIREMENTS = {
diff --git a/djangocms_installer/install/__init__.py b/djangocms_installer/install/__init__.py
index aab1f62..3813b24 100644
--- a/djangocms_installer/install/__init__.py
+++ b/djangocms_installer/install/__init__.py
@@ -55,8 +55,9 @@ def check_install(config_data):
         raise EnvironmentError("\n".join(errors))
 
 
-def requirements(requirements, is_file=False):
+def requirements(requirements, pip_options='', is_file=False):
     args = ['install', '-q']
+    if pip_options: args.append(pip_options)
     if 'Django<1.5' in requirements:
         args += ['--no-use-wheel']
     if is_file:  # pragma: no cover
diff --git a/djangocms_installer/main.py b/djangocms_installer/main.py
index 7636e63..7e55e5a 100644
--- a/djangocms_installer/main.py
+++ b/djangocms_installer/main.py
@@ -23,9 +23,11 @@ def execute():
                              "Please wait while I install dependencies\n")
             if not config_data.no_deps:
                 if config_data.requirements_file:
-                    install.requirements(config_data.requirements_file, True)
+                    install.requirements(config_data.requirements_file,
+                        config_data.pip_options, True)
                 else:
-                    install.requirements(config_data.requirements)
+                    install.requirements(config_data.requirements, 
+                        config_data.pip_options)
             sys.stdout.write("Dependencies installed\n"
                              "Creating the project")
             install.check_install(config_data)
diff --git a/setup.py b/setup.py
index 2730f09..84b20ee 100644
--- a/setup.py
+++ b/setup.py
@@ -54,7 +54,6 @@ setup(
         'Programming Language :: Python :: 3',
         'Programming Language :: Python :: 3.3',
         'Programming Language :: Python :: 3.4',
-        'Programming Language :: Python :: 3.5',
         'Framework :: Django',
         'Framework :: Django :: 1.4',
         'Framework :: Django :: 1.5',


Test patch:
diff --git a/tests/base.py b/tests/base.py
index f87f51d..b6a4c6f 100644
--- a/tests/base.py
+++ b/tests/base.py
@@ -14,13 +14,6 @@ if sys.version_info[:2] < (2, 7):
 else:
     import unittest
 
-if sys.version_info < (2, 7):
-    dj_ver = '1.6'
-elif sys.version_info < (3, 5):
-    dj_ver = '1.7'
-else:
-    dj_ver = '1.8'
-
 
 SYSTEM_ACTIVATE = os.path.join(os.path.dirname(sys.executable), 'activate_this.py')
 
diff --git a/tests/config.py b/tests/config.py
index e202634..9559b6c 100644
--- a/tests/config.py
+++ b/tests/config.py
@@ -270,8 +270,8 @@ class TestConfig(BaseTestClass):
         self.assertEqual(supported_versions('1.6', 'stable'), (1.6, 3.1))
         self.assertEqual(supported_versions('1.6.9', 'stable'), (None, 3.1))
         self.assertEqual(supported_versions('1.7', 'stable'), (1.7, 3.1))
-        self.assertEqual(supported_versions('beta', 'stable'), (1.9, 3.1))
-        self.assertEqual(supported_versions('develop', 'stable'), (1.9, 3.1))
+        self.assertEqual(supported_versions('beta', 'stable'), (1.8, 3.1))
+        self.assertEqual(supported_versions('develop', 'stable'), (1.8, 3.1))
 
     def test_requirements(self):
         """
@@ -607,6 +607,7 @@ class TestBaseConfig(unittest.TestCase):
         'no_sync': False,
         'no_user': False,
         'permissions': 'yes',
+        'pip_options': '',
         'plugins': False,
         'project_directory': '.',
         'project_name': 'example_prj',
diff --git a/tests/django.py b/tests/django.py
index 4b0f713..08cc1f3 100644
--- a/tests/django.py
+++ b/tests/django.py
@@ -7,7 +7,9 @@ import sys
 import textwrap
 
 from djangocms_installer import config, django, install
-from .base import unittest, IsolatedTestClass, dj_ver
+from .base import unittest, IsolatedTestClass
+
+dj_ver = '1.7' if sys.version_info >= (2, 7) else '1.6'
 
 
 class TestDjango(IsolatedTestClass):
@@ -106,8 +108,6 @@ class TestDjango(IsolatedTestClass):
         # self.assertTrue(os.path.exists(static_js))
         # self.assertTrue(os.path.exists(aldryn_template))
 
-    @unittest.skipIf(sys.version_info > (3, 4),
-                     reason="django 1.6 does not support python 3.5")
     def test_patch_16_settings(self):
         extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
         config_data = config.parse(['--db=sqlite://localhost/test.db',
@@ -135,8 +135,6 @@ class TestDjango(IsolatedTestClass):
         self.assertEqual(project.settings.CMS_PERMISSION, False)
         self.assertEqual(set(project.settings.CMS_TEMPLATES), self.templates_basic)
 
-    @unittest.skipIf(sys.version_info > (3, 4),
-                     reason="django 1.6 does not support python 3.5")
     def disable_test_patch_16_aldryn(self):
         extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
         config_data = config.parse(['--db=sqlite://localhost/test.db',
@@ -166,8 +164,6 @@ class TestDjango(IsolatedTestClass):
         self.assertEqual(set(project.settings.CMS_TEMPLATES), self.templates_basic)
         self.assertTrue('compressor' in project.settings.INSTALLED_APPS)
 
-    @unittest.skipIf(sys.version_info > (3, 4),
-                     reason="django 1.6 does not support python 3.5")
     def test_patch_django_16(self):
         config_data = config.parse(['--db=sqlite://localhost/test.db',
                                     '--lang=en', '--bootstrap=yes',
@@ -226,8 +222,6 @@ class TestDjango(IsolatedTestClass):
 
     @unittest.skipIf(sys.version_info <= (2, 7),
                      reason="django 1.7 does not support python 2.6")
-    @unittest.skipIf(sys.version_info > (3, 4),
-                     reason="django 1.7 does not support python 3.5")
     def test_patch_django_17_settings(self):
         extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
         config_data = config.parse(['--db=sqlite://localhost/test.db',
@@ -251,8 +245,6 @@ class TestDjango(IsolatedTestClass):
         self.assertFalse('cms' in project.settings.MIGRATION_MODULES)
         self.assertFalse('djangocms_text_ckeditor' in project.settings.MIGRATION_MODULES)
 
-    @unittest.skipIf(sys.version_info > (3, 4),
-                     reason="django 1.6 does not support python 3.5")
     def test_patch_31(self):
         config_data = config.parse(['--db=sqlite://localhost/test.db',
                                     '--lang=en', '--cms=develop',
@@ -279,8 +271,6 @@ class TestDjango(IsolatedTestClass):
 
     @unittest.skipIf(sys.version_info <= (2, 7),
                      reason="django 1.7 does not support python 2.6")
-    @unittest.skipIf(sys.version_info > (3, 4),
-                     reason="django 1.7 does not support python 3.5")
     def test_patch_django_17_31(self):
         extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
         config_data = config.parse(['--db=sqlite://localhost/test.db',
@@ -305,7 +295,7 @@ class TestDjango(IsolatedTestClass):
         self.assertFalse('djangocms_text_ckeditor' in project.settings.MIGRATION_MODULES)
 
     @unittest.skipIf(sys.version_info <= (2, 7),
-                     reason="django 1.8 does not support python 2.6")
+                     reason="django 1.7 does not support python 2.6")
     def test_patch_django_18_31(self):
         extra_path = os.path.join(os.path.dirname(__file__), 'data', 'extra_settings.py')
         config_data = config.parse(['--db=sqlite://localhost/test.db',
@@ -420,8 +410,6 @@ class TestDjango(IsolatedTestClass):
         self.assertTrue('cmsplugin_filer_utils' in project.settings.INSTALLED_APPS)
         self.assertTrue('cmsplugin_filer_video' in project.settings.INSTALLED_APPS)
 
-    @unittest.skipIf(sys.version_info > (3, 4),
-                     reason="django 1.5 does not support python 3.5")
     def test_patch(self):
         config_data = config.parse(['--db=sqlite://localhost/test.db',
                                     '--lang=en',
@@ -532,9 +520,7 @@ class TestDjango(IsolatedTestClass):
 
         # Checking content type table to check for correct applications setup
         query = project_db.execute('SELECT * FROM django_content_type WHERE app_label="cms" AND model="page"')
-        row = query.fetchone()
-        self.assertTrue('page' in row)
-        self.assertTrue('cms' in row)
+        self.assertEqual(query.fetchone()[1], 'page')
 
         # No data in CMS tables at setup time, but if query succeed database
         # schema should be fine
diff --git a/tests/main.py b/tests/main.py
index 8f1b464..48e131d 100644
--- a/tests/main.py
+++ b/tests/main.py
@@ -8,8 +8,9 @@ import sys
 from mock import patch
 
 from djangocms_installer import main, config, install
-from .base import unittest, IsolatedTestClass, dj_ver
+from .base import unittest, IsolatedTestClass
 
+dj_ver = '1.7' if sys.version_info >= (2, 7) else '1.6'
 
 class TestMain(IsolatedTestClass):
 
@@ -45,7 +46,7 @@ class TestMain(IsolatedTestClass):
                     '--db=postgres://user:pwd@host/dbname',
                     '--i18n=no',
                     '--cms-version=2.4',
-                    '--django-version=1.7',
+                    '--django-version=stable',
                     '-f',
                     '-p'+self.project_dir,
                     'example_prj'])