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

View File

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