Browse Source

install_python_source

David Rose 21 years ago
parent
commit
83fdab16fc
1 changed files with 23 additions and 1 deletions
  1. 23 1
      dtool/pptempl/Template.gmsvc.pp

+ 23 - 1
dtool/pptempl/Template.gmsvc.pp

@@ -87,6 +87,14 @@
   #define lxx_st_sources $[sort $[lxx_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]]
   #define dep_sources_1  $[sort $[get_sources(metalib_target lib_target noinst_lib_target static_lib_target ss_lib_target bin_target noinst_bin_target test_bin_target test_lib_target)]]
 
+  // If there is an __init__.py in the directory, then all Python
+  // files in the directory just get installed without having to be
+  // named.
+  #if $[and $[INSTALL_PYTHON_SOURCE],$[wildcard $[TOPDIR]/$[DIRPREFIX]__init__.py]]
+    #define py_sources $[wildcard $[TOPDIR]/$[DIRPREFIX]*.py]
+  #endif
+  #define install_py $[py_sources:$[TOPDIR]/$[DIRPREFIX]%=%]
+
   // These are the source files that our dependency cache file will
   // depend on.  If it's an empty list, we won't bother writing rules to
   // freshen the cache file.
@@ -152,6 +160,7 @@
     $[if $[install_data],$[install_data_dir]] \
     $[if $[install_config],$[install_config_dir]] \
     $[if $[install_igatedb],$[install_igatedb_dir]] \
+    $[if $[install_py],$[install_py_dir] $[install_py_package_dir]] \
     ]
 
 // Similarly, we need to ensure that $[ODIR] exists.  Trying to make
@@ -260,7 +269,8 @@ $[TAB] rm -f $[igatemout] $[$[igatemout]_obj]
      $[INSTALL_HEADERS:%=$[install_headers_dir]/%] \
      $[INSTALL_PARSER_INC:%=$[install_parser_inc_dir]/%] \
      $[INSTALL_DATA:%=$[install_data_dir]/%] \
-     $[INSTALL_CONFIG:%=$[install_config_dir]/%]
+     $[INSTALL_CONFIG:%=$[install_config_dir]/%] \
+     $[if $[install_py],$[install_py:%=$[install_py_dir]/%] $[install_py_package_dir]/__init__.py]
 
 #define installed_igate_files \
      $[get_igatedb(metalib_target lib_target ss_lib_target):$[ODIR]/%=$[install_igatedb_dir]/%]
@@ -867,6 +877,18 @@ $[install_config_dir]/$[file] : $[file]
 $[TAB] cp -f $[local] $[dest]
 #end file
 
+#foreach file $[install_py]
+$[install_py_dir]/$[file] : $[file]
+#define local $[file]
+#define dest $[install_py_dir]
+$[TAB] $[INSTALL]
+#end file
+
+#if $[install_py]
+$[install_py_package_dir]/__init__.py :
+$[TAB] touch $[install_py_package_dir]/__init__.py
+#endif
+
 // Finally, all the special targets.  These are commands that just need
 // to be invoked; we don't pretend to know what they are.
 #forscopes special_target