# Path: poet/_compat.py
# PY2 = sys.version_info[0] == 2
# PY3K = sys.version_info[0] >= 3
# def decode(string, encodings=None):
# def encode(string, encodings=None):
# 
# Path: poet/utils/helpers.py
# def template(name):
#     """
#     Returns a template given a name.
#     
#     :param name: The name of the template.
#     :type name: str
#     
#     :rtype: jinja2.Template 
#     """
#     if not name.endswith('.jinja2'):
#         name += '.jinja2'
# 
#     return TEMPLATE_ENV.get_template(name)


import os
import re
import warnings
from setuptools.dist import Distribution
from setuptools.extension import Extension
from pip.commands.wheel import WheelCommand
from pip.status_codes import SUCCESS
from semantic_version import Spec, Version
from .._compat import Path, PY2, encode
from ..utils.helpers import template
            package_dirs[package_name] = Path(base_dir)

        if excluded is None:
            excluded = []

        if crawled is None:
            crawled = []

        if not isinstance(includes, list):
            includes = [includes]

        if not isinstance(base_dir, Path):
            base_dir = Path(base_dir)

        base_path = root / base_dir

        for include in includes:
            dirs = []
            others = []

            for element in base_path.glob(include):
                if element.is_dir():
                    dirs.append(element.relative_to(base_path))
                else:
                    others.append(element.relative_to(base_path))

            m = re.match('^([^./]+)/\*\*/\*(\..+)?$', include)
            if m:
                # {dir}/**/* will not take the root directory
                # So we add it

# Path: poet/_compat.py
# PY2 = sys.version_info[0] == 2
# PY3K = sys.version_info[0] >= 3
# def decode(string, encodings=None):
# def encode(string, encodings=None):
# 
# Path: poet/utils/helpers.py
# def template(name):
#     """
#     Returns a template given a name.
#     
#     :param name: The name of the template.
#     :type name: str
#     
#     :rtype: jinja2.Template 
#     """
#     if not name.endswith('.jinja2'):
#         name += '.jinja2'
# 
#     return TEMPLATE_ENV.get_template(name)


# Path: poet/build/builder.py
import os
import re
import warnings
from setuptools.dist import Distribution
from setuptools.extension import Extension
from pip.commands.wheel import WheelCommand
from pip.status_codes import SUCCESS
from semantic_version import Spec, Version
from .._compat import Path, PY2, encode
from ..utils.helpers import template

            package_dirs[package_name] = Path(base_dir)

        if excluded is None:
            excluded = []

        if crawled is None:
            crawled = []

        if not isinstance(includes, list):
            includes = [includes]

        if not isinstance(base_dir, Path):
            base_dir = Path(base_dir)

        base_path = root / base_dir

        for include in includes:
            dirs = []
            others = []

            for element in base_path.glob(include):
                if element.is_dir():
                    dirs.append(element.relative_to(base_path))
                else:
                    others.append(element.relative_to(base_path))

            m = re.match('^([^./]+)/\*\*/\*(\..+)?$', include)
            if m:
                # {dir}/**/* will not take the root directory
                # So we add it

                dirs.insert(0, Path(m.group(1)))