]> Frank Brehm's Git Trees - pixelpark/create-terraform.git/commitdiff
Adding postinstall scripts in setup.py
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 25 Sep 2019 12:25:22 +0000 (14:25 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 25 Sep 2019 12:25:22 +0000 (14:25 +0200)
setup.py

index 1abc62d3f18dfd2df4852c637856493bae631b31..fb6cef061537c4558151865492b463678d10c763 100644 (file)
--- 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__,
 )