Allow using doxytag2zealdb for docset generation

This allows to generate docsets on Linux too and not only macOS as
before, when it required Xcode.

Closes https://github.com/wxWidgets/wxWidgets/pull/1343
This commit is contained in:
Ian McInerney
2019-06-08 13:56:30 +01:00
committed by Vadim Zeitlin
parent 04435144ac
commit d255ac1fd3
3 changed files with 81 additions and 14 deletions

View File

@@ -0,0 +1,41 @@
#
# write_info_tag.py
# Write a key/value pair to an Info.plist file created by Doxygen
# while generating docsets.
#
# Author: Ian McInerney (https://github.com/imciner2)
import sys
import plistlib
# The first argument is the plist filename without the extension
fname = sys.argv[1] + ".plist"
# The second argument is the key to replace
key = sys.argv[2]
# The thrid argument is the value of the key
val = sys.argv[3]
# Handle boolean values
if val.lower() == "true":
val = True
elif val.lower() == "false":
val = False
if sys.version_info >= (3, 4, 0):
# Use the new API if python 3.4 is used
with open( fname, 'rb' ) as plist_file:
pl = plistlib.load( plist_file )
pl[key] = val
with open( fname, 'wb' ) as plist_file:
pl = plistlib.dump( pl, plist_file )
else:
# Use the old API otherwise (supports python 2.7 as well)
pl = plistlib.readPlist( fname )
pl[key] = val
plistlib.writePlist( pl, fname )