Construct configuration instance of a package. package_name -- name of the package Ex.: 'distutils' parent_name -- name of the parent package Ex.: 'numpy' top_path -- directory of the toplevel package
(self,
package_name=None,
parent_name=None,
top_path=None,
package_path=None,
caller_level=1,
setup_name='setup.py',
**attrs)
| 767 | numpy_include_dirs = [] |
| 768 | |
| 769 | def __init__(self, |
| 770 | package_name=None, |
| 771 | parent_name=None, |
| 772 | top_path=None, |
| 773 | package_path=None, |
| 774 | caller_level=1, |
| 775 | setup_name='setup.py', |
| 776 | **attrs): |
| 777 | """Construct configuration instance of a package. |
| 778 | |
| 779 | package_name -- name of the package |
| 780 | Ex.: 'distutils' |
| 781 | parent_name -- name of the parent package |
| 782 | Ex.: 'numpy' |
| 783 | top_path -- directory of the toplevel package |
| 784 | Ex.: the directory where the numpy package source sits |
| 785 | package_path -- directory of package. Will be computed by magic from the |
| 786 | directory of the caller module if not specified |
| 787 | Ex.: the directory where numpy.distutils is |
| 788 | caller_level -- frame level to caller namespace, internal parameter. |
| 789 | """ |
| 790 | self.name = dot_join(parent_name, package_name) |
| 791 | self.version = None |
| 792 | |
| 793 | caller_frame = get_frame(caller_level) |
| 794 | self.local_path = get_path_from_frame(caller_frame, top_path) |
| 795 | # local_path -- directory of a file (usually setup.py) that |
| 796 | # defines a configuration() function. |
| 797 | # local_path -- directory of a file (usually setup.py) that |
| 798 | # defines a configuration() function. |
| 799 | if top_path is None: |
| 800 | top_path = self.local_path |
| 801 | self.local_path = '' |
| 802 | if package_path is None: |
| 803 | package_path = self.local_path |
| 804 | elif os.path.isdir(njoin(self.local_path, package_path)): |
| 805 | package_path = njoin(self.local_path, package_path) |
| 806 | if not os.path.isdir(package_path or '.'): |
| 807 | raise ValueError("%r is not a directory" % (package_path,)) |
| 808 | self.top_path = top_path |
| 809 | self.package_path = package_path |
| 810 | # this is the relative path in the installed package |
| 811 | self.path_in_package = os.path.join(*self.name.split('.')) |
| 812 | |
| 813 | self.list_keys = self._list_keys[:] |
| 814 | self.dict_keys = self._dict_keys[:] |
| 815 | |
| 816 | for n in self.list_keys: |
| 817 | v = copy.copy(attrs.get(n, [])) |
| 818 | setattr(self, n, as_list(v)) |
| 819 | |
| 820 | for n in self.dict_keys: |
| 821 | v = copy.copy(attrs.get(n, {})) |
| 822 | setattr(self, n, v) |
| 823 | |
| 824 | known_keys = self.list_keys + self.dict_keys |
| 825 | self.extra_keys = self._extra_keys[:] |
| 826 | for n in attrs.keys(): |
nothing calls this directly
no test coverage detected