fixed version and author duplication

This commit is contained in:
2026-05-19 15:06:16 +00:00
parent 7a9efba55d
commit ea012ca95b
3 changed files with 72 additions and 4 deletions

44
.gitignore vendored Normal file
View File

@@ -0,0 +1,44 @@
# Python
__pycache__/
*.py[cod]
*.pyo
*.pyd
.Python
*.egg-info/
*.egg
dist/
build/
wheels/
sdist/
# Virtual envs
.venv/
venv/
env/
# Testing
.pytest_cache/
.coverage
htmlcov/
# Ruff / linting
.ruff_cache/
# Mypy
.mypy_cache/
# Editors
.vscode/
.idea/
*.swp
*.swo
# OS
.DS_Store
Thumbs.db
# ForeignThon compiled output
*.compiled.py
# Temporary Tests
tmp/**

View File

@@ -1,4 +1,30 @@
from importlib.resources import files
from importlib.metadata import version, metadata, PackageNotFoundError
try:
package_name = (__package__ or "").replace("_", "-")
__version__ = version(package_name)
pkg_metadata = metadata(package_name)
# 1. Grab names from BOTH possible fields (Author and Author-email)
raw_authors = pkg_metadata.get_all("Author") or []
raw_emails = pkg_metadata.get_all("Author-email") or []
# 2. Combine them into one single, clean list of unique names
# This strips out the extra email brackets so you just get the clean names
combined = []
for item in (raw_authors + raw_emails):
# Extracts just the name if it looks like "Name <email@domain.com>"
clean_name = item.split("<")[0].strip()
if clean_name and clean_name not in combined:
combined.append(clean_name)
__authors__ = combined
except PackageNotFoundError:
__version__ = "0.0.0"
__authors__ = []
def get_pack_path():
return files(__name__) / "es.json"

View File

@@ -2,9 +2,7 @@
"meta": {
"name": "Spanish",
"native_name": "Español",
"code": "es",
"version": "0.1.0",
"authors": []
"code": "es"
},
"keywords": {
"si": "if",