def build_pkg_name(pkg):
    """Build package name, including extras if present."""
    if pkg.extras:
        return '{0}[{1}]'.format(
            pkg.project_name, ','.join(sorted(pkg.extras)))
    return pkg.project_name