Return list of subpackage configurations. Parameters ---------- subpackage_name : str or None Name of the subpackage to get the configuration. '*' in subpackage_name is handled as a wildcard. subpackage_path : str If None, then the
(self,subpackage_name,
subpackage_path=None,
parent_name=None,
caller_level = 1)
| 964 | return config |
| 965 | |
| 966 | def get_subpackage(self,subpackage_name, |
| 967 | subpackage_path=None, |
| 968 | parent_name=None, |
| 969 | caller_level = 1): |
| 970 | """Return list of subpackage configurations. |
| 971 | |
| 972 | Parameters |
| 973 | ---------- |
| 974 | subpackage_name : str or None |
| 975 | Name of the subpackage to get the configuration. '*' in |
| 976 | subpackage_name is handled as a wildcard. |
| 977 | subpackage_path : str |
| 978 | If None, then the path is assumed to be the local path plus the |
| 979 | subpackage_name. If a setup.py file is not found in the |
| 980 | subpackage_path, then a default configuration is used. |
| 981 | parent_name : str |
| 982 | Parent name. |
| 983 | """ |
| 984 | if subpackage_name is None: |
| 985 | if subpackage_path is None: |
| 986 | raise ValueError( |
| 987 | "either subpackage_name or subpackage_path must be specified") |
| 988 | subpackage_name = os.path.basename(subpackage_path) |
| 989 | |
| 990 | # handle wildcards |
| 991 | l = subpackage_name.split('.') |
| 992 | if subpackage_path is None and '*' in subpackage_name: |
| 993 | return self._wildcard_get_subpackage(subpackage_name, |
| 994 | parent_name, |
| 995 | caller_level = caller_level+1) |
| 996 | assert '*' not in subpackage_name, repr((subpackage_name, subpackage_path, parent_name)) |
| 997 | if subpackage_path is None: |
| 998 | subpackage_path = njoin([self.local_path] + l) |
| 999 | else: |
| 1000 | subpackage_path = njoin([subpackage_path] + l[:-1]) |
| 1001 | subpackage_path = self.paths([subpackage_path])[0] |
| 1002 | setup_py = njoin(subpackage_path, self.setup_name) |
| 1003 | if not self.options['ignore_setup_xxx_py']: |
| 1004 | if not os.path.isfile(setup_py): |
| 1005 | setup_py = njoin(subpackage_path, |
| 1006 | 'setup_%s.py' % (subpackage_name)) |
| 1007 | if not os.path.isfile(setup_py): |
| 1008 | if not self.options['assume_default_configuration']: |
| 1009 | self.warn('Assuming default configuration '\ |
| 1010 | '(%s/{setup_%s,setup}.py was not found)' \ |
| 1011 | % (os.path.dirname(setup_py), subpackage_name)) |
| 1012 | config = Configuration(subpackage_name, parent_name, |
| 1013 | self.top_path, subpackage_path, |
| 1014 | caller_level = caller_level+1) |
| 1015 | else: |
| 1016 | config = self._get_configuration_from_setup_py( |
| 1017 | setup_py, |
| 1018 | subpackage_name, |
| 1019 | subpackage_path, |
| 1020 | parent_name, |
| 1021 | caller_level = caller_level + 1) |
| 1022 | if config: |
| 1023 | return [config] |
no test coverage detected