Bug#951152: new archmage version breaks keepass2 documentation build
fixed 951152 1:0.4.2.1-1 thanks OK, 1:0.4.2.1-1 with the fix is in unstable. On 11 Feb 2020, at 23:08, Julian Taylor wrote: On 11.02.20 22:13, Mikhail Gusarov wrote: Hi Julian, On 11 Feb 2020, at 21:25, Julian Taylor wrote: For keepass I only need to be able to build html files from the chm source directory, the package has no compiled chm file one can use the current cli functions on. Please try https://github.com/dottedmag/archmage/commit/c8f186dff0c8da56590e900cc2a32b39e19bf08b - if it works, then I'll cut a new release and a package. it is working great, thanks
Bug#951152: new archmage version breaks keepass2 documentation build
On 11.02.20 22:13, Mikhail Gusarov wrote: > Hi Julian, > > On 11 Feb 2020, at 21:25, Julian Taylor wrote: > >> For keepass I only need to be able to build html files from the chm >> source directory, the package has no compiled chm file one can use the >> current cli functions on. > > Please try > https://github.com/dottedmag/archmage/commit/c8f186dff0c8da56590e900cc2a32b39e19bf08b > > > - if it works, then I'll cut a new release and a package. > it is working great, thanks signature.asc Description: OpenPGP digital signature
Bug#951152: new archmage version breaks keepass2 documentation build
Hi Julian, On 11 Feb 2020, at 21:25, Julian Taylor wrote: For keepass I only need to be able to build html files from the chm source directory, the package has no compiled chm file one can use the current cli functions on. Please try https://github.com/dottedmag/archmage/commit/c8f186dff0c8da56590e900cc2a32b39e19bf08b - if it works, then I'll cut a new release and a package. Best, Misha.
Bug#951152: new archmage version breaks keepass2 documentation build
Hello Julian, On 11 Feb 2020, at 20:23, Julian Taylor wrote: > The new archmage version breaks the documentation build of the keepass2 > package. This is due to the (maybe accidental) removal of the availity > to render html files from chm sources. Fun. While reworking pychm I had a careful look of all dependencies to see what subsets of API do they use, but it never occurred to me that there might be programs out there that use (never guaranteed to be stable) innards of Archmage. Keepass packaging definitely needs to stop doing this. What's missing from Archmage CLI if I reimplement HTML generation from unpacked CHM files tree? > I have filed patch upstream to restore that ability: > https://github.com/dottedmag/archmage/pull/17 > > As it is required to update keepass2 and remove its python2 dependency, > could it be considered to add it to the package if upstream does not > react soon? Well, I'm the upstream. Best, Misha.
Bug#951152: new archmage version breaks keepass2 documentation build
On 11.02.20 21:20, Mikhail Gusarov wrote: > Hello Julian, > > On 11 Feb 2020, at 20:23, Julian Taylor wrote: > >> The new archmage version breaks the documentation build of the keepass2 >> package. This is due to the (maybe accidental) removal of the availity >> to render html files from chm sources. > > Fun. While reworking pychm I had a careful look of all dependencies to see > what subsets of API do they use, but it never occurred to me that there > might be programs out there that use (never guaranteed to be stable) innards > of Archmage. > > Keepass packaging definitely needs to stop doing this. What's missing from > Archmage CLI if I reimplement HTML generation from unpacked CHM files tree? > I'll gladly remove the usage of the module functions when the cli provides this functionality. Currently (and in the past) it requires a compiled chm to extract from. For keepass I only need to be able to build html files from the chm source directory, the package has no compiled chm file one can use the current cli functions on.
Bug#951152: new archmage version breaks keepass2 documentation build
Package: archmage Version: 1:0.4.1-2 Severity: important Tags: patch The new archmage version breaks the documentation build of the keepass2 package. This is due to the (maybe accidental) removal of the availity to render html files from chm sources. I have filed patch upstream to restore that ability: https://github.com/dottedmag/archmage/pull/17 As it is required to update keepass2 and remove its python2 dependency, could it be considered to add it to the package if upstream does not react soon? From 7591fd2427ebef2585347c7c567aa038a1fcab66 Mon Sep 17 00:00:00 2001 From: Julian Taylor Date: Sun, 9 Feb 2020 19:31:45 +0100 Subject: [PATCH] restore ability to render html from chm templates add back the ability to export htlm files from chm templates via: python3 -c 'import archmage.CHM; archmage.CHM.CHMFile("chmdir").process_templates("output")' Closes gh-16 --- archmage/CHM.py | 45 - 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/archmage/CHM.py b/archmage/CHM.py index 93b0591..fbd37c4 100644 --- a/archmage/CHM.py +++ b/archmage/CHM.py @@ -82,16 +82,24 @@ class CHMFile: return self.cache['entries'] def _entries(self): -def get_name(chmfile, ui, out): -path = ui.path.decode('utf-8') -if path != '/': -out.append(path) -return chmlib.CHM_ENUMERATOR_CONTINUE +if self._chm is None: +entries = [] +for root, dirs, files in os.walk(self.sourcename): +for f in files: +fn = '/'.join((root.lstrip(self.sourcename), f)) +entries.append(fn) +return entries +else: +def get_name(chmfile, ui, out): +path = ui.path.decode('utf-8') +if path != '/': +out.append(path) +return chmlib.CHM_ENUMERATOR_CONTINUE -out = [] -if chmlib.chm_enumerate(self._chm, chmlib.CHM_ENUMERATE_ALL, get_name, out) == 0: -sys.exit('UnknownError: CHMLIB or PyCHM bug?') -return out +out = [] +if chmlib.chm_enumerate(self._chm, chmlib.CHM_ENUMERATE_ALL, get_name, out) == 0: +sys.exit('UnknownError: CHMLIB or PyCHM bug?') +return out # retrieves the list of HTML files contained into the CHM file, **in order** # (that's the important bit). @@ -327,14 +335,17 @@ class CHMEntry(object): def read(self): """Read CHM entry content""" -result, ui = chmlib.chm_resolve_object(self.parent._chm, self.name.encode('utf-8')) -if result != chmlib.CHM_RESOLVE_SUCCESS: -return None - -size, content = chmlib.chm_retrieve_object(self.parent._chm, ui, 0, ui.length) -if size == 0: -return None -return content +if self.parent._chm: +result, ui = chmlib.chm_resolve_object(self.parent._chm, self.name.encode('utf-8')) +if result != chmlib.CHM_RESOLVE_SUCCESS: +return None + +size, content = chmlib.chm_retrieve_object(self.parent._chm, ui, 0, ui.length) +if size == 0: +return None +return content +else: +return open(self.parent.sourcename + self.name).read() def lower_links(self, text): """Links to lower case""" -- 2.20.1 signature.asc Description: OpenPGP digital signature