Copy translation files into place with setup.

This commit is contained in:
Storm Dragon 2024-12-20 08:57:27 -05:00
parent 29a2db0e0c
commit dd52d08171
2 changed files with 25 additions and 19 deletions

View File

@ -6,16 +6,22 @@ from shutil import copyfile
from setuptools import find_packages
from setuptools import setup
fenrirVersion = '1.9.9'
packageVersion = 'post1'
# handle flags for package manager like aurman and pacaur.
forceSettings = False
forceSettingsFlag = False
if "--force-settings" in sys.argv:
forceSettings = True
forceSettingsFlag = True
sys.argv.remove("--force-settings")
data_files = []
dataFiles = []
# Handle locale files
localeFiles = glob.glob('locale/*/LC_MESSAGES/*.mo')
for localeFile in localeFiles:
lang = localeFile.split(os.sep)[1]
destDir = f'/usr/share/locale/{lang}/LC_MESSAGES'
dataFiles.append((destDir, [localeFile]))
# Handle other configuration files
directories = glob.glob('config/*')
for directory in directories:
files = glob.glob(directory+'/*')
@ -26,7 +32,7 @@ for directory in directories:
destDir = '/etc/fenrirscreenreader/keyboard'
elif 'config/settings' in directory:
destDir = '/etc/fenrirscreenreader/settings'
if not forceSettings:
if not forceSettingsFlag:
try:
del(files[files.index('config/settings/settings.conf')])
except:
@ -34,17 +40,17 @@ for directory in directories:
elif 'config/scripts' in directory:
destDir = '/usr/share/fenrirscreenreader/scripts'
if destDir != '':
data_files.append((destDir, files))
dataFiles.append((destDir, files))
files = glob.glob('config/sound/default/*')
destDir = '/usr/share/sounds/fenrirscreenreader/default'
data_files.append((destDir, files))
dataFiles.append((destDir, files))
files = glob.glob('config/sound//template/*')
destDir = '/usr/share/sounds/fenrirscreenreader/template'
data_files.append((destDir, files))
dataFiles.append((destDir, files))
files = glob.glob('tools/*')
data_files.append(('/usr/share/fenrirscreenreader/tools', files))
data_files.append(('/usr/share/man/man1', ['docs/fenrir.1']))
dataFiles.append(('/usr/share/fenrirscreenreader/tools', files))
dataFiles.append(('/usr/share/man/man1', ['docs/fenrir.1']))
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
@ -52,15 +58,16 @@ def read(fname):
setup(
# Application name:
name="fenrir-screenreader",
# Version number:
version=fenrirVersion + '.' + packageVersion,
# Version is now handled by setuptools_scm
use_scm_version=True,
setup_requires=['setuptools_scm'],
# description
description="A TTY Screen Reader for Linux.",
long_description=read('README.md'),
keywords=['screenreader', 'a11y', 'accessibility', 'terminal', 'TTY', 'console'],
license="License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
url="https://git.stormux.org/storm/fenrir/",
download_url = 'https://git.stormux.org/storm/fenrir/archive/' + fenrirVersion + '.tar.gz',
# Remove download_url as it contained hardcoded version
classifiers=[
"Programming Language :: Python",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
@ -82,7 +89,7 @@ setup(
include_package_data=True,
zip_safe=False,
data_files=data_files,
data_files=dataFiles,
# Dependent packages (distributions)
install_requires=[
@ -95,10 +102,9 @@ setup(
"pyttsx3",
"pyte>=0.7.0",
],
)
if not forceSettings:
if not forceSettingsFlag:
print('')
# create settings file from example if not exist
if not os.path.isfile('/etc/fenrirscreenreader/settings/settings.conf'):

View File

@ -4,5 +4,5 @@
# Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers.
version = "2024.12.15"
version = "2024.12.20"
codeName = "testing"