Skip to content

Commit

Permalink
epub writer: accept EPUB_UUID env var
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Jan 8, 2025
1 parent adbbef0 commit 417a9ac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pyglossary/plugins/ebook_epub2/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# SOFTWARE.
from __future__ import annotations

import os
from typing import TYPE_CHECKING, Any

from pyglossary.ebook_base import EbookWriter
Expand Down Expand Up @@ -163,11 +164,15 @@ class Writer(EbookWriter):
def __init__(self, glos: WriterGlossaryType) -> None:
import uuid

idStr = os.getenv("EPUB_UUID")
if not idStr:
idStr = str(uuid.uuid4()).replace("-", "")

EbookWriter.__init__(
self,
glos,
)
glos.setInfo("uuid", str(uuid.uuid4()).replace("-", ""))
glos.setInfo("uuid", idStr)

@classmethod
def cls_get_prefix(
Expand Down

0 comments on commit 417a9ac

Please sign in to comment.