leafsummer
7/28/2015 - 7:11 AM

python setup egg program

python setup egg program

#!/usr/bin/env python
# -*- coding: utf-8 -*-


from setuptools import setup, find_packages
import os

entrypoints = {}

console_scripts = entrypoints['console_scripts'] = [
    'report_init = bailu.__main__:init',
    'report_run = bailu.__main__:run',
    'report_deploy = bailu.__main__:deploy',
    'report_publish = bailu.__main__:publish'
]

def get_packages(package):
    """
    Return root package and all sub-packages.
    """
    return [dirpath
            for dirpath, dirnames, filenames in os.walk(package)
            if os.path.exists(os.path.join(dirpath, '__init__.py'))]

def get_package_data(package):
    """
    Return all files under the root package, that are not in a
    package themselves.
    """
    walk = [(dirpath.replace(package + os.sep, '', 1), filenames)
            for dirpath, dirnames, filenames in os.walk(package)
            if not os.path.exists(os.path.join(dirpath, '__init__.py'))]

    filepaths = []
    for base, filenames in walk:
        if '.svn' not in base:
            filepaths.extend([os.path.join(base, filename)
                              for filename in filenames])
    return {package: filepaths}

setup(
    name="bailu",
    version="0.1.0",
    packages=get_packages('bailu'),
    package_data=get_package_data('bailu'),
    zip_safe=False,
    install_requires=["celery==3.1.18", "requests==2.7.0", "pyyaml==3.11", "mako==1.0.1"],

    description="bailu report worker packages install egg",
    long_description="bailu report worker packages install egg, used by every type of report worker",
    author="wuqingfeng",

    license="BSD",
    keywords=("bailu", 'report', 'celery', 'egg'),
    platforms="Independant",
    url="",
    entry_points=entrypoints,
    scripts=['bailu/bin/wkhtmltopdf-amd64_old', 'bailu/bin/wkhtmltoimage-amd64_old'],
    data_files=[('bailu/worker/report_clone/', ['bailu/worker/report_clone/config.yaml'])]
)