Parse, create and modify fomod installers.
Project description
Parse, create and modify fomod installers.
pyfomod makes it easy to work on fomod installers:
No need to deal with non-human-readable formats;
No need to copy/paste from other installers;
No need for trial-and-error changes;
No need to know how to write xml;
No need to modify complex files to get what you want.
pyfomod lets you create your own installer with minimal knowledge of fomod or even xml.
Quick Examples
Create a new installer:
>>> from pyfomod import new, to_string >>> new_installer = new() >>> info_content, conf_content = to_string(new_installer) >>> print(info_content.decode('utf8')) # pyfomod always serializes to utf-8 <?xml version='1.0' encoding='utf-8'?> <fomod/> >>> print(conf_content.decode('utf8')) <?xml version='1.0' encoding='utf-8'?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://qconsulting.ca/fo3/ModConfig5.0.xsd"> <moduleName/> </config>
Validate other installers:
>>> from pyfomod import validate >>> validate("path/to/info.xml") True >>> validate("path/to/ModuleConfig.xml") False
Writing a brand new installer:
example └── mod_file.dat
>>> from pyfomod import new, write >>> new_installer = new() >>> write(new_installer, 'path/to/example')
example ├── fomod │ ├── info.xml │ └── ModuleConfig.xml └── mod_file.dat
Installation
To install pyfomod, use pip:
pip install pyfomod
Simple as that! You now have pyfomod available in your environment.
Overview
The high-level API is meant for users looking to do quick and common operations on an installer:
No prior knowledge of fomod or xml needed;
Simple, intuitive functions and methods;
All operations are based on the commonly used installer UI.
The low-level API is meant for users that need more control than the high-level offers. It’s based on the lxml package and all its features are available (the only overwritten methods are copy/deepcopy). However, it is recommended to only use functions/methods that do not modify the xml tree - more info on this topic on the documentation.
Full control over the xml trees.
Validation occurs on every method/function that modifies the trees, ensuring a perfect end result;
lxml’s and pyfomod’s API’s can be used side-by-side with no risk due to the previous point;
Ability to check which attributes/children are valid for each element before modifying.
Issues
Please use the GitHub issue tracker to submit bugs or request features.
Documentation
For more information check out pyfomod’s documentation at pyfomod.rtfd.io
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.