<s> from __future__ import print_function <EOL> import os <EOL> import re <EOL> import sys <EOL> from operator import lt , gt , eq , le , ge <EOL> from os . path import ( <EOL> abspath , <EOL> dirname , <EOL> join , <EOL> ) <EOL> from distutils . version import StrictVersion <EOL> from setuptools import ( <EOL> Extension , <EOL> find_packages , <EOL> setup , <EOL> ) <EOL> import versioneer <EOL> class LazyBuildExtCommandClass ( dict ) : <EOL> """<STR_LIT>""" <EOL> def __contains__ ( self , key ) : <EOL> return ( <EOL> key == '<STR_LIT>' <EOL> or super ( LazyBuildExtCommandClass , self ) . __contains__ ( key ) <EOL> ) <EOL> def __setitem__ ( self , key , value ) : <EOL> if key == '<STR_LIT>' : <EOL> raise AssertionError ( "<STR_LIT>" ) <EOL> super ( LazyBuildExtCommandClass , self ) . __setitem__ ( key , value ) <EOL> def __getitem__ ( self , key ) : <EOL> if key != '<STR_LIT>' : <EOL> return super ( LazyBuildExtCommandClass , self ) . __getitem__ ( key ) <EOL> from Cython . Distutils import build_ext as cython_build_ext <EOL> import numpy <EOL> class build_ext ( cython_build_ext , object ) : <EOL> """<STR_LIT>""" <EOL> def build_extensions ( self ) : <EOL> """<STR_LIT>""" <EOL> numpy_incl = numpy . get_include ( ) <EOL> for ext in self . extensions : <EOL> ext . include_dirs . append ( numpy_incl ) <EOL> super ( build_ext , self ) . build_extensions ( ) <EOL> return build_ext <EOL> ext_modules = [ <EOL> Extension ( '<STR_LIT>' , [ '<STR_LIT>' ] ) , <EOL> Extension ( '<STR_LIT>' , [ '<STR_LIT>' ] ) , <EOL> Extension ( <EOL> '<STR_LIT>' , [ '<STR_LIT>' ] <EOL> ) , <EOL> Extension ( '<STR_LIT>' , [ '<STR_LIT>' ] ) , <EOL> Extension ( '<STR_LIT>' , [ '<STR_LIT>' ] ) , <EOL> Extension ( '<STR_LIT>' , [ '<STR_LIT>' ] ) , <EOL> Extension ( '<STR_LIT>' , [ '<STR_LIT>' ] ) , <EOL> Extension ( '<STR_LIT>' , [ '<STR_LIT>' ] ) , <EOL> Extension ( '<STR_LIT>' , [ '<STR_LIT>' ] ) , <EOL> Extension ( '<STR_LIT>' , [ '<STR_LIT>' ] ) , <EOL> Extension ( <EOL> '<STR_LIT>' , <EOL> [ '<STR_LIT>' ] <EOL> ) <EOL> ] <EOL> STR_TO_CMP = { <EOL> '<STR_LIT:<>' : lt , <EOL> '<STR_LIT>' : le , <EOL> '<STR_LIT:=>' : eq , <EOL> '<STR_LIT>' : eq , <EOL> '<STR_LIT:>>' : gt , <EOL> '<STR_LIT>' : ge , <EOL> } <EOL> SYS_VERSION = '<STR_LIT:.>' . join ( list ( map ( str , sys . version_info [ : <NUM_LIT:3> ] ) ) ) <EOL> def _filter_requirements ( lines_iter , filter_names = None , <EOL> filter_sys_version = False ) : <EOL> for line in lines_iter : <EOL> line = line . strip ( ) <EOL> if not line or line . startswith ( '<STR_LIT:#>' ) : <EOL> continue <EOL> match = REQ_PATTERN . match ( line ) <EOL> if match is None : <EOL> raise AssertionError ( <EOL> "<STR_LIT>" % line ) <EOL> name = match . group ( '<STR_LIT:name>' ) <EOL> if filter_names is not None and name not in filter_names : <EOL> continue <EOL> if filter_sys_version and match . group ( '<STR_LIT>' ) : <EOL> pycomp , pyspec = match . group ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> comp = STR_TO_CMP [ pycomp ] <EOL> pyver_spec = StrictVersion ( pyspec ) <EOL> if comp ( SYS_VERSION , pyver_spec ) : <EOL> yield line . split ( '<STR_LIT:;>' ) [ <NUM_LIT:0> ] <EOL> continue <EOL> yield line <EOL> REQ_UPPER_BOUNDS = { <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> def _with_bounds ( req ) : <EOL> try : <EOL> req , lower = req . split ( '<STR_LIT>' ) <EOL> except ValueError : <EOL> return req <EOL> else : <EOL> with_bounds = [ req , '<STR_LIT>' , lower ] <EOL> upper = REQ_UPPER_BOUNDS . get ( req ) <EOL> if upper : <EOL> with_bounds . extend ( [ '<STR_LIT:U+002C>' , upper ] ) <EOL> return '<STR_LIT>' . join ( with_bounds ) <EOL> REQ_PATTERN = re . compile ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def _conda_format ( req ) : <EOL> def _sub ( m ) : <EOL> name = m . group ( '<STR_LIT:name>' ) . lower ( ) <EOL> if name == '<STR_LIT>' : <EOL> return '<STR_LIT>' <EOL> formatted = '<STR_LIT>' % ( ( name , ) + m . group ( '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> pycomp , pyspec = m . group ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if pyspec : <EOL> selector = '<STR_LIT>' % ( <EOL> pycomp , '<STR_LIT>' . join ( pyspec . split ( '<STR_LIT:.>' ) [ : <NUM_LIT:2> ] ) . ljust ( <NUM_LIT:2> , '<STR_LIT:0>' ) <EOL> ) <EOL> return formatted + selector <EOL> return formatted <EOL> return REQ_PATTERN . sub ( _sub , req , <NUM_LIT:1> ) <EOL> def read_requirements ( path , <EOL> strict_bounds , <EOL> conda_format = False , <EOL> filter_names = None ) : <EOL> """<STR_LIT>""" <EOL> real_path = join ( dirname ( abspath ( __file__ ) ) , path ) <EOL> with open ( real_path ) as f : <EOL> reqs = _filter_requirements ( f . readlines ( ) , filter_names = filter_names , <EOL> filter_sys_version = not conda_format ) <EOL> if not strict_bounds : <EOL> reqs = map ( _with_bounds , reqs ) <EOL> if conda_format : <EOL> reqs = map ( _conda_format , reqs ) <EOL> return list ( reqs ) <EOL> def install_requires ( strict_bounds = False , conda_format = False ) : <EOL> return read_requirements ( '<STR_LIT>' , <EOL> strict_bounds = strict_bounds , <EOL> conda_format = conda_format ) <EOL> def extras_requires ( conda_format = False ) : <EOL> extras = { <EOL> extra : read_requirements ( '<STR_LIT>' . format ( extra ) , <EOL> strict_bounds = True , <EOL> conda_format = conda_format ) <EOL> for extra in ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> } <EOL> extras [ '<STR_LIT:all>' ] = [ req for reqs in extras . values ( ) for req in reqs ] <EOL> return extras <EOL> def setup_requirements ( requirements_path , module_names , strict_bounds , <EOL> conda_format = False ) : <EOL> module_names = set ( module_names ) <EOL> module_lines = read_requirements ( requirements_path , <EOL> strict_bounds = strict_bounds , <EOL> conda_format = conda_format , <EOL> filter_names = module_names ) <EOL> if len ( set ( module_lines ) ) != len ( module_names ) : <EOL> raise AssertionError ( <EOL> "<STR_LIT>" <EOL> % ( module_names , module_lines ) <EOL> ) <EOL> return module_lines <EOL> conda_build = os . path . basename ( sys . argv [ <NUM_LIT:0> ] ) in ( '<STR_LIT>' , <EOL> '<STR_LIT>' ) <EOL> setup_requires = setup_requirements ( <EOL> '<STR_LIT>' , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> strict_bounds = conda_build , <EOL> conda_format = conda_build , <EOL> ) <EOL> conditional_arguments = { <EOL> '<STR_LIT>' if not conda_build else '<STR_LIT>' : setup_requires , <EOL> } <EOL> setup ( <EOL> name = '<STR_LIT>' , <EOL> url = "<STR_LIT>" , <EOL> version = versioneer . get_version ( ) , <EOL> cmdclass = LazyBuildExtCommandClass ( versioneer . get_cmdclass ( ) ) , <EOL> description = '<STR_LIT>' , <EOL> author = '<STR_LIT>' , <EOL> author_email = '<STR_LIT>' , <EOL> packages = find_packages ( '<STR_LIT:.>' , include = [ '<STR_LIT>' , '<STR_LIT>' ] ) , <EOL> ext_modules = ext_modules , <EOL> scripts = [ '<STR_LIT>' ] , <EOL> include_package_data = True , <EOL> license = '<STR_LIT>' , <EOL> classifiers = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] , <EOL> install_requires = install_requires ( conda_format = conda_build ) , <EOL> extras_require = extras_requires ( conda_format = conda_build ) , <EOL> ** conditional_arguments <EOL> ) </s>
