Generate Apol compressed help file with "setup.py build_qhc"

"setup.py build_qhc" invokes qcollectiongenerator on qhc/apol.qhcp,
which produces two files:
- apol.qhc, a Qt Help Collection file
- apol.qch, a Qt Compressed Help file

As apol.qhc is merely a set of metadata with a relative link to
apol.qch, Qt Assistant requires both files in order to display Apol
help.

Make "setup.py build_qhc" build both files in setoolsgui/apol/.

Moreover '*.qch' needs to be added to package_data in order to install
apol.qch.

Fixes: https://github.com/TresysTechnology/setools/issues/165
This commit is contained in:
Nicolas Iooss 2017-02-15 21:28:06 +01:00
parent e3a905f027
commit 3868613c8f
No known key found for this signature in database
GPG Key ID: C191415F340DAAA0
2 changed files with 7 additions and 7 deletions

4
.gitignore vendored
View File

@ -11,8 +11,8 @@ setools/policyrep/qpol.py
*.so
# Qt Generated Help files
help/apol.qch
#help/apol.qhc
qhc/apol.qch
qhc/apol.qhc
# Generated by tox
/.tox

View File

@ -24,13 +24,13 @@ class QtHelpCommand(Command):
pass
def run(self):
command = ['qcollectiongenerator', 'apol.qhcp', '-o', '../setoolsgui/apol/apol.qhc']
command = ['qcollectiongenerator', 'qhc/apol.qhcp']
self.announce("Building Qt help files", level=log.INFO)
self.announce(' '.join(command), level=log.INFO)
pwd = os.getcwd()
os.chdir("./qhc")
subprocess.check_call(command)
os.chdir(pwd)
self.announce("Moving Qt help files to setoolsgui/apol")
os.rename('qhc/apol.qhc', 'setoolsgui/apol/apol.qhc')
os.rename('qhc/apol.qch', 'setoolsgui/apol/apol.qch')
class YaccCommand(Command):
@ -182,7 +182,7 @@ setup(name='setools',
packages=['setools', 'setools.diff', 'setools.policyrep', 'setoolsgui', 'setoolsgui.apol'],
scripts=['apol', 'sediff', 'seinfo', 'seinfoflow', 'sesearch', 'sedta'],
data_files=[(join(sys.prefix, 'share/man/man1'), glob.glob("man/*.1"))],
package_data={'': ['*.ui', '*.qhc'], 'setools': ['perm_map']},
package_data={'': ['*.ui', '*.qhc', '*.qch'], 'setools': ['perm_map']},
ext_modules=ext_py_mods,
test_suite='tests',
license='GPLv2+, LGPLv2.1+',