fenrir/setup.py
2024-12-20 12:00:23 -05:00

47 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python3
import os
import glob
from setuptools import setup
def get_data_files():
data_files = []
# Handle configuration files
directories = glob.glob('config/*')
for directory in directories:
files = glob.glob(directory+'/*')
dest_dir = ''
if 'config/punctuation' in directory:
dest_dir = 'etc/fenrirscreenreader/punctuation'
elif 'config/keyboard' in directory:
dest_dir = 'etc/fenrirscreenreader/keyboard'
elif 'config/settings' in directory:
dest_dir = 'etc/fenrirscreenreader/settings'
elif 'config/scripts' in directory:
dest_dir = 'usr/share/fenrirscreenreader/scripts'
if dest_dir and files:
data_files.append((dest_dir, files))
# Handle sound files
files = glob.glob('config/sound/default/*')
if files:
data_files.append(('usr/share/sounds/fenrirscreenreader/default', files))
files = glob.glob('config/sound/template/*')
if files:
data_files.append(('usr/share/sounds/fenrirscreenreader/template', files))
# Handle tools directory
files = glob.glob('tools/*')
if files:
data_files.append(('usr/share/fenrirscreenreader/tools', files))
# Add man page
if os.path.exists('docs/fenrir.1'):
data_files.append(('usr/share/man/man1', ['docs/fenrir.1']))
return data_files
if __name__ == "__main__":
setup(data_files=get_data_files())