Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 118 lines (104 sloc) 3.346 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
import os
import shutil
import numpy as np
from os.path import join as pjoin

from distutils.core import setup, Command
from distutils.extension import Extension
from Cython.Distutils import build_ext

extensions = [
    Extension(
        "numpush.posix_io.iothread",
        ["numpush/posix_io/iothread.pyx"],
        include_dirs=[],
    ),
    Extension(
        "numpush.posix_io.splice",
        ["numpush/posix_io/splice.pyx"],
        include_dirs=[],
    ),
    Extension(
        "numpush.posix_io.sendfile",
        ["numpush/posix_io/sendfile.pyx"],
        include_dirs=[],
    ),
    Extension("numpush.moose_store.moose",
        ["numpush/moose_store/moose.pyx"],
        include_dirs=[],
    ),
    Extension(
        "numpush.zmq_blosc",
        ["numpush/zmq_blosc.pyx"],
        include_dirs=['include/blosc'],
        libraries=['zmq', 'pthread'],
        library_dirs=["blosc"],
        extra_objects=["include/blosc/blosc.so"],
        extra_compile_args=['-msse2'],
    ),
]

def find_packages():
    packages = []
    for dir,subdirs,files in os.walk('numpush'):
        package = dir.replace(os.path.sep, '.')
        if '__init__.py' not in files:
            # not a package
            continue
        packages.append(package)
    return packages

# Adapted from the pyzmq setup.py realeased under the BSD.

class CleanCommand(Command):
    """Custom distutils command to clean the .so and .pyc files."""

    user_options = [ ]

    def initialize_options(self):
        self._clean_me = []
        self._clean_trees = []
        for root, dirs, files in list(os.walk('numpush')):
            for f in files:
                if os.path.splitext(f)[-1] in ('.pyc', '.so', '.o', '.pyd'):
                    self._clean_me.append(pjoin(root, f))
            for d in dirs:
                if d == '__pycache__':
                    self._clean_trees.append(pjoin(root, d))

        for d in ('build',):
            if os.path.exists(d):
                self._clean_trees.append(d)

    def finalize_options(self):
        pass

    def run(self):
        for clean_me in self._clean_me:
            try:
                os.unlink(clean_me)
            except Exception:
                pass
        for clean_tree in self._clean_trees:
            try:
                shutil.rmtree(clean_tree)
            except Exception:
                pass

#-----------------------------------------------------------------------------
# Main setup
#-----------------------------------------------------------------------------

long_desc = \
"""
"""

setup(
    name = "numpush",
    version = '0.0.1dev',
    packages = find_packages(),
    ext_modules = extensions,
    package_data = {},
    author = "Stephen Diehl",
    author_email = "stephen.m.diehl@gmail.com",
    url = 'http://github.com/sdiehl/numpush',
    download_url = 'http://github.com/sdiehl/numpush/downloads',
    description = "Distributed data/code push for Numpy derivative structures",
    long_description = long_desc,
    license = "MIT",
    cmdclass = {'build_ext': build_ext, 'clean': CleanCommand},
    classifiers = [
        'Intended Audience :: Developers',
        'Intended Audience :: Science/Research',
        'Operating System :: POSIX',
        'Topic :: System :: Networking',
        'Programming Language :: Python :: 2.7',
    ]
)
Something went wrong with that request. Please try again.