From c4c692735df68cca51cc8def106360d99f47d9bb Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 25 Sep 2019 14:25:22 +0200 Subject: [PATCH] Adding postinstall scripts in setup.py --- setup.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/setup.py b/setup.py index 1abc62d..fb6cef0 100644 --- a/setup.py +++ b/setup.py @@ -29,6 +29,7 @@ __bin_dir__ = os.path.join(__base_dir__, 'bin') __lib_dir__ = os.path.join(__base_dir__, 'lib') __module_dir__ = os.path.join(__lib_dir__, 'cr_tf') __init_py__ = os.path.join(__module_dir__, '__init__.py') +__postinst_scriptdir__ = pathlib.Path(__base_dir__) / 'postinstall-scripts' PATHS = { '__base_dir__': __base_dir__, @@ -134,6 +135,19 @@ __scripts__ = [ 'bin/create-terraform' ] +# ----------------------------------- +__data_files__ = [] +__pi_scripts__ = [] +for f in __postinst_scriptdir__.glob('*'): + if f.is_file() and os.access(str(f), os.X_OK): + relpath = os.path.relpath(str(f), __base_dir__) + __pi_scripts__.append(relpath) +if __pi_scripts__: + __data_files__.append(('postinstall-scripts', __pi_scripts__)) + +print("Found data files:\n" + pp(__data_files__) + "\n") + + # ----------------------------------- MO_FILES = 'locale/*/LC_MESSAGES/*.mo' PO_FILES = 'locale/*/LC_MESSAGES/*.po' @@ -162,6 +176,7 @@ setup( package_data = { '': create_mo_files(), }, + data_files= __data_files__, ) -- 2.39.5