2022-04-09 05:14:48 -04:00
|
|
|
#!/usr/bin/env python3
|
2024-12-20 11:04:13 -05:00
|
|
|
import os
|
|
|
|
import glob
|
2016-10-04 17:07:19 -04:00
|
|
|
from setuptools import setup
|
2017-10-20 15:24:50 -04:00
|
|
|
|
2024-12-20 11:09:32 -05:00
|
|
|
def get_data_files():
|
2024-12-20 11:04:13 -05:00
|
|
|
data_files = []
|
|
|
|
|
2024-12-20 11:43:43 -05:00
|
|
|
# Handle configuration files
|
2024-12-20 11:32:26 -05:00
|
|
|
directories = glob.glob('config/*')
|
|
|
|
for directory in directories:
|
|
|
|
files = glob.glob(directory+'/*')
|
|
|
|
dest_dir = ''
|
|
|
|
if 'config/punctuation' in directory:
|
2024-12-20 12:00:23 -05:00
|
|
|
dest_dir = 'etc/fenrirscreenreader/punctuation'
|
2024-12-20 11:32:26 -05:00
|
|
|
elif 'config/keyboard' in directory:
|
2024-12-20 12:00:23 -05:00
|
|
|
dest_dir = 'etc/fenrirscreenreader/keyboard'
|
2024-12-20 11:32:26 -05:00
|
|
|
elif 'config/settings' in directory:
|
2024-12-20 12:00:23 -05:00
|
|
|
dest_dir = 'etc/fenrirscreenreader/settings'
|
2024-12-20 11:32:26 -05:00
|
|
|
elif 'config/scripts' in directory:
|
2024-12-20 12:00:23 -05:00
|
|
|
dest_dir = 'usr/share/fenrirscreenreader/scripts'
|
|
|
|
if dest_dir and files:
|
2024-12-20 11:32:26 -05:00
|
|
|
data_files.append((dest_dir, files))
|
2024-12-20 11:22:09 -05:00
|
|
|
|
2024-12-20 11:32:26 -05:00
|
|
|
# Handle sound files
|
|
|
|
files = glob.glob('config/sound/default/*')
|
2024-12-20 11:43:43 -05:00
|
|
|
if files:
|
2024-12-20 12:00:23 -05:00
|
|
|
data_files.append(('usr/share/sounds/fenrirscreenreader/default', files))
|
2024-12-20 11:43:43 -05:00
|
|
|
|
2024-12-20 11:32:26 -05:00
|
|
|
files = glob.glob('config/sound/template/*')
|
2024-12-20 11:43:43 -05:00
|
|
|
if files:
|
2024-12-20 12:00:23 -05:00
|
|
|
data_files.append(('usr/share/sounds/fenrirscreenreader/template', files))
|
2024-12-20 08:57:27 -05:00
|
|
|
|
2024-12-20 11:22:09 -05:00
|
|
|
# Handle tools directory
|
2024-12-20 11:32:26 -05:00
|
|
|
files = glob.glob('tools/*')
|
2024-12-20 11:43:43 -05:00
|
|
|
if files:
|
2024-12-20 12:00:23 -05:00
|
|
|
data_files.append(('usr/share/fenrirscreenreader/tools', files))
|
2024-12-20 11:22:09 -05:00
|
|
|
|
|
|
|
# Add man page
|
2024-12-20 11:43:43 -05:00
|
|
|
if os.path.exists('docs/fenrir.1'):
|
2024-12-20 12:00:23 -05:00
|
|
|
data_files.append(('usr/share/man/man1', ['docs/fenrir.1']))
|
2024-12-20 08:57:27 -05:00
|
|
|
|
2024-12-20 11:04:13 -05:00
|
|
|
return data_files
|
|
|
|
|
2024-12-20 11:22:09 -05:00
|
|
|
if __name__ == "__main__":
|
2024-12-20 12:00:23 -05:00
|
|
|
setup(data_files=get_data_files())
|