Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx
edx-platform
Commits
d632fa86
Commit
d632fa86
authored
Nov 24, 2016
by
noraiz-anwar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed bug related to theme assets
parent
a0f99e6d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
29 deletions
+41
-29
openedx/core/djangoapps/theming/management/commands/compile_sass.py
+1
-1
pavelib/assets.py
+38
-26
pavelib/paver_tests/test_assets.py
+2
-2
No files found.
openedx/core/djangoapps/theming/management/commands/compile_sass.py
View file @
d632fa86
...
...
@@ -135,5 +135,5 @@ class Command(BaseCommand):
call_task
(
'pavelib.assets.compile_sass'
,
options
=
{
'system'
:
system
,
'theme
-
dirs'
:
theme_dirs
,
'themes'
:
themes
,
'force'
:
force
,
'debug'
:
debug
},
options
=
{
'system'
:
system
,
'theme
_
dirs'
:
theme_dirs
,
'themes'
:
themes
,
'force'
:
force
,
'debug'
:
debug
},
)
pavelib/assets.py
View file @
d632fa86
...
...
@@ -459,29 +459,14 @@ def compile_sass(options):
"""
debug
=
options
.
get
(
'debug'
)
force
=
options
.
get
(
'force'
)
systems
=
get
attr
(
options
,
'system'
,
ALL_SYSTEMS
)
themes
=
get
attr
(
options
,
'themes'
,
[])
theme_dirs
=
get
attr
(
options
,
'theme-
dirs'
,
[])
systems
=
get
_parsed_option
(
options
,
'system'
,
ALL_SYSTEMS
)
themes
=
get
_parsed_option
(
options
,
'themes'
,
[])
theme_dirs
=
get
_parsed_option
(
options
,
'theme_
dirs'
,
[])
if
not
theme_dirs
and
themes
:
# We can not compile a theme sass without knowing the directory that contains the theme.
raise
ValueError
(
'theme-dirs must be provided for compiling theme sass.'
)
if
isinstance
(
systems
,
basestring
):
systems
=
systems
.
split
(
','
)
else
:
systems
=
systems
if
isinstance
(
systems
,
list
)
else
[
systems
]
if
isinstance
(
themes
,
basestring
):
themes
=
themes
.
split
(
','
)
else
:
themes
=
themes
if
isinstance
(
themes
,
list
)
else
[
themes
]
if
isinstance
(
theme_dirs
,
basestring
):
theme_dirs
=
theme_dirs
.
split
(
','
)
else
:
theme_dirs
=
theme_dirs
if
isinstance
(
theme_dirs
,
list
)
else
[
theme_dirs
]
if
themes
and
theme_dirs
:
themes
=
get_theme_paths
(
themes
=
themes
,
theme_dirs
=
theme_dirs
)
...
...
@@ -718,6 +703,38 @@ def execute_compile_sass(args):
)
def
get_parsed_option
(
command_opts
,
opt_key
,
default
=
None
):
"""
Extract user command option and parse it.
Arguments:
command_opts: Command line arguments passed via paver command.
opt_key: name of option to get and parse
default: if `command_opt_value` not in `command_opts`, `command_opt_value` will be set to default.
Returns:
list or None
"""
command_opt_value
=
getattr
(
command_opts
,
opt_key
,
default
)
if
command_opt_value
:
command_opt_value
=
listfy
(
command_opt_value
)
return
command_opt_value
def
listfy
(
data
):
"""
Check and convert data to list.
Arguments:
data: data structure to be converted.
"""
if
isinstance
(
data
,
basestring
):
data
=
data
.
split
(
','
)
elif
not
isinstance
(
data
,
list
):
data
=
[
data
]
return
data
@task
@cmdopts
([
(
'background'
,
'b'
,
'Background mode'
),
...
...
@@ -733,8 +750,8 @@ def watch_assets(options):
if
tasks
.
environment
.
dry_run
:
return
themes
=
get
attr
(
options
,
'themes'
,
None
)
theme_dirs
=
get
attr
(
options
,
'theme-
dirs'
,
[])
themes
=
get
_parsed_option
(
options
,
'themes'
)
theme_dirs
=
get
_parsed_option
(
options
,
'theme_
dirs'
,
[])
if
not
theme_dirs
and
themes
:
# We can not add theme sass watchers without knowing the directory that contains the themes.
...
...
@@ -742,11 +759,6 @@ def watch_assets(options):
else
:
theme_dirs
=
[
path
(
_dir
)
for
_dir
in
theme_dirs
]
if
isinstance
(
themes
,
basestring
):
themes
=
themes
.
split
(
','
)
else
:
themes
=
themes
if
isinstance
(
themes
,
list
)
else
[
themes
]
sass_directories
=
get_watcher_dirs
(
theme_dirs
,
themes
)
observer
=
PollingObserver
()
...
...
@@ -833,5 +845,5 @@ def update_assets(args):
if
args
.
watch
:
call_task
(
'pavelib.assets.watch_assets'
,
options
=
{
'background'
:
not
args
.
debug
,
'theme
-
dirs'
:
args
.
theme_dirs
,
'themes'
:
args
.
themes
},
options
=
{
'background'
:
not
args
.
debug
,
'theme
_
dirs'
:
args
.
theme_dirs
,
'themes'
:
args
.
themes
},
)
pavelib/paver_tests/test_assets.py
View file @
d632fa86
...
...
@@ -98,7 +98,7 @@ class TestPaverThemeAssetTasks(PaverTestCase):
self
.
reset_task_messages
()
call_task
(
'pavelib.assets.compile_sass'
,
options
=
{
"system"
:
system
,
"debug"
:
debug
,
"force"
:
force
,
"theme
-
dirs"
:
[
TEST_THEME
.
dirname
()],
options
=
{
"system"
:
system
,
"debug"
:
debug
,
"force"
:
force
,
"theme
_
dirs"
:
[
TEST_THEME
.
dirname
()],
"themes"
:
[
TEST_THEME
.
basename
()]},
)
expected_messages
=
[]
...
...
@@ -194,7 +194,7 @@ class TestPaverWatchAssetTasks(TestCase):
with
patch
(
'pavelib.assets.PollingObserver.start'
):
call_task
(
'pavelib.assets.watch_assets'
,
options
=
{
"background"
:
True
,
"theme
-
dirs"
:
[
TEST_THEME
.
dirname
()],
options
=
{
"background"
:
True
,
"theme
_
dirs"
:
[
TEST_THEME
.
dirname
()],
"themes"
:
[
TEST_THEME
.
basename
()]},
)
self
.
assertEqual
(
mock_register
.
call_count
,
2
)
...
...
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