internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: getnikola/nikola

Issue:
Nikola auto doesn't work in python3
```
$ nikola auto
ERROR:yapsy:Unable to import plugin: /home/ralsina/Desktop/proyectos/nikola/master/nikola/plugins/command/auto
Traceback (most recent call last):
  File "/home/ralsina/.virtualenvs/nikola3/lib/python3.4/site-packages/Yapsy-1.10.423-py3.4.egg/yapsy/PluginManager.py", line 485, in loadPlugins
    candidate_module = imp.load_module(plugin_module_name,None,candidate_filepath,("py","r",imp.PKG_DIRECTORY))
  File "/home/ralsina/.virtualenvs/nikola3/lib/python3.4/imp.py", line 245, in load_module
    return load_package(name, filename)
  File "/home/ralsina/.virtualenvs/nikola3/lib/python3.4/imp.py", line 217, in load_package
    return methods.load()
  File "<frozen importlib._bootstrap>", line 1220, in load
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/home/ralsina/Desktop/proyectos/nikola/master/nikola/plugins/command/auto/__init__.py", line 260, in <module>
    class LRSocket(WebSocket):
TypeError: NoneType takes no arguments
[2015-06-10T12:45:52Z] ERROR: Nikola: Unknown command auto
```



Discussion:

Resolving patch:
diff --git a/nikola/plugins/command/auto/__init__.py b/nikola/plugins/command/auto/__init__.py
--- a/nikola/plugins/command/auto/__init__.py
+++ b/nikola/plugins/command/auto/__init__.py
@@ -46,7 +46,7 @@
     from ws4py.server.wsgiutils import WebSocketWSGIApplication
     from ws4py.messaging import TextMessage
 except ImportError:
-    WebSocket = None
+    WebSocket = object
 try:
     import pyinotify
 except ImportError:
@@ -115,7 +115,7 @@ def _execute(self, options, args):
 
         self.logger = get_logger('auto', self.site.loghandlers)
 
-        if WebSocket is None:
+        if WebSocket is object:
             req_missing(['ws4py'], 'use the "auto" command')
             return
         if pyinotify is None:


Test patch:
Repository: getnikola/nikola

Issue:
Importing from Wordpress: Some posts might already be Markdown
It's possible to use Markdown (also Textile and AutoP) with Wordpress using the [TextControl plugin](http://plugins.trac.wordpress.org/wiki/TextControl). In that case, the export file contains:

```
<wp:postmeta>
    <wp:meta_key>_tc_post_format</wp:meta_key>
    <wp:meta_value><![CDATA[markdown]]></wp:meta_value>
</wp:postmeta>
```

Would be nice if the importer supported that.



Discussion:
Interesting! Can you send me a full dump containing these?

@ralsina Yes, it's underway to the e-mail address in your GitHub profile.

Any news on this?

Haven't gotten around to it yet, sorry.
I'll try to take a look today.


Resolving patch:
diff --git a/nikola/plugins/command/import_wordpress.py b/nikola/plugins/command/import_wordpress.py
--- a/nikola/plugins/command/import_wordpress.py
+++ b/nikola/plugins/command/import_wordpress.py
@@ -283,7 +283,6 @@ def download_additional_image_sizes(self, item, wordpress_namespace, source_path
             return
 
         additional_metadata = item.findall('{{{0}}}postmeta'.format(wordpress_namespace))
-
         if additional_metadata is None:
             return
 
@@ -446,8 +445,15 @@ def import_item(self, item, wordpress_namespace, out_folder=None):
         if '$latex' in content:
             tags.append('mathjax')
 
+        # Find post format if it's there
+        post_format = 'wp'
+        format_tag = [x for x in item.findall('*//{%s}meta_key' % wordpress_namespace) if x.text == '_tc_post_format']
+        if format_tag:
+            post_format = format_tag[0].getparent().find('{%s}meta_value' % wordpress_namespace).text
+
         if is_draft and self.exclude_drafts:
             LOGGER.notice('Draft "{0}" will not be imported.'.format(title))
+
         elif content.strip():
             # If no content is found, no files are written.
             self.url_map[link] = (self.context['SITE_URL'] +
@@ -474,7 +480,8 @@ def import_item(self, item, wordpress_namespace, out_folder=None):
                     out_meta_filename = slug + '.meta'
                     out_content_filename = slug + '.wp'
                     meta_slug = slug
-                content = self.transform_content(content)
+                if post_format == 'wp':
+                    content = self.transform_content(content)
                 self.write_metadata(os.path.join(self.output_folder, out_folder,
                                                  out_meta_filename),
                                     title, meta_slug, post_date, description, tags)


Test patch:
Repository: getnikola/nikola

Issue:
Feature: wordpress_import should generate redirections for tags
Hi guys

After I migrated my site to Nikola I noticed that no redirection were generated for tags. It would be helpful if the wordpress_import feature would generate them. 

For categories, it could also be done since categories of posts are transformed into tags, but there are generally less categories. 

Thanks



Discussion:
Note that Nikola supports categories, though they are incompatible with WordPress’, because Nikola has up to 1 category per post, while in WordPress (IIRC) it’s unlimited.

@wichtounet if you can mail me a dump, I can take a shot at it.


Resolving patch:
diff --git a/nikola/plugins/command/import_wordpress.py b/nikola/plugins/command/import_wordpress.py
--- a/nikola/plugins/command/import_wordpress.py
+++ b/nikola/plugins/command/import_wordpress.py
@@ -101,6 +101,7 @@ class CommandImportWordpress(Command, ImportMixin):
             'help': "The pattern for translation files names",
         },
     ]
