Commit c66df66a by Timothée Peignier

moving things and upgrading things around

parent 0922436a
......@@ -2,6 +2,6 @@ language: python
python:
- 2.7
install: pip install tox --use-mirrors
script: tox -e py26-1.2.X,py27-1.2.X,py26-1.3.X,py27-1.3.X,py26,py27,docs
script: tox
notifications:
irc: "irc.freenode.org#django-pipeline"
\ No newline at end of file
import os
import subprocess
try:
from staticfiles import finders
except ImportError:
from django.contrib.staticfiles import finders # noqa
from django.contrib.staticfiles import finders
from django.core.files.base import ContentFile
from django.utils.encoding import smart_str
......@@ -102,6 +99,6 @@ class SubProcessCompiler(CompilerBase):
raise CompilerError(error)
if self.verbose:
print error
print(error)
return compressed_content
......@@ -6,12 +6,9 @@ import subprocess
from itertools import takewhile
from django.utils.encoding import smart_str, force_unicode
from django.utils.encoding import smart_bytes, force_text
try:
from staticfiles import finders
except ImportError:
from django.contrib.staticfiles import finders # noqa
from django.contrib.staticfiles import finders
from pipeline.conf import settings
from pipeline.storage import default_storage
......@@ -89,8 +86,8 @@ class Compressor(object):
base_path = self.base_path(paths)
for path in paths:
contents = self.read_file(path)
contents = re.sub(r"\r?\n", "\\\\n", contents)
contents = re.sub(r"'", "\\'", contents)
contents = re.sub("\r?\n", "\\\\n", contents)
contents = re.sub("'", "\\'", contents)
name = self.template_name(path, base_path)
compiled += "%s['%s'] = %s('%s');\n" % (
namespace,
......@@ -135,7 +132,7 @@ class Compressor(object):
return "url(%s)" % asset_url
content = self.read_file(path)
# content needs to be unicode to avoid explosions with non-ascii chars
content = re.sub(URL_DETECTOR, reconstruct, force_unicode(content))
content = re.sub(URL_DETECTOR, reconstruct, force_text(content))
stylesheets.append(content)
return '\n'.join(stylesheets)
......@@ -232,7 +229,7 @@ class SubProcessCompressor(CompressorBase):
def execute_command(self, command, content):
pipe = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
stdin=subprocess.PIPE, stderr=subprocess.PIPE)
pipe.stdin.write(smart_str(content))
pipe.stdin.write(smart_bytes(content))
pipe.stdin.close()
compressed_content = pipe.stdout.read()
......@@ -247,5 +244,5 @@ class SubProcessCompressor(CompressorBase):
raise CompressorError(error)
if self.verbose:
print error
print(error)
return compressed_content
import inspect
try:
from staticfiles.storage import staticfiles_storage
except ImportError:
from django.contrib.staticfiles.storage import staticfiles_storage # noqa
from django.contrib.staticfiles.storage import staticfiles_storage
from django.conf import settings as django_settings
from jinja2 import Environment, FileSystemLoader
......@@ -48,7 +45,7 @@ class Jinja2Compressed(object):
val = val if val else "''"
expr = "pipeline_settings.%s = %s" % (
setting, val)
exec expr
exec(expr)
pipeline_settings.PIPELINE = getattr(django_settings,
'PIPELINE', not django_settings.DEBUG)
self.settings = pipeline_settings
......
import os
try:
from staticfiles.finders import get_finders
except ImportError:
from django.contrib.staticfiles.finders import get_finders # noqa
from django.contrib.staticfiles.finders import get_finders
from pipeline.conf import settings
......
......@@ -95,7 +95,7 @@ class Packager(object):
def pack(self, package, compress, signal, **kwargs):
output_filename = package.output_filename
if self.verbose:
print "Saving: %s" % output_filename
print("Saving: %s" % output_filename)
paths = self.compile(package.paths, force=True)
content = compress(paths, **kwargs)
self.save_file(output_filename, content)
......
import os
try:
from staticfiles import finders
from staticfiles.storage import CachedFilesMixin, StaticFilesStorage
except ImportError:
from django.contrib.staticfiles import finders # noqa
from django.contrib.staticfiles.storage import CachedFilesMixin, StaticFilesStorage # noqa
from django.contrib.staticfiles import finders
from django.contrib.staticfiles.storage import CachedFilesMixin, StaticFilesStorage
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import get_storage_class
......
try:
from staticfiles.storage import staticfiles_storage
except ImportError:
from django.contrib.staticfiles.storage import staticfiles_storage # noqa
from django.contrib.staticfiles.storage import staticfiles_storage
from django import template
from django.template.loader import render_to_string
......
......@@ -13,7 +13,7 @@ SITE_ID = 1
INSTALLED_APPS = [
'django.contrib.contenttypes',
'django.contrib.sites',
'staticfiles',
'django.contrib.staticfiles',
'django.contrib.auth',
'django.contrib.admin',
'pipeline',
......@@ -32,8 +32,8 @@ STATICFILES_DIRS = (
local_path('assets2/'),
)
STATICFILES_FINDERS = (
'staticfiles.finders.FileSystemFinder',
'staticfiles.finders.AppDirectoriesFinder'
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder'
)
SECRET_KEY = "django-pipeline"
......
# -*- coding: utf-8 flake8: noqa -*-
from compiler import *
from compressor import *
from glob import *
from jinja2 import *
from packager import *
from storage import *
from utils import *
from .test_compiler import *
from .test_compressor import *
from .test_glob import *
from .test_jinja2 import *
from .test_packager import *
from .test_storage import *
from .test_utils import *
......@@ -3,7 +3,7 @@ from django.test import TestCase
from pipeline.conf import settings
from pipeline.compilers import Compiler, CompilerBase
from paths import _
from tests.utils import _
class DummyCompiler(CompilerBase):
......@@ -20,7 +20,7 @@ class CompilerTest(TestCase):
def setUp(self):
self.compiler = Compiler()
self.old_compilers = settings.PIPELINE_COMPILERS
settings.PIPELINE_COMPILERS = ['tests.tests.compiler.DummyCompiler']
settings.PIPELINE_COMPILERS = ['tests.tests.test_compiler.DummyCompiler']
def test_output_path(self):
output_path = self.compiler.output_path("js/helpers.coffee", "js")
......
# -*- coding: utf-8 -*-
import base64
from mock import patch
try:
from mock import patch
except:
from unittest.mock import patch
from django.test import TestCase
from pipeline.compressors import Compressor, TEMPLATE_FUNC
from pipeline.compressors.yui import YUICompressor
from paths import _
from tests.utils import _
class CompressorTest(TestCase):
......
......@@ -2,7 +2,7 @@ from django.test import TestCase
from pipeline.packager import Packager, PackageNotFound
from paths import _
from tests.utils import _
class PackagerTest(TestCase):
......
......@@ -3,7 +3,8 @@ from django.utils.datastructures import SortedDict
from pipeline.conf import settings
from pipeline.storage import PipelineStorage
from paths import _
from tests.utils import _
class StorageTest(TestCase):
......
import os
import os
def _(path):
# Make sure the path contains only the correct separator
def _(path):
# Make sure the path contains only the correct separator
return path.replace('/', os.sep).replace('\\', os.sep)
[tox]
envlist =
py25-1.2.X, py26-1.2.X, py27-1.2.X,
py25-1.3.X, py26-1.3.X, py27-1.3.X,
py25, py26, py27, pypy, docs
envlist =
py26-1.4.X, py27-1.4.X, pypy-1.4.X,
py26, py27, pypy, py33, docs
[testenv]
downloadcache = {toxworkdir}/_download/
......@@ -12,96 +11,60 @@ setenv =
commands =
{envbindir}/django-admin.py test {posargs:tests}
[testenv:py25-1.2.X]
basepython = python2.5
deps =
Django==1.2.4
mock
django-staticfiles==1.2.1
unittest2
jinja2
[testenv:py26-1.2.X]
basepython = python2.6
deps =
Django==1.2.4
mock
django-staticfiles==1.2.1
unittest2
jinja2
[testenv:py27-1.2.X]
basepython = python2.7
deps =
Django==1.2.4
mock
django-staticfiles==1.2.1
unittest2
jinja2
[testenv:py25-1.3.X]
basepython = python2.5
deps =
Django==1.3.1
mock
django-staticfiles==1.2.1
unittest2
jinja2
[testenv:py26-1.3.X]
[testenv:py26-1.4.X]
basepython = python2.6
deps =
Django==1.3.1
Django==1.4.2
mock
django-staticfiles==1.2.1
unittest2
jinja2
[testenv:py27-1.3.X]
[testenv:py27-1.4.X]
basepython = python2.7
deps =
Django==1.3.1
Django==1.4.2
mock
django-staticfiles==1.2.1
unittest2
jinja2
[testenv:py25]
basepython = python2.5
[testenv:pypy-1.4.X]
basepython = pypy
deps =
Django==1.4
Django==1.4.2
mock
django-staticfiles==1.2.1
unittest2
jinja2
[testenv:py26]
basepython = python2.6
deps =
Django==1.4
https://www.djangoproject.com/download/1.5a1/tarball/
mock
django-staticfiles==1.2.1
unittest2
jinja2
[testenv:py27]
basepython = python2.7
deps =
Django==1.4
https://www.djangoproject.com/download/1.5a1/tarball/
mock
django-staticfiles==1.2.1
unittest2
jinja2
[testenv:pypy]
basepython = pypy
deps =
Django==1.4
https://www.djangoproject.com/download/1.5a1/tarball/
mock
django-staticfiles==1.2.1
unittest2
jinja2
[testenv:py33]
basepython = python3.3
deps =
jinja2
https://www.djangoproject.com/download/1.5a1/tarball/
[testenv:docs]
basepython = python2.7
changedir = docs
......
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