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 from Globals import qVersionTuple |
|
21 |
20 |
22 HelpCollection = r"""<?xml version="1.0" encoding="utf-8" ?> |
21 HelpCollection = r"""<?xml version="1.0" encoding="utf-8" ?> |
23 <QHelpCollectionProject version="1.0"> |
22 <QHelpCollectionProject version="1.0"> |
24 <docFiles> |
23 <docFiles> |
25 <register> |
24 <register> |
269 sys.stdout.flush() |
268 sys.stdout.flush() |
270 sys.stderr.flush() |
269 sys.stderr.flush() |
271 |
270 |
272 cwd = os.getcwd() |
271 cwd = os.getcwd() |
273 # generate the compressed files |
272 # generate the compressed files |
|
273 qhelpgeneratorExe = os.path.join( |
|
274 getQtBinariesPath(), generateQtToolName("qhelpgenerator") |
|
275 ) |
274 shutil.copy( |
276 shutil.copy( |
275 os.path.join(self.outputDir, HelpProjectFile), self.htmlDir) |
277 os.path.join(self.outputDir, HelpProjectFile), self.htmlDir) |
276 os.chdir(self.htmlDir) |
278 os.chdir(self.htmlDir) |
277 subprocess.call([ |
279 subprocess.call([ |
278 os.path.join(getQtBinariesPath(), |
280 qhelpgeneratorExe, |
279 generateQtToolName("qhelpgenerator")), |
|
280 HelpProjectFile, "-o", os.path.join(self.outputDir, HelpHelpFile)]) |
281 HelpProjectFile, "-o", os.path.join(self.outputDir, HelpHelpFile)]) |
281 os.remove(HelpProjectFile) |
282 os.remove(HelpProjectFile) |
282 |
283 |
283 # TODO: do this with qhelpgenerator >= 5.12.0 |
284 if self.createCollection: |
284 if qVersionTuple() < (5, 12, 0) and 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 |
285 sys.stdout.write("Generating QtHelp collection...\n") |
291 sys.stdout.write("Generating QtHelp collection...\n") |
286 sys.stdout.flush() |
292 sys.stdout.flush() |
287 sys.stderr.flush() |
293 sys.stderr.flush() |
288 os.chdir(self.outputDir) |
294 os.chdir(self.outputDir) |
289 subprocess.call([ |
295 subprocess.call([ |
290 os.path.join(getQtBinariesPath(), |
296 qcollectiongeneratorExe, |
291 generateQtToolName("qcollectiongenerator")), |
|
292 HelpCollectionProjectFile, "-o", HelpCollectionFile]) |
297 HelpCollectionProjectFile, "-o", HelpCollectionFile]) |
293 |
298 |
294 os.chdir(cwd) |
299 os.chdir(cwd) |