maybe was over complicating things.
This commit is contained in:
parent
67b6c79678
commit
099d49d670
76
setup.py
76
setup.py
@ -1,102 +1,46 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import glob
|
import glob
|
||||||
from shutil import copyfile
|
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
def get_data_files():
|
def get_data_files():
|
||||||
data_files = []
|
data_files = []
|
||||||
force_settings = os.environ.get('FENRIR_FORCE_SETTINGS') == '1'
|
|
||||||
|
|
||||||
print("DEBUG: Current working directory:", os.getcwd())
|
|
||||||
|
|
||||||
# Handle locale files
|
|
||||||
locale_files = glob.glob('locale/*/LC_MESSAGES/*.mo')
|
|
||||||
print("DEBUG: Found locale files:", locale_files)
|
|
||||||
for locale_file in locale_files:
|
|
||||||
lang = locale_file.split(os.sep)[1]
|
|
||||||
dest_dir = f'/usr/share/locale/{lang}/LC_MESSAGES'
|
|
||||||
data_files.append((dest_dir, [locale_file]))
|
|
||||||
|
|
||||||
# Handle configuration files
|
# Handle configuration files
|
||||||
directories = glob.glob('config/*')
|
directories = glob.glob('config/*')
|
||||||
print("DEBUG: Found config directories:", directories)
|
|
||||||
for directory in directories:
|
for directory in directories:
|
||||||
files = glob.glob(directory+'/*')
|
files = glob.glob(directory+'/*')
|
||||||
print(f"DEBUG: Found files in {directory}:", files)
|
|
||||||
dest_dir = ''
|
dest_dir = ''
|
||||||
if 'config/punctuation' in directory:
|
if 'config/punctuation' in directory:
|
||||||
dest_dir = '/etc/fenrirscreenreader/punctuation'
|
dest_dir = 'etc/fenrirscreenreader/punctuation'
|
||||||
elif 'config/keyboard' in directory:
|
elif 'config/keyboard' in directory:
|
||||||
dest_dir = '/etc/fenrirscreenreader/keyboard'
|
dest_dir = 'etc/fenrirscreenreader/keyboard'
|
||||||
elif 'config/settings' in directory:
|
elif 'config/settings' in directory:
|
||||||
dest_dir = '/etc/fenrirscreenreader/settings'
|
dest_dir = 'etc/fenrirscreenreader/settings'
|
||||||
if not force_settings:
|
|
||||||
try:
|
|
||||||
files.remove('config/settings/settings.conf')
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
elif 'config/scripts' in directory:
|
elif 'config/scripts' in directory:
|
||||||
dest_dir = '/usr/share/fenrirscreenreader/scripts'
|
dest_dir = 'usr/share/fenrirscreenreader/scripts'
|
||||||
if dest_dir:
|
if dest_dir and files:
|
||||||
print(f"DEBUG: Adding files to {dest_dir}:", files)
|
|
||||||
data_files.append((dest_dir, files))
|
data_files.append((dest_dir, files))
|
||||||
|
|
||||||
# Handle sound files
|
# Handle sound files
|
||||||
files = glob.glob('config/sound/default/*')
|
files = glob.glob('config/sound/default/*')
|
||||||
print("DEBUG: Found default sound files:", files)
|
|
||||||
if files:
|
if files:
|
||||||
data_files.append(('/usr/share/sounds/fenrirscreenreader/default', files))
|
data_files.append(('usr/share/sounds/fenrirscreenreader/default', files))
|
||||||
|
|
||||||
files = glob.glob('config/sound/template/*')
|
files = glob.glob('config/sound/template/*')
|
||||||
print("DEBUG: Found template sound files:", files)
|
|
||||||
if files:
|
if files:
|
||||||
data_files.append(('/usr/share/sounds/fenrirscreenreader/template', files))
|
data_files.append(('usr/share/sounds/fenrirscreenreader/template', files))
|
||||||
|
|
||||||
# Handle tools directory
|
# Handle tools directory
|
||||||
files = glob.glob('tools/*')
|
files = glob.glob('tools/*')
|
||||||
if files:
|
if files:
|
||||||
data_files.append(('/usr/share/fenrirscreenreader/tools', files))
|
data_files.append(('usr/share/fenrirscreenreader/tools', files))
|
||||||
|
|
||||||
# Add man page
|
# Add man page
|
||||||
if os.path.exists('docs/fenrir.1'):
|
if os.path.exists('docs/fenrir.1'):
|
||||||
data_files.append(('/usr/share/man/man1', ['docs/fenrir.1']))
|
data_files.append(('usr/share/man/man1', ['docs/fenrir.1']))
|
||||||
|
|
||||||
print("\nDEBUG: Final data_files list:")
|
|
||||||
for dest, files in data_files:
|
|
||||||
print(f" {dest}:")
|
|
||||||
for f in files:
|
|
||||||
print(f" - {f}")
|
|
||||||
|
|
||||||
return data_files
|
return data_files
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
setup(
|
setup(data_files=get_data_files())
|
||||||
data_files=get_data_files(),
|
|
||||||
)
|
|
||||||
|
|
||||||
force_settings = os.environ.get('FENRIR_FORCE_SETTINGS') == '1'
|
|
||||||
if not force_settings:
|
|
||||||
print('')
|
|
||||||
if not os.path.isfile('/etc/fenrirscreenreader/settings/settings.conf'):
|
|
||||||
try:
|
|
||||||
copyfile('/etc/fenrirscreenreader/settings/settings.conf.example',
|
|
||||||
'/etc/fenrirscreenreader/settings/settings.conf')
|
|
||||||
print('create settings file in /etc/fenrirscreenreader/settings/settings.conf')
|
|
||||||
except Exception as e:
|
|
||||||
print("DEBUG: Error copying settings file:", e)
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
print('settings.conf file found. It is not overwritten automatically')
|
|
||||||
|
|
||||||
print('')
|
|
||||||
print('To have Fenrir start at boot:')
|
|
||||||
print('sudo systemctl enable fenrir')
|
|
||||||
print('Pulseaudio users may want to run:')
|
|
||||||
print('/usr/share/fenrirscreenreader/tools/configure_pulse.sh')
|
|
||||||
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')
|
|
||||||
print('- sox: is a player for the generic sound driver')
|
|
||||||
|
Loading…
Reference in New Issue
Block a user