Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-pipeline
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-pipeline
Commits
a3b28274
Commit
a3b28274
authored
Jan 01, 2016
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure we flatten compressor command too
parent
012b1149
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
10 deletions
+14
-10
pipeline/compressors/__init__.py
+11
-3
tests/tests/test_compiler.py
+0
-1
tests/tests/test_compressor.py
+3
-4
tests/tests/test_storage.py
+0
-1
tests/tests/test_template.py
+0
-1
No files found.
pipeline/compressors/__init__.py
View file @
a3b28274
...
...
@@ -4,15 +4,17 @@ import base64
import
os
import
posixpath
import
re
import
subprocess
from
itertools
import
takewhile
from
django.contrib.staticfiles.storage
import
staticfiles_storage
from
django.utils.encoding
import
smart_bytes
,
force_text
from
django.utils.six
import
string_types
from
pipeline.conf
import
settings
from
pipeline.utils
import
to_class
,
relpath
from
pipeline.exceptions
import
CompressorError
from
pipeline.utils
import
to_class
,
relpath
URL_DETECTOR
=
r"""url\((['"]){0,1}\s*(.*?)["']{0,1}\)"""
URL_REPLACER
=
r"""url\(__EMBED__(.+?)(\?\d+)?\)"""
...
...
@@ -234,8 +236,14 @@ class CompressorBase(object):
class
SubProcessCompressor
(
CompressorBase
):
def
execute_command
(
self
,
command
,
content
):
import
subprocess
pipe
=
subprocess
.
Popen
(
command
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
argument_list
=
[]
for
flattening_arg
in
command
:
if
isinstance
(
flattening_arg
,
string_types
):
argument_list
.
append
(
flattening_arg
)
else
:
argument_list
.
extend
(
flattening_arg
)
pipe
=
subprocess
.
Popen
(
argument_list
,
shell
=
True
,
stdout
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
if
content
:
content
=
smart_bytes
(
content
)
...
...
tests/tests/test_compiler.py
View file @
a3b28274
...
...
@@ -7,7 +7,6 @@ from django.test import TestCase
from
pipeline.collector
import
default_collector
from
pipeline.compilers
import
Compiler
,
CompilerBase
,
SubProcessCompiler
from
pipeline.conf
import
settings
from
pipeline.exceptions
import
CompilerError
from
tests.utils
import
_
,
pipeline_settings
...
...
tests/tests/test_compressor.py
View file @
a3b28274
...
...
@@ -171,10 +171,9 @@ class CompressorTest(TestCase):
"""
,
output
)
def
test_compressor_subprocess_unicode
(
self
):
tests_path
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
))
output
=
SubProcessCompressor
(
False
)
.
execute_command
(
'/usr/bin/env cat'
,
io
.
open
(
tests_path
+
'/assets/css/unicode.css'
,
encoding
=
"utf-8"
)
.
read
())
path
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
__file__
))
content
=
io
.
open
(
path
+
'/assets/css/unicode.css'
,
encoding
=
"utf-8"
)
.
read
()
output
=
SubProcessCompressor
(
False
)
.
execute_command
((
'cat'
,),
content
)
self
.
assertEqual
(
""".some_class {
// Some unicode
content: "áéíóú";
...
...
tests/tests/test_storage.py
View file @
a3b28274
from
__future__
import
unicode_literals
from
django.conf
import
settings
from
django.contrib.staticfiles
import
finders
from
django.contrib.staticfiles.storage
import
staticfiles_storage
from
django.core.management
import
call_command
...
...
tests/tests/test_template.py
View file @
a3b28274
...
...
@@ -7,7 +7,6 @@ from django.template import Template, Context
from
django.test
import
TestCase
from
pipeline.jinja2
import
PipelineExtension
from
pipeline.conf
import
settings
from
tests.utils
import
pipeline_settings
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment