Fix extension packaging with the new pipeline changes.

Review Request #8067 — Created March 21, 2016 and submitted

Information

Djblets
release-0.10.x
52330b2...

Reviewers

The new pipeline changes broke any extension-provided .less files that
needed to include or reference anything from another module, along with
any global variables provided by the app. There were also problems
loading static media from installed packages.

The arguments to lessc were still being set in the old setting, which
Pipeline no longer respects, and it wasn't in a suitable format (it
needed to be a list of strings, not a string).

This fixes that setting, plus ensures that we don't have broken
conflicts between what the app must now provide for normal use and
what's needed for packaging. It does this by filtering out app-provided
settings, replacing them with ours.

It also disables the use of the special Djblets LessCompiler's import
script for checking outdated dependencies. This isn't needed during
packaging, and in fact fails due to static file storage access control
checks.

To fix the package static media, we now have specialized versions of the
Pipeline CSS/JavaScript template nodes that change the rendering
behavior to fall back on outputted (compiled) static media files if the
sources are unavailable. This depends on a pending change in Pipeline
(https://github.com/jazzband/django-pipeline/pull/552).

Tested against Power Pack, which wasn't working with the new Pipeline
changes due to referencing stylesheets in Review Board. I was able to
successfully compile them without problems.

Tested loading Power Pack pages when installed via a package, and
tested when the package was in develop mode. Wiped my htdocs/static/
tree each time, and verified that the page was loading the appropriate
files. Also verified that if I modified a file (source or output,
depending on which was being used), the changes were picked up when
next reloading the page.

Existing unit tests pass.

Description From Last Updated

Don't we want to return True here (always recompile)?

daviddavid

Maybe say "ALWAYS_REBUILD" rather than "ALWAYS_OUTDATED"?

daviddavid

We could probably stick this into the pipeline settings dictionary.

daviddavid

'settings' imported but unused

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/extensions/templatetags/djblets_extensions.py
        djblets/extensions/packaging.py
        djblets/pipeline/compilers/less.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/extensions/templatetags/djblets_extensions.py
        djblets/extensions/packaging.py
        djblets/pipeline/compilers/less.py
    
    
  2. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/extensions/templatetags/djblets_extensions.py
        djblets/extensions/packaging.py
        djblets/pipeline/compilers/less.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/extensions/templatetags/djblets_extensions.py
        djblets/extensions/packaging.py
        djblets/pipeline/compilers/less.py
    
    
  2. 
      
david
  1. It looks like this is the same change as /r/8066/ ?

  2. 
      
david
  1. 
      
  2. djblets/pipeline/compilers/less.py (Diff revision 2)
     
     
    Show all issues

    Don't we want to return True here (always recompile)?

    1. Had to think about this for a bit, piece everything together in my head, but I agree.

      The intent was to just use LessCompiler's default behavior (which is checked above), and since we know it didn't find it to be outdated, we'd return that result. However, that doesn't consider the dependencies, so it's not safe..

      Going to change this and rename the setting to DJBLETS_PIPELINE_LESS_ALWAYS_OUTDATED.

      This is only really used for packaging, which is going to wipe and rebuild anyway, so it's sort of academic, but it'll help future-proof this.

  3. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/extensions/templatetags/djblets_extensions.py
        djblets/extensions/packaging.py
        djblets/pipeline/compilers/less.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/extensions/templatetags/djblets_extensions.py
        djblets/extensions/packaging.py
        djblets/pipeline/compilers/less.py
    
    
  2. 
      
david
  1. 
      
  2. djblets/extensions/packaging.py (Diff revision 3)
     
     
    Show all issues

    Maybe say "ALWAYS_REBUILD" rather than "ALWAYS_OUTDATED"?

    1. That's a better name.

  3. djblets/pipeline/compilers/less.py (Diff revision 3)
     
     
    Show all issues

    We could probably stick this into the pipeline settings dictionary.

    1. I didn't want to invade on their namespace too much, particularly for something internal.

    2. Yeah it's internal, but it's both our compiler and our settings.py

  4. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/extensions/templatetags/djblets_extensions.py
        djblets/extensions/packaging.py
        djblets/pipeline/compilers/less.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/extensions/templatetags/djblets_extensions.py
        djblets/extensions/packaging.py
        djblets/pipeline/compilers/less.py
    
    
  2. djblets/pipeline/compilers/less.py (Diff revision 4)
     
     
    Show all issues
     'settings' imported but unused
    
  3. 
      
chipx86
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        djblets/extensions/templatetags/djblets_extensions.py
        djblets/extensions/packaging.py
        djblets/pipeline/compilers/less.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        djblets/extensions/templatetags/djblets_extensions.py
        djblets/extensions/packaging.py
        djblets/pipeline/compilers/less.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-0.10.x (3bafb69)