Changeset View
Changeset View
Standalone View
Standalone View
src/kapidox/generator.py
Show All 24 Lines | |||||
25 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 26 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
27 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
28 | 28 | | |||
29 | # Python 2/3 compatibility (NB: we require at least 2.7) | 29 | # Python 2/3 compatibility (NB: we require at least 2.7) | ||
30 | from __future__ import division, absolute_import, print_function, unicode_literals | 30 | from __future__ import division, absolute_import, print_function, unicode_literals | ||
31 | 31 | | |||
32 | import codecs | 32 | import codecs | ||
33 | from distutils.spawn import find_executable | ||||
33 | import datetime | 34 | import datetime | ||
34 | import os | 35 | import os | ||
35 | import logging | 36 | import logging | ||
36 | import shutil | 37 | import shutil | ||
37 | import subprocess | 38 | import subprocess | ||
38 | import tempfile | 39 | import tempfile | ||
39 | import sys | 40 | import sys | ||
40 | import xml.etree.ElementTree as ET | 41 | import xml.etree.ElementTree as ET | ||
▲ Show 20 Lines • Show All 882 Lines • ▼ Show 20 Line(s) | 922 | for resource in resources: | |||
923 | file_elem.text = resource | 924 | file_elem.text = resource | ||
924 | 925 | | |||
925 | if not os.path.isdir('qch'): | 926 | if not os.path.isdir('qch'): | ||
926 | os.mkdir('qch') | 927 | os.mkdir('qch') | ||
927 | 928 | | |||
928 | name = product.name+".qhp" | 929 | name = product.name+".qhp" | ||
929 | outname = product.name+".qch" | 930 | outname = product.name+".qch" | ||
930 | tree_out.write(name, encoding="utf-8", xml_declaration=True) | 931 | tree_out.write(name, encoding="utf-8", xml_declaration=True) | ||
931 | subprocess.call(["qhelpgenerator", name, '-o', 'qch/'+outname]) | 932 | | ||
933 | # On many distributions, qhelpgenerator from Qt5 is suffixed with | ||||
934 | # "-qt5". Look for it first, and fall back to unsuffixed one if | ||||
935 | # not found. | ||||
936 | qhelpgenerator = find_executable("qhelpgenerator-qt5") | ||||
937 | | ||||
938 | if qhelpgenerator is None: | ||||
939 | qhelpgenerator = "qhelpgenerator" | ||||
940 | | ||||
941 | subprocess.call([qhelpgenerator, name, '-o', 'qch/'+outname]) | ||||
932 | os.remove(name) | 942 | os.remove(name) |