Fixed a bug in setup.py.

This commit is contained in:
Storm Dragon 2024-12-20 11:09:32 -05:00
parent d6a9332f80
commit 90d8e62db0

View File

@ -5,8 +5,9 @@ import glob
from shutil import copyfile from shutil import copyfile
from setuptools import setup from setuptools import setup
def get_data_files(force_settings=False): def get_data_files():
data_files = [] data_files = []
force_settings = os.environ.get('FENRIR_FORCE_SETTINGS') == '1'
# Handle locale files # Handle locale files
locale_files = glob.glob('locale/*/LC_MESSAGES/*.mo') locale_files = glob.glob('locale/*/LC_MESSAGES/*.mo')
@ -45,7 +46,8 @@ def get_data_files(force_settings=False):
return data_files return data_files
def post_install_actions(): def post_install_actions():
if '--force-settings' not in sys.argv: force_settings = os.environ.get('FENRIR_FORCE_SETTINGS') == '1'
if not force_settings:
print('') print('')
# create settings file from example if not exist # create settings file from example if not exist
if not os.path.isfile('/etc/fenrirscreenreader/settings/settings.conf'): if not os.path.isfile('/etc/fenrirscreenreader/settings/settings.conf'):
@ -70,12 +72,8 @@ def post_install_actions():
print('- sox: is a player for the generic sound driver') print('- sox: is a player for the generic sound driver')
if __name__ == "__main__": if __name__ == "__main__":
force_settings = '--force-settings' in sys.argv
if force_settings:
sys.argv.remove('--force-settings')
setup( setup(
data_files=get_data_files(force_settings), data_files=get_data_files(),
) )
post_install_actions() post_install_actions()