ODT template into resources
This commit was merged in pull request #11.
This commit is contained in:
@@ -11,14 +11,13 @@ authors = [{ name = "Artem Kokos", email = "artem-kokos@mail.ru" }]
|
|||||||
license = { text = "MIT" }
|
license = { text = "MIT" }
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.8",
|
|
||||||
"Programming Language :: Python :: 3.9",
|
"Programming Language :: Python :: 3.9",
|
||||||
"Programming Language :: Python :: 3.10",
|
"Programming Language :: Python :: 3.10",
|
||||||
"Programming Language :: Python :: 3.11",
|
"Programming Language :: Python :: 3.11",
|
||||||
"Operating System :: POSIX :: Linux",
|
"Operating System :: POSIX :: Linux",
|
||||||
"Environment :: Console",
|
"Environment :: Console",
|
||||||
]
|
]
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"python-redmine>=2.4.0",
|
"python-redmine>=2.4.0",
|
||||||
"tabulate>=0.9.0",
|
"tabulate>=0.9.0",
|
||||||
@@ -42,9 +41,12 @@ redmine-reporter = "redmine_reporter.cli:main"
|
|||||||
where = ["."]
|
where = ["."]
|
||||||
include = ["redmine_reporter*"]
|
include = ["redmine_reporter*"]
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
"redmine_reporter" = ["templates/template.odt"]
|
||||||
|
|
||||||
[tool.black]
|
[tool.black]
|
||||||
line-length = 100
|
line-length = 100
|
||||||
target-version = ['py38']
|
target-version = ['py39']
|
||||||
|
|
||||||
[tool.isort]
|
[tool.isort]
|
||||||
profile = "black"
|
profile = "black"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
from importlib import resources
|
||||||
from typing import List
|
from typing import List
|
||||||
from odf.opendocument import load
|
from odf.opendocument import load
|
||||||
from odf.text import P
|
from odf.text import P
|
||||||
@@ -24,11 +25,10 @@ class ODTFormatter(Formatter):
|
|||||||
"""
|
"""
|
||||||
Форматирует данные в объект OpenDocument.
|
Форматирует данные в объект OpenDocument.
|
||||||
"""
|
"""
|
||||||
template_path = "template.odt"
|
|
||||||
if not os.path.exists(template_path):
|
|
||||||
raise FileNotFoundError("Шаблон template.odt не найден...")
|
|
||||||
|
|
||||||
doc = load(template_path)
|
with resources.files("redmine_reporter").joinpath("templates", "template.odt").open("rb") as f:
|
||||||
|
doc = load(f)
|
||||||
|
|
||||||
para_style_name = "Standard"
|
para_style_name = "Standard"
|
||||||
|
|
||||||
# Заголовок
|
# Заголовок
|
||||||
|
|||||||
Reference in New Issue
Block a user