[sword-devel] Making a Zip archive of a module?

Greg Hellings greg.hellings at gmail.com
Thu Jan 10 20:45:51 MST 2019


On Thu, Jan 10, 2019 at 9:42 PM Greg Hellings <greg.hellings at gmail.com>
wrote:

>
>
> On Thu, Jan 10, 2019 at 12:22 PM David Haslam <dfhdfh at protonmail.com>
> wrote:
>
>> I was rather hoping that a tool that takes just the ModuleName as its
>> parameter might be available.
>>
>> If we can have
>> mkfastmod ModuleName
>>
>
> Creating indexes is a SWORD-specific feature
>
>
>> and
>> mod2zmod ModuleName
>>
>
> Compressing a module is a SWORD-specific feature
>
>
>> then why not one like
>> zipmod ModuleName
>> that finds the right files by looking up the path in .conf file?
>>
>
> Creating an archive from known file paths is a standard feature of the
> operating system you're working with or its default utilities. There's
> nothing really here for the library to do.
>
> That said, here's a Python script that will do exactly what you asked for.
> https://github.com/greg-hellings/sword-helpers
> It requires that you have the Sword Python bindings in place.
>

I should note that it will work on an arbitrary number of module names,
creating a separate zip file for each one.

Also, I would note to Troy that I couldn't find a decent way through the
API to query an SWModule and ask it for its conf file. In order to find the
conf file for the appropriate module I had to traverse all files in the
mods.d directory under the SWModule.getConfigEntry('PrefixPath') +
"/mods.d/" folder, parse the INI file, and look for one with an INI section
name that matched the name of the module. This was a bit tricky because our
conf file is *almost* standard INI format, but just enough to make the
Python ConfigParser module cough a little bit. It would be awesome to add a
SWModule.getConfigFilePath() method or similar.

--Greg

>
> --Greg
>
>>
>> David
>>
>> Sent from ProtonMail Mobile
>>
>>
>> On Thu, Jan 10, 2019 at 18:13, Dudeck, John <John.Dudeck at sim.org> wrote:
>>
>> David, here's a snippet from my bat files that I use for creating
>> modules. The zip files import into AndBible without problem.
>>
>> ========================================
>> rem usage: OSIS2sword-bibles sourcepath/filename
>> set modname=%~n1
>>
>> [snip]
>>
>> rem create zip file
>> rem delete any previous zip
>> del "%modname%.zip"
>> rem (uses zip.exe from
>> http://downloads.sourceforge.net/gnuwin32/zip-3.0-setup.exe)
>> "c:Program Files (x86)GnuWin32 inzip.exe" -r -u "%modname%.zip" mods.d*
>> modules*
>> ========================================
>>
>>
>>
>> > I normally use the Xiphos Module Manager (Maintenance | Archive) to
>> create a compressed Zip
>> > archive of a selected module.
>> >
>> > Is there an equivalent Sword Utility to perform the same task in a
>> command shell ?
>> >
>> > Regards,
>> >
>> > David
>> >
>> > Sent from ProtonMail Mobile
>>
>> John Dudeck
>> Programmer at Editions Cle                             Lyon, France
>> john.dudeck at sim.org                            john at editionscle.com
>> --
>> Table saw: A large stationary power tool commonly used to launch wood
>> projectiles for testing wall integrity.
>>
>>
>>
>>
>> _______________________________________________
>> sword-devel mailing list: sword-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel
>> Instructions to unsubscribe/change your settings at above page
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/sword-devel/attachments/20190110/4f911cd1/attachment.html>


More information about the sword-devel mailing list