Commit 067fe59b authored by Michal Čihař's avatar Michal Čihař

Basic compatibility with Python 2.6

- list extra requirements needed on Python 2.6
- provide extra requirements file for pip on Python 2.6
- use requirements-2.6.txt for Python 2.6 on Travis
- try using unittest2 if unittest module does not work

See issue #258
parent e52d63b3
...@@ -11,7 +11,7 @@ before_install: ...@@ -11,7 +11,7 @@ before_install:
install: install:
- pip install --use-mirrors Django==$DJANGO_VERSION - pip install --use-mirrors Django==$DJANGO_VERSION
- pip install --use-mirrors -r requirements.txt - pip install --use-mirrors -r requirements.txt
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install --use-mirrors importlib ; fi - if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install -r requirements-2.6.txt ; fi
# Environment setup # Environment setup
- export VIRT_ROOT=/home/travis/virtualenv/python$TRAVIS_PYTHON_VERSION - export VIRT_ROOT=/home/travis/virtualenv/python$TRAVIS_PYTHON_VERSION
- export PKG_CONFIG_PATH=$VIRT_ROOT/lib/pkgconfig - export PKG_CONFIG_PATH=$VIRT_ROOT/lib/pkgconfig
......
...@@ -33,6 +33,14 @@ PyICU (optional for proper sorting of strings) ...@@ -33,6 +33,14 @@ PyICU (optional for proper sorting of strings)
Database backend Database backend
Any database supported in Django will work, check their documentation for more details. Any database supported in Django will work, check their documentation for more details.
If you want to run Weblate with Python 2.6, you should also install following
modules:
importlib
https://pypi.python.org/pypi/importlib
unittest2
https://pypi.python.org/pypi/unittest2
Requirements on Debian or Ubuntu Requirements on Debian or Ubuntu
++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++
......
importlib>=1.0.0
unittest2>=0.5.0
...@@ -21,7 +21,10 @@ ...@@ -21,7 +21,10 @@
from django.test import TestCase from django.test import TestCase
from trans.tests.views import ViewTestCase from trans.tests.views import ViewTestCase
from trans.models.unit import Unit from trans.models.unit import Unit
import unittest try:
from unittest import skipUnless
except ImportError:
from unittest2 import skipUnless
from trans.machine.dummy import DummyTranslation from trans.machine.dummy import DummyTranslation
from trans.machine.glosbe import GlosbeTranslation from trans.machine.glosbe import GlosbeTranslation
from trans.machine.mymemory import MyMemoryTranslation from trans.machine.mymemory import MyMemoryTranslation
...@@ -73,7 +76,7 @@ class MachineTranslationTest(TestCase): ...@@ -73,7 +76,7 @@ class MachineTranslationTest(TestCase):
machine = ApertiumTranslation() machine = ApertiumTranslation()
self.assertIsInstance(machine.translate('es', 'world', None), list) self.assertIsInstance(machine.translate('es', 'world', None), list)
@unittest.skipUnless(microsoft_translation_supported(), @skipUnless(microsoft_translation_supported(),
'missing credentials') 'missing credentials')
def test_microsoft(self): def test_microsoft(self):
machine = MicrosoftTranslation() machine = MicrosoftTranslation()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment