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
c66df66a
Commit
c66df66a
authored
Oct 26, 2012
by
Timothée Peignier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moving things and upgrading things around
parent
0922436a
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
60 additions
and
111 deletions
+60
-111
.travis.yml
+2
-1
pipeline/compilers/__init__.py
+2
-5
pipeline/compressors/__init__.py
+7
-10
pipeline/jinja2/ext.py
+2
-5
pipeline/manifest.py
+1
-4
pipeline/packager.py
+1
-1
pipeline/storage.py
+2
-6
pipeline/templatetags/compressed.py
+1
-4
tests/settings.py
+3
-3
tests/tests/__init__.py
+7
-7
tests/tests/test_compiler.py
+2
-2
tests/tests/test_compressor.py
+5
-2
tests/tests/test_glob.py
+0
-0
tests/tests/test_jinja2.py
+0
-0
tests/tests/test_packager.py
+1
-1
tests/tests/test_storage.py
+2
-1
tests/tests/test_utils.py
+0
-0
tests/utils.py
+3
-3
tox.ini
+19
-56
No files found.
.travis.yml
View file @
c66df66a
...
...
@@ -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
pipeline/compilers/__init__.py
View file @
c66df66a
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
pipeline/compressors/__init__.py
View file @
c66df66a
...
...
@@ -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
pipeline/jinja2/ext.py
View file @
c66df66a
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
...
...
pipeline/manifest.py
View file @
c66df66a
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
...
...
pipeline/packager.py
View file @
c66df66a
...
...
@@ -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
)
...
...
pipeline/storage.py
View file @
c66df66a
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
...
...
pipeline/templatetags/compressed.py
View file @
c66df66a
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
...
...
tests/settings.py
View file @
c66df66a
...
...
@@ -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"
...
...
tests/tests/__init__.py
View file @
c66df66a
# -*- 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
*
tests/tests/compiler.py
→
tests/tests/
test_
compiler.py
View file @
c66df66a
...
...
@@ -3,7 +3,7 @@ from django.test import TestCase
from
pipeline.conf
import
settings
from
pipeline.compilers
import
Compiler
,
CompilerBase
from
path
s
import
_
from
tests.util
s
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"
)
...
...
tests/tests/compressor.py
→
tests/tests/
test_
compressor.py
View file @
c66df66a
# -*- 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
path
s
import
_
from
tests.util
s
import
_
class
CompressorTest
(
TestCase
):
...
...
tests/tests/glob.py
→
tests/tests/
test_
glob.py
View file @
c66df66a
File moved
tests/tests/jinja2.py
→
tests/tests/
test_
jinja2.py
View file @
c66df66a
File moved
tests/tests/packager.py
→
tests/tests/
test_
packager.py
View file @
c66df66a
...
...
@@ -2,7 +2,7 @@ from django.test import TestCase
from
pipeline.packager
import
Packager
,
PackageNotFound
from
path
s
import
_
from
tests.util
s
import
_
class
PackagerTest
(
TestCase
):
...
...
tests/tests/storage.py
→
tests/tests/
test_
storage.py
View file @
c66df66a
...
...
@@ -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
):
...
...
tests/tests/utils.py
→
tests/tests/
test_
utils.py
View file @
c66df66a
File moved
tests/
tests/path
s.py
→
tests/
util
s.py
View file @
c66df66a
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.ini
View file @
c66df66a
[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:py
25
]
basepython
=
py
thon2.5
[testenv:py
py-1.4.X
]
basepython
=
py
py
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
...
...
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