class_docstr: Enhanced 'build_py' command that includes data files with packages
  
  The data files are specified via a 'package_data' argument to 'setup()'.
  See 'setuptools.dist.Distribution' for more details.
  
  Also, this version of the 'build_py' command allows you to specify both
  'py_modules' and 'packages' in the same setup operation.
class_docstr_tok: ["Enhanced","'build_py","'","command","that","includes","data","files","with","packages","The","data","files","are","specified","via","a","'package_data","'","argument","to","'setup","(",")","'",".","See","'setuptools.dist.Distribution","'","for","more","details",".","Also",",","this","version","of","the","'build_py","'","command","allows","you","to","specify","both","'py_modules","'","and","'packages","'","in","the","same","setup","operation","."]
docstr: Check namespace packages' __init__ for declare_namespace
docstr_tok: ["Check","namespace","packages","'","__init__","for","declare_namespace"]
code: 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 = orig.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
  
      with open(init_py, "rb") as f:
          contents = f.read()
      if b"declare_namespace" not in contents:
          raise distutils.errors.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,)
          )
      return init_py
  
imports: from functools import partial
  from glob import glob
  from distutils.util import convert_path
  import distutils.command.build_py
  import os
  import fnmatch
  import textwrap
  import distutils.errors
  import itertools
  import stat
  from pathlib import Path
  from typing import Dict, Iterable, Iterator, List, Optional, Tuple
  from ..extern.more_itertools import unique_everseen
  from ..warnings import SetuptoolsDeprecationWarning
label_desc: Use image node_id 18 for calling the build_py obj's underlying member method code with example usage: obj.check_package(package, package_dir) and returns: init_py, self, init_py, init_py