diff --git a/setup.py b/setup.py index 986eb221..f15c0687 100755 --- a/setup.py +++ b/setup.py @@ -9,17 +9,22 @@ def get_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 - using original code + # Handle configuration files directories = glob.glob('config/*') + print("DEBUG: Found config directories:", directories) for directory in directories: files = glob.glob(directory+'/*') + print(f"DEBUG: Found files in {directory}:", files) dest_dir = '' if 'config/punctuation' in directory: dest_dir = '/etc/fenrirscreenreader/punctuation' @@ -35,20 +40,34 @@ def get_data_files(): elif 'config/scripts' in directory: dest_dir = '/usr/share/fenrirscreenreader/scripts' if dest_dir: + print(f"DEBUG: Adding files to {dest_dir}:", files) data_files.append((dest_dir, files)) # Handle sound files files = glob.glob('config/sound/default/*') - data_files.append(('/usr/share/sounds/fenrirscreenreader/default', files)) + print("DEBUG: Found default sound files:", files) + if files: + data_files.append(('/usr/share/sounds/fenrirscreenreader/default', files)) + files = glob.glob('config/sound/template/*') - data_files.append(('/usr/share/sounds/fenrirscreenreader/template', files)) + print("DEBUG: Found template sound files:", files) + if files: + data_files.append(('/usr/share/sounds/fenrirscreenreader/template', files)) # Handle tools directory files = glob.glob('tools/*') - data_files.append(('/usr/share/fenrirscreenreader/tools', files)) + if files: + data_files.append(('/usr/share/fenrirscreenreader/tools', files)) # Add man page - data_files.append(('/usr/share/man/man1', ['docs/fenrir.1'])) + if os.path.exists('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 @@ -60,13 +79,13 @@ if __name__ == "__main__": force_settings = os.environ.get('FENRIR_FORCE_SETTINGS') == '1' if not force_settings: print('') - # create settings file from example if not exist 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: + except Exception as e: + print("DEBUG: Error copying settings file:", e) pass else: print('settings.conf file found. It is not overwritten automatically')