Add a sub-package to the current Configuration instance. This is useful in a setup.py script for adding sub-packages to a package. Parameters ---------- subpackage_name : str name of the subpackage subpackage_path : str if giv
(self,subpackage_name,
subpackage_path=None,
standalone = False)
| 1025 | return [] |
| 1026 | |
| 1027 | def add_subpackage(self,subpackage_name, |
| 1028 | subpackage_path=None, |
| 1029 | standalone = False): |
| 1030 | """Add a sub-package to the current Configuration instance. |
| 1031 | |
| 1032 | This is useful in a setup.py script for adding sub-packages to a |
| 1033 | package. |
| 1034 | |
| 1035 | Parameters |
| 1036 | ---------- |
| 1037 | subpackage_name : str |
| 1038 | name of the subpackage |
| 1039 | subpackage_path : str |
| 1040 | if given, the subpackage path such as the subpackage is in |
| 1041 | subpackage_path / subpackage_name. If None,the subpackage is |
| 1042 | assumed to be located in the local path / subpackage_name. |
| 1043 | standalone : bool |
| 1044 | """ |
| 1045 | |
| 1046 | if standalone: |
| 1047 | parent_name = None |
| 1048 | else: |
| 1049 | parent_name = self.name |
| 1050 | config_list = self.get_subpackage(subpackage_name, subpackage_path, |
| 1051 | parent_name = parent_name, |
| 1052 | caller_level = 2) |
| 1053 | if not config_list: |
| 1054 | self.warn('No configuration returned, assuming unavailable.') |
| 1055 | for config in config_list: |
| 1056 | d = config |
| 1057 | if isinstance(config, Configuration): |
| 1058 | d = config.todict() |
| 1059 | assert isinstance(d, dict), repr(type(d)) |
| 1060 | |
| 1061 | self.info('Appending %s configuration to %s' \ |
| 1062 | % (d.get('name'), self.name)) |
| 1063 | self.dict_append(**d) |
| 1064 | |
| 1065 | dist = self.get_distribution() |
| 1066 | if dist is not None: |
| 1067 | self.warn('distutils distribution has been initialized,'\ |
| 1068 | ' it may be too late to add a subpackage '+ subpackage_name) |
| 1069 | |
| 1070 | def add_data_dir(self, data_path): |
| 1071 | """Recursively add files under data_path to data_files list. |
no test coverage detected