+    all_tags = set([])
 
     def _execute(self, options={}, args=[]):
         """Import a WordPress blog from an export file into a Nikola site."""
@@ -165,6 +166,15 @@ def show_info_about_mising_module(modulename):
             self.extra_languages)
         self.context['REDIRECTIONS'] = self.configure_redirections(
             self.url_map)
+
+        # Add tag redirects
+        for tag in self.all_tags:
+            tag = utils.slugify(tag.decode('utf8'))
+            src_url = '{}tag/{}'.format(self.context['SITE_URL'], tag)
+            dst_url = self.site.link('tag', tag)
+            if src_url != dst_url:
+                self.url_map[src_url] = dst_url
+
         self.write_urlmap_csv(
             os.path.join(self.output_folder, 'url_map.csv'), self.url_map)
         rendered_template = conf_template.render(**prepare_config(self.context))
@@ -445,6 +455,7 @@ def import_item(self, item, wordpress_namespace, out_folder=None):
             if text == 'Uncategorized':
                 continue
             tags.append(text)
+            self.all_tags.add(text)
 
         if '$latex' in content:
             tags.append('mathjax')


Test patch:
Repository: getnikola/nikola

Issue:
Deprecated Yapsy methods in use
[setPluginInfoExtension](https://github.com/getnikola/nikola/blob/master/nikola/nikola.py#L680) → [deprecated](http://yapsy.sourceforge.net/PluginManager.html#yapsy.PluginManager.PluginManager.setPluginInfoExtension)
[setPluginPlaces](https://github.com/getnikola/nikola/blob/master/nikola/nikola.py#L695) → [deprecated](http://yapsy.sourceforge.net/PluginManager.html#yapsy.PluginManager.PluginManager.setPluginPlaces)



Discussion:

Resolving patch:
diff --git a/nikola/nikola.py b/nikola/nikola.py
--- a/nikola/nikola.py
+++ b/nikola/nikola.py
@@ -677,7 +677,7 @@ def __init__(self, **config):
             "ConfigPlugin": ConfigPlugin,
             "PostScanner": PostScanner,
         })
-        self.plugin_manager.setPluginInfoExtension('plugin')
+        self.plugin_manager.getPluginLocator().setPluginInfoExtension('plugin')
         extra_plugins_dirs = self.config['EXTRA_PLUGINS_DIRS']
         if sys.version_info[0] == 3:
             places = [
@@ -692,7 +692,7 @@ def __init__(self, **config):
                 os.path.expanduser('~/.nikola/plugins'),
             ] + [utils.sys_encode(path) for path in extra_plugins_dirs if path]
 
-        self.plugin_manager.setPluginPlaces(places)
+        self.plugin_manager.getPluginLocator().setPluginPlaces(places)
         self.plugin_manager.collectPlugins()
 
         self._activate_plugins_of_category("SignalHandler")


Test patch:
Repository: getnikola/nikola

Issue:
nikola check --clean-files should delete empty directories



