2022-04-09 05:14:48 -04:00
|
|
|
#!/usr/bin/env python3
|
2017-05-23 11:00:46 -04:00
|
|
|
#https://python-packaging.readthedocs.io/en/latest/minimal.html
|
2017-10-21 10:03:03 -04:00
|
|
|
import os, glob, sys
|
2017-10-20 15:24:50 -04:00
|
|
|
import os.path
|
|
|
|
from shutil import copyfile
|
2016-10-04 17:07:19 -04:00
|
|
|
from setuptools import find_packages
|
|
|
|
from setuptools import setup
|
2017-10-20 15:24:50 -04:00
|
|
|
|
2019-02-15 17:01:11 -05:00
|
|
|
# handle flags for package manager like aurman and pacaur.
|
2024-12-20 08:57:27 -05:00
|
|
|
forceSettingsFlag = False
|
2017-10-21 10:03:03 -04:00
|
|
|
if "--force-settings" in sys.argv:
|
2024-12-20 08:57:27 -05:00
|
|
|
forceSettingsFlag = True
|
2017-10-21 10:03:03 -04:00
|
|
|
sys.argv.remove("--force-settings")
|
2017-07-25 11:19:40 -04:00
|
|
|
|
2024-12-20 08:57:27 -05:00
|
|
|
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
|
2017-07-25 11:50:59 -04:00
|
|
|
directories = glob.glob('config/*')
|
2017-07-25 11:19:40 -04:00
|
|
|
for directory in directories:
|
2019-02-15 17:01:11 -05:00
|
|
|
files = glob.glob(directory+'/*')
|
2017-07-25 11:50:59 -04:00
|
|
|
destDir = ''
|
2017-07-25 11:46:38 -04:00
|
|
|
if 'config/punctuation' in directory :
|
2018-03-21 06:10:12 -04:00
|
|
|
destDir = '/etc/fenrirscreenreader/punctuation'
|
2017-07-25 11:46:38 -04:00
|
|
|
elif 'config/keyboard' in directory:
|
2018-03-21 06:10:12 -04:00
|
|
|
destDir = '/etc/fenrirscreenreader/keyboard'
|
2017-07-25 11:46:38 -04:00
|
|
|
elif 'config/settings' in directory:
|
2018-03-21 06:10:12 -04:00
|
|
|
destDir = '/etc/fenrirscreenreader/settings'
|
2024-12-20 08:57:27 -05:00
|
|
|
if not forceSettingsFlag:
|
2017-10-21 10:03:03 -04:00
|
|
|
try:
|
|
|
|
del(files[files.index('config/settings/settings.conf')])
|
|
|
|
except:
|
|
|
|
pass
|
2017-07-25 11:46:38 -04:00
|
|
|
elif 'config/scripts' in directory:
|
2019-02-15 17:01:11 -05:00
|
|
|
destDir = '/usr/share/fenrirscreenreader/scripts'
|
2017-07-25 11:50:59 -04:00
|
|
|
if destDir != '':
|
2024-12-20 08:57:27 -05:00
|
|
|
dataFiles.append((destDir, files))
|
2017-07-25 12:00:06 -04:00
|
|
|
|
2019-02-15 17:01:11 -05:00
|
|
|
files = glob.glob('config/sound/default/*')
|
|
|
|
destDir = '/usr/share/sounds/fenrirscreenreader/default'
|
2024-12-20 08:57:27 -05:00
|
|
|
dataFiles.append((destDir, files))
|
2019-02-15 17:01:11 -05:00
|
|
|
files = glob.glob('config/sound//template/*')
|
2018-03-21 06:10:12 -04:00
|
|
|
destDir = '/usr/share/sounds/fenrirscreenreader/template'
|
2024-12-20 08:57:27 -05:00
|
|
|
dataFiles.append((destDir, files))
|
2017-07-25 17:46:59 -04:00
|
|
|
files = glob.glob('tools/*')
|
2024-12-20 08:57:27 -05:00
|
|
|
dataFiles.append(('/usr/share/fenrirscreenreader/tools', files))
|
|
|
|
dataFiles.append(('/usr/share/man/man1', ['docs/fenrir.1']))
|
2017-07-25 11:19:40 -04:00
|
|
|
|
2016-10-04 17:07:19 -04:00
|
|
|
def read(fname):
|
|
|
|
return open(os.path.join(os.path.dirname(__file__), fname)).read()
|
|
|
|
|
|
|
|
setup(
|
|
|
|
# Application name:
|
2017-10-02 13:09:25 -04:00
|
|
|
name="fenrir-screenreader",
|
2024-12-20 08:57:27 -05:00
|
|
|
# Version is now handled by setuptools_scm
|
|
|
|
use_scm_version=True,
|
|
|
|
setup_requires=['setuptools_scm'],
|
2017-07-25 04:58:37 -04:00
|
|
|
# description
|
2018-07-20 20:04:32 -04:00
|
|
|
description="A TTY Screen Reader for Linux.",
|
2017-07-25 04:58:37 -04:00
|
|
|
long_description=read('README.md'),
|
2019-02-15 17:01:11 -05:00
|
|
|
keywords=['screenreader', 'a11y', 'accessibility', 'terminal', 'TTY', 'console'],
|
2017-07-25 04:58:37 -04:00
|
|
|
license="License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
|
2024-12-02 17:03:16 -05:00
|
|
|
url="https://git.stormux.org/storm/fenrir/",
|
2024-12-20 08:57:27 -05:00
|
|
|
# Remove download_url as it contained hardcoded version
|
2017-07-25 04:58:37 -04:00
|
|
|
classifiers=[
|
2019-02-15 17:01:11 -05:00
|
|
|
"Programming Language :: Python",
|
|
|
|
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
|
2017-07-25 04:58:37 -04:00
|
|
|
"Development Status :: 5 - Production/Stable",
|
2017-07-25 07:48:55 -04:00
|
|
|
"Topic :: Multimedia :: Sound/Audio :: Speech",
|
2019-02-15 17:01:11 -05:00
|
|
|
"Environment :: Console",
|
2017-07-25 04:58:37 -04:00
|
|
|
],
|
2019-02-15 17:01:11 -05:00
|
|
|
|
2016-10-04 17:07:19 -04:00
|
|
|
# Application author details:
|
2024-12-02 17:03:16 -05:00
|
|
|
author="Storm Dragon, Jeremiah, Chrys and others",
|
|
|
|
author_email="storm_dragon@stormux.org",
|
2016-10-04 17:07:19 -04:00
|
|
|
|
|
|
|
# Packages
|
2018-03-21 06:56:09 -04:00
|
|
|
packages=find_packages('src/'),
|
|
|
|
package_dir={'': 'src/'},
|
2024-12-07 23:39:22 -05:00
|
|
|
scripts=['src/fenrir'],
|
2016-10-04 17:07:19 -04:00
|
|
|
|
|
|
|
# Include additional files into the package
|
|
|
|
include_package_data=True,
|
|
|
|
zip_safe=False,
|
2017-07-25 10:59:19 -04:00
|
|
|
|
2024-12-20 08:57:27 -05:00
|
|
|
data_files=dataFiles,
|
2019-02-15 17:01:11 -05:00
|
|
|
|
2016-10-04 17:07:19 -04:00
|
|
|
# Dependent packages (distributions)
|
|
|
|
install_requires=[
|
2019-01-26 04:46:05 -05:00
|
|
|
"evdev>=1.1.2",
|
|
|
|
"daemonize>=2.5.0",
|
|
|
|
"dbus-python>=1.2.8",
|
|
|
|
"pyudev>=0.21.0",
|
2017-07-25 09:19:13 -04:00
|
|
|
"setuptools",
|
2017-10-20 18:43:16 -04:00
|
|
|
"pexpect",
|
2017-10-24 18:48:48 -04:00
|
|
|
"pyttsx3",
|
2019-01-26 04:46:05 -05:00
|
|
|
"pyte>=0.7.0",
|
2016-10-04 17:07:19 -04:00
|
|
|
],
|
|
|
|
)
|
2017-10-20 15:24:50 -04:00
|
|
|
|
2024-12-20 08:57:27 -05:00
|
|
|
if not forceSettingsFlag:
|
2017-10-21 10:03:03 -04:00
|
|
|
print('')
|
|
|
|
# create settings file from example if not exist
|
2018-03-21 06:10:12 -04:00
|
|
|
if not os.path.isfile('/etc/fenrirscreenreader/settings/settings.conf'):
|
2017-10-21 10:03:03 -04:00
|
|
|
try:
|
2018-03-21 06:56:09 -04:00
|
|
|
copyfile('/etc/fenrirscreenreader/settings/settings.conf.example', '/etc/fenrirscreenreader/settings/settings.conf')
|
|
|
|
print('create settings file in /etc/fenrirscreenreader/settings/settings.conf')
|
2017-10-21 10:03:03 -04:00
|
|
|
except:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
print('settings.conf file found. It is not overwritten automatical')
|
|
|
|
|
2017-07-26 03:35:08 -04:00
|
|
|
print('')
|
2017-08-24 05:46:28 -04:00
|
|
|
print('To have Fenrir start at boot:')
|
2017-07-26 03:35:08 -04:00
|
|
|
print('sudo systemctl enable fenrir')
|
|
|
|
print('Pulseaudio users may want to run:')
|
2018-03-21 06:10:12 -04:00
|
|
|
print('/usr/share/fenrirscreenreader/tools/configure_pulse.sh')
|
2017-08-15 14:23:56 -04:00
|
|
|
print('once as their user account and once as root to configure Pulseaudio.')
|
|
|
|
print('Please install the following packages manually:')
|
|
|
|
print('- Speech-dispatcher: for the default speech driver')
|
|
|
|
print('- Espeak: as basic TTS engine')
|
2017-08-24 05:46:28 -04:00
|
|
|
print('- sox: is a player for the generic sound driver')
|