14 import os |
14 import os |
15 import shutil |
15 import shutil |
16 import subprocess |
16 import subprocess |
17 |
17 |
18 from Utilities import joinext, relpath, html_encode, getQtBinariesPath, \ |
18 from Utilities import joinext, relpath, html_encode, getQtBinariesPath, \ |
19 generateQtToolName |
19 generateQtToolName, isExecutable |
20 |
20 |
21 HelpCollection = r"""<?xml version="1.0" encoding="utf-8" ?> |
21 HelpCollection = r"""<?xml version="1.0" encoding="utf-8" ?> |
22 <QHelpCollectionProject version="1.0"> |
22 <QHelpCollectionProject version="1.0"> |
23 <docFiles> |
23 <docFiles> |
24 <register> |
24 <register> |
268 sys.stdout.flush() |
268 sys.stdout.flush() |
269 sys.stderr.flush() |
269 sys.stderr.flush() |
270 |
270 |
271 cwd = os.getcwd() |
271 cwd = os.getcwd() |
272 # generate the compressed files |
272 # generate the compressed files |
|
273 qhelpgeneratorExe = os.path.join( |
|
274 getQtBinariesPath(), generateQtToolName("qhelpgenerator") |
|
275 ) |
273 shutil.copy( |
276 shutil.copy( |
274 os.path.join(self.outputDir, HelpProjectFile), self.htmlDir) |
277 os.path.join(self.outputDir, HelpProjectFile), self.htmlDir) |
275 os.chdir(self.htmlDir) |
278 os.chdir(self.htmlDir) |
276 subprocess.call([ |
279 subprocess.call([ |
277 os.path.join(getQtBinariesPath(), |
280 qhelpgeneratorExe, |
278 generateQtToolName("qhelpgenerator")), |
|
279 HelpProjectFile, "-o", os.path.join(self.outputDir, HelpHelpFile)]) |
281 HelpProjectFile, "-o", os.path.join(self.outputDir, HelpHelpFile)]) |
280 os.remove(HelpProjectFile) |
282 os.remove(HelpProjectFile) |
281 |
283 |
282 if self.createCollection: |
284 if self.createCollection: |
|
285 qcollectiongeneratorExe = os.path.join( |
|
286 getQtBinariesPath(), generateQtToolName("qcollectiongenerator") |
|
287 ) |
|
288 if not isExecutable(qcollectiongeneratorExe): |
|
289 # assume Qt >= 5.12.0 |
|
290 qcollectiongeneratorExe = qhelpgeneratorExe |
283 sys.stdout.write("Generating QtHelp collection...\n") |
291 sys.stdout.write("Generating QtHelp collection...\n") |
284 sys.stdout.flush() |
292 sys.stdout.flush() |
285 sys.stderr.flush() |
293 sys.stderr.flush() |
286 os.chdir(self.outputDir) |
294 os.chdir(self.outputDir) |
287 subprocess.call([ |
295 subprocess.call([ |
288 os.path.join(getQtBinariesPath(), |
296 qcollectiongeneratorExe, |
289 generateQtToolName("qcollectiongenerator")), |
|
290 HelpCollectionProjectFile, "-o", HelpCollectionFile]) |
297 HelpCollectionProjectFile, "-o", HelpCollectionFile]) |
291 |
298 |
292 os.chdir(cwd) |
299 os.chdir(cwd) |