Beispiel #1
0
    def check_package(self, package, package_dir):
        """Check namespace packages' __init__ for declare_namespace"""
        try:
            return self.packages_checked[package]
        except KeyError:
            pass

        init_py = _build_py.check_package(self, package, package_dir)
        self.packages_checked[package] = init_py

        if not init_py or not self.distribution.namespace_packages:
            return init_py

        for pkg in self.distribution.namespace_packages:
            if pkg == package or pkg.startswith(package + '.'):
                break
        else:
            return init_py

        f = open(init_py, 'rbU')
        if 'declare_namespace'.encode() not in f.read():
            from distutils import log
            log.warn(
                "WARNING: %s is a namespace package, but its __init__.py does\n"
                "not declare_namespace(); setuptools 0.7 will REQUIRE this!\n"
                '(See the setuptools manual under "Namespace Packages" for '
                "details.)\n", package)
        f.close()
        return init_py
Beispiel #2
0
    def check_package(self, package, package_dir):
        """Check namespace packages' __init__ for declare_namespace"""
        try:
            return self.packages_checked[package]
        except KeyError:
            pass

        init_py = _build_py.check_package(self, package, package_dir)
        self.packages_checked[package] = init_py

        if not init_py or not self.distribution.namespace_packages:
            return init_py

        for pkg in self.distribution.namespace_packages:
            if pkg == package or pkg.startswith(package + "."):
                break
        else:
            return init_py

        f = open(init_py, "rU")
        if "declare_namespace" not in f.read():
            from distutils import log

            log.warn(
                "WARNING: %s is a namespace package, but its __init__.py does\n"
                "not declare_namespace(); setuptools 0.7 will REQUIRE this!\n"
                '(See the setuptools manual under "Namespace Packages" for '
                "details.)\n",
                package,
            )
        f.close()
        return init_py
Beispiel #3
0
    def check_package(self, package, package_dir):
        """Check namespace packages' __init__ for declare_namespace"""
        try:
            return self.packages_checked[package]
        except KeyError:
            pass

        init_py = _build_py.check_package(self, package, package_dir)
        self.packages_checked[package] = init_py

        if not init_py or not self.distribution.namespace_packages:
            return init_py

        for pkg in self.distribution.namespace_packages:
            if pkg==package or pkg.startswith(package+'.'):
                break
        else:
            return init_py

        f = open(init_py,'rbU')
        if 'declare_namespace'.encode() not in f.read():
            from distutils.errors import DistutilsError
            raise DistutilsError(
                "Namespace package problem: %s is a namespace package, but its\n"
                "__init__.py does not call declare_namespace()! Please fix it.\n"
                '(See the setuptools manual under "Namespace Packages" for '
                "details.)\n" % (package,)
            )
        f.close()
        return init_py
Beispiel #4
0
 def check_package(self, package, package_dir):
     return _build_py.check_package(self, package, vpath(package_dir))
Beispiel #5
0
 def check_package(self, package, package_dir):
     return _build_py.check_package(self, package, vpath(package_dir))