-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ensure SERVICE_VARIANT set; pass theme to coffeescript; #3094
ensure SERVICE_VARIANT set; pass theme to coffeescript; #3094
Conversation
# consider only words remaining (parse out separators) | ||
p = re.compile(r'\W+') | ||
clean_args = p.split(' '.join(clean_args)) | ||
# if lms or cms is among command line words, use it's env |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If your goal here is simply to detect if "lms" or "cms" is one of the arguments, why not do something like if "lms" in sys.argv
or if "cms" in sys.argv
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good golly! Because I did a quick port from the rake version?
:-/
Updating PR now...
@yarko I won't be able to get to this today and I'll be out on Monday and Tuesday. Just to let you know. |
👍 thanks @jzoldak |
if not SERVICE_VARIANT: # this will intentionally catch ""; | ||
SERVICE_VARIANT = 'lms' if 'lms' in sys.argv[1:] \ | ||
else 'cms' if ('cms' in sys.argv[1:]) or ('studio' in sys.arg[1:]) \ | ||
else SERVICE_VARIANT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is way too much logic in one line of code. Can you split this into multiple lines, so it's easier to read?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure ... 3 lines; 4 lines; same logic, different form... not much difference to me - try this on for size (yeah, reads a little nicer - I like the "any").
@yarko Looks good, but this PR now has conflicts and needs a rebase. :( |
no worries - will get to it after lunch. rebased / squashed now. |
@singingwolfboy @jzoldak - did you get a chance to look at this? |
Thanks for the ping! This looks good to me, but I'd like to get someone from Stanford to test this as well, since this affects their theming capabilities. Maybe @sefk? |
@sefk, @caesar2164 - would you have a look? - @caesar2164, I know you once had pending changes (Stanford-Online/edx-theme#4). (sorry - previous comment appeared double-posted;) |
@yarko - how do I run your branch? It breaks for me with our theme settings set... |
@caesar2164 - sorry, was a busy during PyCon; just rebased again. See comment on https://gist.github.com/yarko/10711787 for how I use those files to test. Note: the test uses my fork of Stanford-Online/edx-theme#4; recall you had other changes in the wings; /cc @sefk @singingwolfboy |
@@ -131,7 +128,7 @@ def compile_sass(debug=False): | |||
""" | |||
Compile Sass to CSS. | |||
""" | |||
theme_paths = theme_sass_paths() | |||
theme_paths = THEME_SASS_PATHS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only reason for this local variable before was to keep from calling theme_sass_paths()
twice. Now that you're using the THEME_SASS_PATHS
list, you may as well just use in the two join()'s below and avoid the extra variable. That would be cleaner and more consistent.
I've tested this as well @yarko and indeed this is a helpful change. It's a bit hacky in that I still don't understand why I tested this on my local dev env (devstack) and it works nicely, where master didn't before. Aside from my one little variable nit above, this LGTM and I'd be in favor of pulling in. 👍 |
@sefk - re: your THEME_SASS_PATHS line comment: yes, I agree (I think originally, I wanted to show how little the change was for reviewers). I'll make that change, and rebase in a few hrs. Then ask @jzoldak & @singingwolfboy to test / merge. |
…ssed to coffeescript also;
@yarko I added you to the whitelist on jenkins so that PRs from your fork will automatically run the tests when you push commits. |
Ok - rebased, @sefk suggested change made. |
@yarko - 👍 from me once tests pass. |
args = sys.argv[1:] | ||
if 'lms' in args: | ||
SERVICE_VARIANT = 'lms' | ||
elif any(i in args for i in ('cms', 'studio')): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commands are failing with: NameError: global name 'args' is not defined
E.g. paver --help
which should print the list of available tasks. This fails for me on devstack with no SERVICE_VARIANT set.
Same thing is happening when tests are kicked off by jenkins.
…"paver --help" work cleanly)
@jzoldak @singingwolfboy @sefk @caesar2164 - tests passed; I think this is ready now. Can we merge? |
ensure SERVICE_VARIANT set; pass theme to coffeescript;
This enables theming with paver (PR #3075), mirroring similar changes as for rake in PR #2387.
In particular, when the following are set:
then:
will correctly read and pass the paths to both
coffee
andsass
.Alternately, the process described in the comment of https://gist.github.com/yarko/8818633 is another way to test this - set the above four theme settings in
build-version.yml
, then runvagrant provision
.A way to run this on vagrant fullstack is to use
build-version.yml
, as above, and either include it in, or symlink it to/edx/app/edx_ansible/server-vars.yml
(it shows up as/vagrant/build-version.yml
), and then usingupdate edx-platform some-version
.Note: currently you will need to completely remove
edx-platform
in order to clone one from a different repository (sincegit remotes
is not managed thruupdate
).This PR corrects two deficiencies:
/edx/app/edxapp
*.env.json
file;pavelib/utils/env.py
):SERVICE_VARIANT
appropriately;coffeescript
path not update with theme (once vars read from*.env.json
):pavelib/assets.py
):coffee
;Dubious code:
Please review the following aspects:
env.py
: class variables set at class level (not instantiation level), because of current use, e.g.Env.REPO_ROOT
None
base class attributes, and setting them in__init__()
, since this would ensure proper operation. I did not follow this path because it would have meant more code changes (noEnv.REPO_ROOT
anywhere), and would add instantiation of the class. I prefer consensus on the approach first (so took the path closer to the current code).assets.py
:THEME_COFFEE_PATHS
andTHEME_SASS_PATHS
set at module level (not w/in function); not sure I like this.Goal
My goal and intent is to have
Vagrantfile
andupdate
both honorbuild-version.yml
files as extra-vars. At that point, a developer's Getting Started guide to Open edX will be an easier thing to write. This will simplify getting started, and maintaining edx instances, since common configurations will not require "deep" repository involvement.Build-version.yml
is consistent with and distinct fromserver-vars.yml
(server configuration and settings).This goal will involve a PR in the configuration repository (w.i.p.) to update the various
Vagrantfile
instances, and theupdate
script template.Would you please review, @jzoldak & @singingwolfboy