Skip to main content

A package for reading and writing World of Warcraft addon TOC files.

Project description

Tests

pytoc

A Python package for parsing World of Warcraft TOC files used in addons.

Installation

You can install this package via pip by pointing it to this repository.

pip install git+https://github.com/Ghostopheles/pytoc.git

Usage

Reading a TOC file:

from pytoc import TOCFile, Dependency

file_path: str = "X:/path/to/my/addon.toc"
toc = TOCFile(file_path)

print(toc.Interface)
print(toc.Title)
print(toc.LocalizedTitles["frFR"])
print(toc.AdditionalFields["X-Website"])

for file in toc.Files:
    print(file)

for dep in toc.Dependencies
    dep: Dependency
    print(f"Dependency Name: {dep.Name} Required: {dep.Required}")

Writing a TOC file:

from pytoc import TOCFile

toc = TOCFile()
toc.Interface = 110000
toc.Author = "Ghost"
toc.Files = ["file1.lua", "file2.xml"]

required = True
toc.add_dependency("totalRP3", required)

output = "path/to/dest.toc"
toc.export(output)

For some examples, take a look at the test_toc.py file.

Notes

All dependency fields will be added to the TOCFile.Dependencies list. Fields that are not available to addons, or extra fields that don't begin with "X-" will be added directly to the object namespace.

Fields will overwrite eachother if more than one of that directive is present in the TOC file.

For certain fields that accept comma-delimited input, the attribute may end up being either a list or a str|int, depending on if there are multiple entries or just a single one.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wow_pytoc-0.5.0.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

wow_pytoc-0.5.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file wow_pytoc-0.5.0.tar.gz.

File metadata

  • Download URL: wow_pytoc-0.5.0.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for wow_pytoc-0.5.0.tar.gz
Algorithm Hash digest
SHA256 1e1277066687f009af723b27be19e8fa1dad6c4f693f659b9b6649d0f72ac097
MD5 5e9980f33f103aca5425d4d8ac0b9c99
BLAKE2b-256 11c4d3fb8b5af3627fada03adbe9d28f4e8d8dab845eab2550b0aa2b5f6df9c0

See more details on using hashes here.

File details

Details for the file wow_pytoc-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: wow_pytoc-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for wow_pytoc-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cee2ea0d57ef37fcf061e308770417fbc3c9ef1d1fd2736695cff0ef556eb578
MD5 6bdcac07cee95efd39883ba47800d28f
BLAKE2b-256 99882ca792fd9f086c667a8bd7a8275acc6339127c8c048e804e6d22376f9947

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page