| 757 | ###################### |
| 758 | |
| 759 | class Configuration: |
| 760 | |
| 761 | _list_keys = ['packages', 'ext_modules', 'data_files', 'include_dirs', |
| 762 | 'libraries', 'headers', 'scripts', 'py_modules', |
| 763 | 'installed_libraries', 'define_macros'] |
| 764 | _dict_keys = ['package_dir', 'installed_pkg_config'] |
| 765 | _extra_keys = ['name', 'version'] |
| 766 | |
| 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: |
no outgoing calls
no test coverage detected