Merge branch 'upgrade-docker'

This commit is contained in:
Yax 2024-12-12 19:25:06 +01:00
commit c151623a68
4 changed files with 24 additions and 6 deletions

View file

@ -20,7 +20,7 @@ jobs:
run: |
uv python pin ${{ matrix.python-version }}
uv sync
rm -rf build *.egg-info
rm -rf build/* dist/* *.egg-info
uv build --wheel --out-dir dist
- name: Build the Docker image
run: |

View file

@ -30,7 +30,9 @@ test:
# build
build:
rm -rf build *.egg-info
# https://stackoverflow.com/questions/24347450/how-do-you-add-additional-files-to-a-wheel
rm -rf build/* dist/* *.egg-info
>>>>>>> upgrade-docker
uv build --wheel --out-dir dist
docker build -t kianby/stacosys .

View file

@ -26,3 +26,16 @@ dev = [
"pytest>=8.3.4",
"black>=24.10.0",
]
[tool.setuptools]
package-dir = { "" = "src" } # Specify the root directory for packages
packages = ["stacosys"]
[tool.setuptools.package-data]
# Include `.properties` and `.html` files in the specified directories
"stacosys.i18n" = ["*.properties"]
"stacosys.interface.templates" = ["*.html"]
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

View file

@ -1,6 +1,6 @@
import configparser
import os
import importlib.resources
class Messages:
def __init__(self):
@ -8,9 +8,12 @@ class Messages:
def load_messages(self, lang):
config = configparser.ConfigParser()
config.read(
os.path.join(os.path.dirname(__file__), "messages_" + lang + ".properties")
)
# Access the resource file within the package
with importlib.resources.open_text(
__package__, f"messages_{lang}.properties"
) as file:
config.read_file(file)
for key, value in config.items("messages"):
self.property_dict[key] = value