2017-05-21 Fixable issues with Sphinx 1.6.1ΒΆ

Sphinx has released a new version 1.6.1. Other packages updated their code but some issues remain. I had to modify the code of the file sphinx/transforms/__init__.py to propage the environment env if not present.

def apply_transforms(self):
    if isinstance(self.document, nodes.document):
        Transformer.apply_transforms(self)
    else:
        # wrap the target node by document node during transforming
        try:
            document = new_document('')
            if self.env:
                document.settings.env = self.env
            document += self.document
            if not hasattr(document, "settings"):
                if hasattr(self.document, "settings"):
                    document.settings = self.document.settings
            elif not hasattr(document.settings, "env") and hasattr(self.document, "settings") and hasattr(self.document.settings, "env"):
                document.settings.env = self.document.settings.env
            self.document = document
            Transformer.apply_transforms(self)
        finally:
            self.document = self.document[0]