def declare_namespace(packageName):
_imp.acquire_lock()<EOL>try:<EOL><INDENT>if packageName in _namespace_packages:<EOL><INDENT>return<EOL><DEDENT>path = sys.path<EOL>parent, _, _ = packageName.rpartition('<STR_LIT:.>')<EOL>if parent:<EOL><INDENT>declare_namespace(parent)<EOL>if parent not in _namespace_packages:<EOL><INDENT>__import__(parent)<EOL><DEDENT>try:<EOL><INDENT>path = sys.modules[parent].__path__<EOL><DEDENT>except AttributeError:<EOL><INDENT>raise TypeError("<STR_LIT>", parent)<EOL><DEDENT><DEDENT>_namespace_packages.setdefault(parent or None, []).append(packageName)<EOL>_namespace_packages.setdefault(packageName, [])<EOL>for path_item in path:<EOL><INDENT>_handle_ns(packageName, path_item)<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>_imp.release_lock()<EOL><DEDENT>
Declare that package 'packageName' is a namespace package