summaryrefslogtreecommitdiff
path: root/sphinx/builders/devhelp.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2016-09-02 01:19:47 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2016-09-15 22:47:47 +0900
commitc147f6496e6e429610452072cb71f5a616992d8e (patch)
treec0b4f993ee4c8f291a0791fa419b354b9ad9d7e4 /sphinx/builders/devhelp.py
parent6563a8793fa564999bb65aa771b23255849f7f27 (diff)
downloadsphinx-git-c147f6496e6e429610452072cb71f5a616992d8e.tar.gz
Fix #2919: Drop py26 support
Diffstat (limited to 'sphinx/builders/devhelp.py')
-rw-r--r--sphinx/builders/devhelp.py21
1 files changed, 4 insertions, 17 deletions
diff --git a/sphinx/builders/devhelp.py b/sphinx/builders/devhelp.py
index 0f88e9f38..fd6f3400e 100644
--- a/sphinx/builders/devhelp.py
+++ b/sphinx/builders/devhelp.py
@@ -13,6 +13,7 @@
from __future__ import absolute_import
import re
+import gzip
from os import path
from docutils import nodes
@@ -24,22 +25,7 @@ from sphinx.builders.html import StandaloneHTMLBuilder
try:
import xml.etree.ElementTree as etree
except ImportError:
- try:
- import lxml.etree as etree
- except ImportError:
- try:
- import elementtree.ElementTree as etree
- except ImportError:
- import cElementTree as etree
-
-try:
- import gzip
-
- def comp_open(filename, mode='rb'):
- return gzip.open(filename + '.gz', mode)
-except ImportError:
- def comp_open(filename, mode='rb'):
- return open(filename, mode)
+ import lxml.etree as etree
class DevhelpBuilder(StandaloneHTMLBuilder):
@@ -129,7 +115,8 @@ class DevhelpBuilder(StandaloneHTMLBuilder):
write_index(title, refs, subitems)
# Dump the XML file
- with comp_open(path.join(outdir, outname + '.devhelp'), 'w') as f:
+ xmlfile = path.join(outdir, outname + '.devhelp.gz')
+ with gzip.open(xmlfile, 'w') as f:
tree.write(f, 'utf-8')