Discussion:

Resolving patch:
diff --git a/nikola/plugins/command/check.py b/nikola/plugins/command/check.py
--- a/nikola/plugins/command/check.py
+++ b/nikola/plugins/command/check.py
@@ -313,5 +313,19 @@ def scan_files(self):
     def clean_files(self):
         only_on_output, _ = real_scan_files(self.site)
         for f in only_on_output:
+            self.logger.info('removed: {0}'.format(f))
             os.unlink(f)
+
+        # Find empty directories and remove them
+        output_folder = self.site.config['OUTPUT_FOLDER']
+        all_dirs = []
+        for root, dirs, files in os.walk(output_folder, followlinks=True):
+            all_dirs.append(root)
+        all_dirs.sort(key=len, reverse=True)
+        for d in all_dirs:
+            try:
+                os.rmdir(d)
+                self.logger.info('removed: {0}/'.format(d))
+            except OSError:
+                pass
         return True


Test patch:
Repository: getnikola/nikola

Issue:
Special characters in URL fail on "nikola auto"
I have this file in my blog (http://elblogdehumitos.com.ar/posts/subtitulos-de-cortos-de-david-oreilly/The_External_World-19723116_%5Bes%5D.srt) and when it's accessed from `nikola auto` command I get a 404 but when it's accessed from `nikola serve` there is no problem:

```
(blog)[18:03] humitos: nikola> nikola auto
Scanning posts...done!
[2015-08-04T22:03:38Z] INFO: auto: Watching files for changes...
[2015-08-04T22:03:39Z] INFO: ws4py: Using epoll
[2015-08-04T22:03:39Z] INFO: auto: Serving HTTP on 127.0.0.1 port 8000...
[2015-08-04T22:03:41Z] INFO: ws4py: Managing websocket [Local => 127.0.0.1:8000 | Remote => 127.0.0.1:44815]
[2015-08-04T22:03:41Z] INFO: auto: <--- {u'snipver': 1, u'ver': u'2.2.1', u'command': u'hello', u'protocols': [u'http://livereload.com/protocols/official-6', u'http://livereload.com/protocols/official-7']}
[2015-08-04T22:03:41Z] INFO: auto: ---> {"serverName": "nikola-livereload", "command": "hello", "protocols": ["http://livereload.com/protocols/official-7"]}
[2015-08-04T22:03:41Z] INFO: auto: <--- {u'url': u'http://localhost:8000/posts/subtitulos-de-cortos-de-david-oreilly/The_External_World-19723116_%5Bes%5D.srt', u'command': u'info', u'plugins': {u'less': {u'disable': False, u'version': u'1.0'}}}
[2015-08-04T22:03:41Z] INFO: auto: ****** Browser connected: http://localhost:8000/posts/subtitulos-de-cortos-de-david-oreilly/The_External_World-19723116_%5Bes%5D.srt
[2015-08-04T22:03:41Z] INFO: auto: ****** sending 0 pending messages
^C[2015-08-04T22:03:51Z] INFO: auto: Server is shutting down.
Terminado
```

```
(blog)[18:03] humitos: nikola> nikola serve
[2015-08-04T22:03:54Z] INFO: serve: Serving HTTP on 0.0.0.0 port 8000...
127.0.0.1 - - [04/Aug/2015 18:03:55] "GET /posts/subtitulos-de-cortos-de-david-oreilly/The_External_World-19723116_%5Bes%5D.srt HTTP/1.1" 200 -
```

The filename is: `The_External_World-19723116_[es].srt`



Discussion:

Resolving patch:
diff --git a/nikola/plugins/command/auto/__init__.py b/nikola/plugins/command/auto/__init__.py
--- a/nikola/plugins/command/auto/__init__.py
+++ b/nikola/plugins/command/auto/__init__.py
@@ -37,8 +37,9 @@
 import time
 try:
     from urlparse import urlparse
+    from urllib2 import unquote
 except ImportError:
-    from urllib.parse import urlparse  # NOQA
+    from urllib.parse import urlparse, unquote  # NOQA
 import webbrowser
 from wsgiref.simple_server import make_server
 import wsgiref.util
@@ -286,7 +287,7 @@ def serve_static(self, environ, start_response):
         """Trivial static file server."""
         uri = wsgiref.util.request_uri(environ)
         p_uri = urlparse(uri)
-        f_path = os.path.join(self.site.config['OUTPUT_FOLDER'], *p_uri.path.split('/'))
+        f_path = os.path.join(self.site.config['OUTPUT_FOLDER'], *[unquote(x) for x in p_uri.path.split('/')])
 
         # ‘Pretty’ URIs and root are assumed to be HTML
         mimetype = 'text/html' if uri.endswith('/') else mimetypes.guess_type(uri)[0] or 'application/octet-stream'


Test patch:
Repository: getnikola/nikola

Issue:
Yearly archivs not rebuilt when their posts change



Discussion:
@Aeyoun 

What I see is that if ARCHIVES_ARE_INDEXES is True, then you change a post content, then the archives are not rebuilt. Is it that one you saw?

@ralsina, my archives [are lists](https://www.aeyoun.com/2014/index.html). If I change the slug of one of these, it’s not updated.

Specifically, I moved from one post from one POSTS folder to another but kept the post otherwise unchanged. Everything else rebuilt fine.

Ok, so two related-ish bugs. I'll take a look.

So, _prepare_task in the archive plugin is missing a whole lot of dependencies.


Resolving patch:
diff --git a/nikola/plugins/task/archive.py b/nikola/plugins/task/archive.py
--- a/nikola/plugins/task/archive.py
+++ b/nikola/plugins/task/archive.py
@@ -58,7 +58,7 @@ def _prepare_task(self, kw, name, lang, posts, items, template_name,
         # title: the (translated) title for the generated page
         # deps_translatable: dependencies (None if not added)
         assert posts is not None or items is not None
-
+        task_cfg = [copy.copy(kw)]
         context = {}
         context["lang"] = lang
         context["title"] = title
@@ -66,10 +66,12 @@ def _prepare_task(self, kw, name, lang, posts, items, template_name,
         context["pagekind"] = ["list", "archive_page"]
         if posts is not None:
             context["posts"] = posts
-            n = len(posts)
+            # Depend on all post metadata because it can be used in templates (Issue #1931)
+            task_cfg.append(repr(p) for p in posts)
         else:
+            # Depend on the content of items, to rebuild if links change (Issue #1931)
             context["items"] = items
-            n = len(items)
+            task_cfg.append(items)
         task = self.site.generic_post_list_renderer(
             lang,
             [],
@@ -79,7 +81,7 @@ def _prepare_task(self, kw, name, lang, posts, items, template_name,
             context,
         )
 
-        task_cfg = {1: copy.copy(kw), 2: n}
+        task_cfg = {i: x for i, x in enumerate(task_cfg)}
         if deps_translatable is not None:
             task_cfg[3] = deps_translatable
         task['uptodate'] = task['uptodate'] + [config_changed(task_cfg, 'nikola.plugins.task.archive')]


Test patch:
Repository: getnikola/nikola

Issue:
handle include tag in mako templates
Currently templates used via include tags are not considered dependencies. It's not hard.

handle include tag in mako templates
Currently templates used via include tags are not considered dependencies. It's not hard.



Discussion:

Resolving patch:
diff --git a/nikola/plugins/template/mako.py b/nikola/plugins/template/mako.py
--- a/nikola/plugins/template/mako.py
+++ b/nikola/plugins/template/mako.py
@@ -32,7 +32,7 @@
 import sys
 import tempfile
 
-from mako import util, lexer
+from mako import util, lexer, parsetree
 from mako.lookup import TemplateLookup
 from mako.template import Template
 from markupsafe import Markup  # It's ok, Mako requires it
@@ -64,9 +64,8 @@ def get_deps(self, filename):
         deps = []
         for n in lex.template.nodes:
             keyword = getattr(n, 'keyword', None)
-            if keyword in ["inherit", "namespace"]:
+            if keyword in ["inherit", "namespace"] or isinstance(n, parsetree.IncludeTag):
                 deps.append(n.attributes['file'])
-            # TODO: include tags are not handled
         return deps
 
     def set_directories(self, directories, cache_folder):


Test patch:
Repository: getnikola/nikola

Issue:
srcset not respecting URL_TYPE option
1. Set `URL_TYPE = 'rel_path'` (default)
2. Make a post with `<img srcset="/images/test_large.png 200w, /images/test_small.png 100w" src="/images/test_small.png">`

Expected:
`<img srcset="../images/test_large.png 200w, ../images/test_small.png 100w" src="../images/test_small.png">`

Actual:
`<img srcset="/images/test_large.png 200w, /images/test_small.png 100w" src="../images/test_small.png">`



Discussion:
Is this the same as https://github.com/getnikola/nikola/issues/1626 ?

Is srcset only used in img tags? If yes, it may be worthwhile to specialcase it.

It can appear on `<img>` and `<source>` elements.


Resolving patch:
diff --git a/nikola/nikola.py b/nikola/nikola.py
--- a/nikola/nikola.py
+++ b/nikola/nikola.py
@@ -1053,11 +1053,24 @@ def render_template(self, template_name, output_name, context):
         utils.makedirs(os.path.dirname(output_name))
         parser = lxml.html.HTMLParser(remove_blank_text=True)
         doc = lxml.html.document_fromstring(data, parser)
-        doc.rewrite_links(lambda dst: self.url_replacer(src, dst, context['lang']), resolve_base_href=False)
+        self.rewrite_links(doc, src, context['lang'])
         data = b'<!DOCTYPE html>\n' + lxml.html.tostring(doc, encoding='utf8', method='html', pretty_print=True)
         with open(output_name, "wb+") as post_file:
             post_file.write(data)
 
+    def rewrite_links(self, doc, src, lang):
+        """Replace links in document to point to the right places."""
+        # First let lxml replace most of them
+        doc.rewrite_links(lambda dst: self.url_replacer(src, dst, lang), resolve_base_href=False)
+
+        # lxml ignores srcset in img and source elements, so do that by hand
+        objs = list(doc.findall('*//img')) + list(doc.findall('*//source'))
+        for obj in objs:
+            if 'srcset' in obj.attrib:
+                urls = [u.strip() for u in obj.attrib['srcset'].split(',')]
+                urls = [self.url_replacer(src, dst, lang) for dst in urls]
+                obj.set('srcset', ', '.join(urls))
+
     def url_replacer(self, src, dst, lang=None, url_type=None):
         """Mangle URLs.
 


Test patch:
Repository: getnikola/nikola

Issue:
Updating some metadata (author) in 2-file posts doesn't regenerate post in output
To reproduce:

1) Start a site
2) Create 2-file post
3) Set author
4) Start auto -b
5) Change author

Post's page rebuilds but author is unchanged.

This **only happens with 2-file posts**



Discussion:
This is not related to auto, it also happens on regular build. Looks like we lost a dependency at some point:

```
(nikola)ralsina@yoga:/tmp/foo$ vim posts/foobar.meta 
(nikola)ralsina@yoga:/tmp/foo$ nikola build
Scanning posts....done!
.  render_archive:output/2015/index.html
.  render_posts:timeline_changes
.  render_posts:cache/posts/foobar.html
```

It's not redoing `output/posts/foobar.html`

A quick look at dumpdb seems to show:
- The dependency is indirect: cache file depends on .meta file
- The cache file is unchanged because it's metadata not used in the data used there in some cases
- Since the cache file is unchanged, the output file is not marked dirty


Resolving patch:
diff --git a/nikola/post.py b/nikola/post.py
--- a/nikola/post.py
+++ b/nikola/post.py
@@ -447,11 +447,16 @@ def deps(self, lang):
         if self.default_lang in self.translated_to:
             deps.append(self.base_path)
             deps.append(self.source_path)
+            if os.path.exists(self.metadata_path):
+                deps.append(self.metadata_path)
         if lang != self.default_lang:
             cand_1 = get_translation_candidate(self.config, self.source_path, lang)
             cand_2 = get_translation_candidate(self.config, self.base_path, lang)
             if os.path.exists(cand_1):
                 deps.extend([cand_1, cand_2])
+            cand_3 = get_translation_candidate(self.config, self.metadata_path, lang)
+            if os.path.exists(cand_3):
+                deps.append(cand_3)
         deps += self._get_dependencies(self._dependency_file_page[lang])
         deps += self._get_dependencies(self._dependency_file_page[None])
         return sorted(deps)


Test patch:
Repository: getnikola/nikola

Issue:
Make base tag optional via flag.
There are corner cases where users just prefer to have the old behaviour.



Discussion:

Resolving patch:
diff --git a/nikola/nikola.py b/nikola/nikola.py
--- a/nikola/nikola.py
+++ b/nikola/nikola.py
@@ -486,6 +486,7 @@ def __init__(self, **config):
             'THUMBNAIL_SIZE': 180,
             'UNSLUGIFY_TITLES': False,  # WARNING: conf.py.in overrides this with True for backwards compatibility
             'URL_TYPE': 'rel_path',
+            'USE_BASE_TAG': True,
             'USE_BUNDLES': True,
             'USE_CDN': False,
             'USE_CDN_WARNING': True,
@@ -869,6 +870,7 @@ def _set_global_context(self):
         self._GLOBAL_CONTEXT['index_display_post_count'] = self.config[
             'INDEX_DISPLAY_POST_COUNT']
         self._GLOBAL_CONTEXT['index_file'] = self.config['INDEX_FILE']
+        self._GLOBAL_CONTEXT['use_base_tag'] = self.config['USE_BASE_TAG']
         self._GLOBAL_CONTEXT['use_bundles'] = self.config['USE_BUNDLES']
         self._GLOBAL_CONTEXT['use_cdn'] = self.config.get("USE_CDN")
         self._GLOBAL_CONTEXT['theme_color'] = self.config.get("THEME_COLOR")


Test patch:
Repository: getnikola/nikola

Issue:
nikola no longer has all-nocdn.*
I started using `nikola` today for a gallery. The generated pages make reference to `all-nocdn.css` and `all-nocdn.js`, but they're not (longer?) part of `nikola`'s code:

``` bash
mdione@diablo:~/src/projects/nikola$ git remote show origin
* remote origin
  Fetch URL: https://github.com/getnikola/nikola.git
  Push  URL: https://github.com/getnikola/nikola.git
  HEAD branch: master
mdione@diablo:~/src/projects/nikola$ git branch
* master
mdione@diablo:~/src/projects/nikola$ git pull
Already up-to-date.
mdione@diablo:~/src/projects/nikola$ find . -name all-nocdn.*
mdione@diablo:~/src/projects/nikola$
```

I just copied those files from and old attempt to use `nikola` and the site works. This happens with both versions `7.6.0-3` from Debian and from `master`, as you can see above.



Discussion:
Nikola never had those files. They are generated on build, using webassets.
Do you get any errors about USE_BUNDLES and webassets missing?

## 

Chris Warrick https://chriswarrick.com/
Sent from my Galaxy S3.
On 1 Sep 2015 5:20 pm, "Marcos Dione" notifications@github.com wrote:

> I started using nikola today for a gallery. The generated pages make
> reference to all-nocdn.css and all-nocdn.js, but they're not (longer?)
> part of nikola's code:
> 
> mdione@diablo:~/src/projects/nikola$ git remote show origin\* remote origin
>   Fetch URL: https://github.com/getnikola/nikola.git
>   Push  URL: https://github.com/getnikola/nikola.git
>   HEAD branch: master
> mdione@diablo:~/src/projects/nikola$ git branch\* master
> mdione@diablo:~/src/projects/nikola$ git pull
> Already up-to-date.
> mdione@diablo:~/src/projects/nikola$ find . -name all-nocdn.*
> mdione@diablo:~/src/projects/nikola$
> 
> I just copied those files from and old attempt to use nikola and the site
> works. This happens with both versions 7.6.0-3 from Debian and from master,
> as you can see above.
> 
> —
> Reply to this email directly or view it on GitHub
> https://github.com/getnikola/nikola/issues/1992.

OTOH, if we don't have webassets installed we should not be referring to those files...


Resolving patch:
diff --git a/nikola/plugins/task/bundles.py b/nikola/plugins/task/bundles.py
--- a/nikola/plugins/task/bundles.py
+++ b/nikola/plugins/task/bundles.py
@@ -52,6 +52,7 @@ def set_site(self, site):
             utils.req_missing(['webassets'], 'USE_BUNDLES', optional=True)
             self.logger.warn('Setting USE_BUNDLES to False.')
             site.config['USE_BUNDLES'] = False
+            site._GLOBAL_CONTEXT['use_bundles'] = False
         super(BuildBundles, self).set_site(site)
 
     def gen_tasks(self):


Test patch: