"""
setup.py file for building armstrong components.

Nothing in this file should need to be edited, please see accompanying
package.json file if you need to adjust metadata about this package.

"""
import os
import json
from setuptools import setup, find_packages


info = json.load(open("./package.json"))


def generate_namespaces(package):
    i = package.count(".")
    while i:
        yield package.rsplit(".", i)[0]
        i -= 1
NAMESPACE_PACKAGES = list(generate_namespaces(info['name']))

if os.path.exists("MANIFEST"):
    os.unlink("MANIFEST")

setup_kwargs = {
    "author": "Bay Citizen & Texas Tribune",
    "author_email": "dev@armstrongcms.org",
    "url": "http://github.com/armstrong/%s/" % info["name"],
    "packages": find_packages(exclude=["*.tests", "*.tests.*"]),
    "namespace_packages": NAMESPACE_PACKAGES,
    "include_package_data": True,
    "classifiers": [
        'Development Status :: 3 - Alpha',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: Apache Software License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
    ],
}

setup_kwargs.update(info)
setup(**setup_kwargs)

# Nothing in this file should need to be edited.
#   Use package.json to adjust metadata about this package.
#   Use MANIFEST.in to include package-specific data files.
import os
import json
from setuptools import setup, find_packages


info = json.load(open("./package.json"))


def generate_namespaces(package):
    i = package.count(".")
    while i:
        yield package.rsplit(".", i)[0]
        i -= 1
NAMESPACE_PACKAGES = list(generate_namespaces(info['name']))

if os.path.exists("MANIFEST"):
    os.unlink("MANIFEST")

setup_kwargs = {
    "author": "Bay Citizen & Texas Tribune",
    "author_email": "dev@armstrongcms.org",
    "url": "http://github.com/armstrong/%s/" % info["name"],
    "packages": find_packages(),
    "namespace_packages": NAMESPACE_PACKAGES,
    "include_package_data": True,
    "classifiers": [
        'Development Status :: 3 - Alpha',
        'Environment :: Web Environment',
        'Framework :: Django',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: Apache Software License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
    ],
}

setup_kwargs.update(info)
setup(**setup_kwargs)

Use `find_packages()` and since we aren't building `package_data` anymore, we need to use `MANIFEST.in`. That's what it's there for and does a more obvious job. "Explicit is better than implicit." Using MANIFEST requires `include_package_data=True`.