Changeset 10825:6afd3857cce8 in orange for setup.py


Ignore:
Timestamp:
04/19/12 23:10:32 (2 years ago)
Author:
mitar
Branch:
default
Message:

Updated setup.py, README and current (future) version.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • setup.py

    r10818 r10825  
    44distribute_setup.use_setuptools() 
    55 
    6 """Orange: Machine learning and interactive data mining toolbox. 
    7  
    8 Orange is a scriptable environment for fast prototyping of new 
    9 algorithms and testing schemes. It is a collection of Python packages 
    10 that sit over the core library and implement some functionality for 
    11 which execution time is not crucial and which is easier done in Python 
    12 than in C++. This includes a variety of tasks such as attribute subset, 
    13 bagging and boosting, and alike. 
    14  
    15 Orange also includes a set of graphical widgets that use methods from 
    16 core library and Orange modules. Through visual programming, widgets 
    17 can be assembled together into an application by a visual programming 
    18 tool called Orange Canvas. 
    19 """ 
    20  
    21 DOCLINES = __doc__.splitlines() 
    22  
    23 import os, sys 
    24 try: 
    25     from setuptools import setup 
    26     from setuptools.command.install import install 
    27     have_setuptools = True 
    28 except ImportError: 
    29     from distutils.core import setup 
    30     from distutils.command.install import install 
    31     have_setuptools = False 
    32  
     6import glob, os, sys, types 
     7from distutils import log 
    338from distutils.core import Extension 
    349from distutils.command.build import build 
    3510from distutils.command.build_ext import build_ext 
    3611from distutils.command.install_lib import install_lib 
    37 from distutils.util import convert_path 
     12from distutils.dep_util import newer_group 
    3813from distutils.errors import DistutilsSetupError 
     14from distutils.file_util import copy_file 
    3915from distutils.msvccompiler import MSVCCompiler 
    4016from distutils.unixccompiler import UnixCCompiler 
     17from distutils.util import convert_path 
     18from distutils.sysconfig import get_python_inc, get_config_var 
    4119import subprocess 
    42  
    43 CLASSIFIERS = """\ 
    44 Development Status :: 4 - Beta 
    45 Environment :: X11 Applications :: Qt 
    46 Environment :: Console 
    47 Environment :: Plugins 
    48 Programming Language :: Python 
    49 Framework :: Orange 
    50 License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+) 
    51 Operating System :: POSIX 
    52 Operating System :: Microsoft :: Windows 
    53 Topic :: Scientific/Engineering :: Artificial Intelligence 
    54 Topic :: Scientific/Engineering :: Visualization 
    55 Topic :: Software Development :: Libraries :: Python Modules 
    56 Intended Audience :: Education 
    57 Intended Audience :: Science/Research 
    58 Intended Audience :: Developers 
    59 """ 
    60  
    61 KEYWORDS = """\ 
    62 data mining 
    63 machine learning 
    64 artificial intelligence 
    65 """ 
    66  
    67 NAME                = 'Orange' 
    68 DESCRIPTION         = DOCLINES[0] 
    69 LONG_DESCRIPTION    = "\n".join(DOCLINES[2:]) 
    70 URL                 = "http://orange.biolab.si/" 
    71 DOWNLOAD_URL        = "https://bitbucket.org/biolab/orange/downloads" 
    72 LICENSE             = 'GPLv3' 
    73 CLASSIFIERS         = filter(None, CLASSIFIERS.splitlines()) 
    74 AUTHOR              = "Bioinformatics Laboratory, FRI UL" 
    75 AUTHOR_EMAIL        = "contact@orange.biolab.si" 
    76 KEYWORDS            = filter(None, KEYWORDS.splitlines()) 
    77 MAJOR               = 2 
    78 MINOR               = 5 
    79 MICRO               = 0 
    80 ISRELEASED          = False 
    81 VERSION             = '%d.%d.%da5' % (MAJOR, MINOR, MICRO) 
    82  
    83 if have_setuptools: 
    84     setuptools_args = {"zip_safe": False, 
    85                        "install_requires": ["numpy"], 
    86                        "extras_require": {"GUI": ["PyQt4", "PyQwt"], 
    87                                           "NETWORK": ["networkx"]} 
    88                       } 
    89 else: 
    90     setuptools_args = {} 
    91  
    92 import glob 
    9320from subprocess import check_call 
    9421 
    95 import types 
    96  
    97 from distutils.dep_util import newer_group 
    98 from distutils.file_util import copy_file 
    99 from distutils import log 
    100  
    101 from distutils.sysconfig import get_python_inc, get_config_var 
     22from setuptools import setup, find_packages 
     23from setuptools.command.install import install 
     24 
     25NAME = 'Orange' 
     26 
     27VERSION = '2.6a1' 
     28ISRELEASED = False 
     29 
     30DESCRIPTION = 'Orange, a component-based data mining framework.' 
     31LONG_DESCRIPTION = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() 
     32AUTHOR = 'Bioinformatics Laboratory, FRI UL' 
     33AUTHOR_EMAIL = 'contact@orange.biolab.si' 
     34URL = 'http://orange.biolab.si/' 
     35DOWNLOAD_URL = 'https://bitbucket.org/biolab/orange/downloads' 
     36LICENSE = 'GPLv3' 
     37 
     38KEYWORDS = ( 
     39    'data mining', 
     40    'machine learning', 
     41    'artificial intelligence', 
     42) 
     43 
     44CLASSIFIERS = ( 
     45    'Development Status :: 4 - Beta', 
     46    'Environment :: X11 Applications :: Qt', 
     47    'Environment :: Console', 
     48    'Environment :: Plugins', 
     49    'Programming Language :: Python', 
     50    'Framework :: Orange', 
     51    'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', 
     52    'Operating System :: POSIX', 
     53    'Operating System :: Microsoft :: Windows', 
     54    'Topic :: Scientific/Engineering :: Artificial Intelligence', 
     55    'Topic :: Scientific/Engineering :: Visualization', 
     56    'Topic :: Software Development :: Libraries :: Python Modules', 
     57    'Intended Audience :: Education', 
     58    'Intended Audience :: Science/Research', 
     59    'Intended Audience :: Developers', 
     60) 
    10261 
    10362try: 
     
    11170python_include_dir = get_python_inc(plat_specific=1) 
    11271 
    113 include_dirs = [python_include_dir, numpy_include_dir, "source/include"] 
    114  
    115 if sys.platform == "darwin": 
    116     extra_compile_args = "-fPIC -fpermissive -fno-common -w -DDARWIN".split() 
    117     extra_link_args = "-headerpad_max_install_names -undefined dynamic_lookup".split() 
    118 elif sys.platform == "win32": 
    119     extra_compile_args = ["-EHsc"] 
     72include_dirs = [python_include_dir, numpy_include_dir, 'source/include'] 
     73 
     74if sys.platform == 'darwin': 
     75    extra_compile_args = '-fPIC -fpermissive -fno-common -w -DDARWIN'.split() 
     76    extra_link_args = '-headerpad_max_install_names -undefined dynamic_lookup'.split() 
     77elif sys.platform == 'win32': 
     78    extra_compile_args = ['-EHsc'] 
    12079    extra_link_args = [] 
    121 elif sys.platform.startswith("linux"): 
    122     extra_compile_args = "-fPIC -fpermissive -w -DLINUX".split() 
    123     extra_link_args = ["-Wl,-R$ORIGIN"] 
     80elif sys.platform.startswith('linux'): 
     81    extra_compile_args = '-fPIC -fpermissive -w -DLINUX'.split() 
     82    extra_link_args = ['-Wl,-R$ORIGIN'] 
    12483else: 
    12584    extra_compile_args = [] 
    12685    extra_link_args = [] 
    12786 
    128  
    12987# Get the command for building orangeqt extension from 
    13088# source/orangeqt/setup.py file. 
    131 # Fails  without PyQt4. 
     89# Fails without PyQt4. 
    13290import imp 
    13391try: 
    134     orangeqt_setup = imp.load_source("orangeqt_setup", "source/orangeqt/setup.py") 
     92    orangeqt_setup = imp.load_source('orangeqt_setup', 'source/orangeqt/setup.py') 
    13593    build_pyqt_ext = orangeqt_setup.build_pyqt_ext 
    13694except ImportError: 
     
    462420            return os.path.join(package_dir, filename) 
    463421 
    464  
    465422# Add build_pyqt_ext to build subcommands 
    466423class orange_build(build): 
     
    476433    if orangeqt_setup: 
    477434        sub_commands += [("build_pyqt_ext", has_pyqt_extensions)] 
    478  
    479435 
    480436class orange_install_lib(install_lib): 
     
    501457 
    502458        return install_lib.install(self) 
    503  
    504459 
    505460class orange_install(install): 
     
    519474        self.path_file, self.extra_dirs = None, None 
    520475 
    521  
    522476def get_source_files(path, ext="cpp", exclude=[]): 
    523477    files = glob.glob(os.path.join(path, "*." + ext)) 
     
    525479    return files 
    526480 
    527  
    528481include_ext = LibStatic("orange_include", 
    529482                        get_source_files("source/include/"), 
     
    535488else: 
    536489    libraries = ["stdc++", "orange_include"] 
    537  
    538490 
    539491import ConfigParser 
     
    572524else: 
    573525    orange_sources += get_source_files("source/orange/libsvm/", "cpp") 
    574  
    575526 
    576527orange_ext = PyXtractSharedExtension("Orange.orange", orange_sources, 
     
    603554    orangeom_sources += get_source_files("source/orangeom/qhull/", "c") 
    604555    orangeom_include_dirs += ["source/orangeom"] 
    605  
    606556 
    607557orangeom_ext = PyXtractExtension("Orange.orangeom", orangeom_sources, 
     
    659609    cmdclass["build_pyqt_ext"] = build_pyqt_ext 
    660610 
    661  
    662 def get_packages(): 
    663     import fnmatch 
    664     matches = [] 
    665  
    666     #Recursively find '__init__.py's 
    667     for root, dirnames, filenames in os.walk('Orange'): 
    668         # Add packages for Orange 
    669         for filename in fnmatch.filter(filenames, '__init__.py'): 
    670             matches.append(os.path.join(root, filename)) 
    671     return [os.path.dirname(pkg).replace(os.path.sep, '.') for pkg in matches] 
    672  
    673  
     611def all_with_extension(path, extensions): 
     612    return [os.path.join(path, "*.%s"%extension) for extension in extensions] 
     613 
     614# TODO: Simply replace with include_package_data = True and configure missed files in MANIFEST.in? 
    674615def get_package_data(): 
    675616    package_data = { 
     
    696637    return package_data 
    697638 
    698 def all_with_extension(path, extensions): 
    699     return [os.path.join(path, "*.%s"%extension) for extension in extensions] 
    700  
    701639def hg_revision(): 
    702640    # Copied from numpy setup.py and modified to work with hg 
     
    758696        a.close() 
    759697 
     698PACKAGES = find_packages() 
     699 
     700PACKAGE_DATA = get_package_data() 
     701 
     702SETUP_REQUIRES = ( 
     703) 
     704 
     705INSTALL_REQUIRES = ( 
     706    'numpy', 
     707) 
     708 
     709EXTRAS_REQUIRE = { 
     710    'GUI': ( 
     711        'PyQt4', 
     712        'PyQwt', 
     713    ), 
     714    'NETWORK': ( 
     715        'networkx', 
     716    ), 
     717} 
     718 
     719DEPENDENCY_LINKS = ( 
     720) 
     721 
     722# TODO: Use entry points for automatic script creation 
     723# http://packages.python.org/distribute/setuptools.html#automatic-script-creation 
     724ENTRY_POINTS = { 
     725} 
    760726 
    761727def setup_package(): 
    762728    write_version_py() 
    763     setup(name = NAME, 
    764           description = DESCRIPTION, 
    765           version = VERSION, 
    766           author = AUTHOR, 
    767           author_email = AUTHOR_EMAIL, 
    768           url = URL, 
    769           download_url = DOWNLOAD_URL, 
    770           classifiers = CLASSIFIERS, 
    771           long_description=LONG_DESCRIPTION, 
    772           license = LICENSE, 
    773           keywords = KEYWORDS, 
    774           cmdclass=cmdclass, 
    775           packages = get_packages(), 
    776           package_data = get_package_data(), 
    777           ext_modules = ext_modules, 
    778           scripts = ["bin/orange-canvas"], 
    779           **setuptools_args) 
     729    setup( 
     730        name = NAME, 
     731        version = VERSION, 
     732        description = DESCRIPTION, 
     733        long_description = LONG_DESCRIPTION, 
     734        author = AUTHOR, 
     735        author_email = AUTHOR_EMAIL, 
     736        url = URL, 
     737        download_url = DOWNLOAD_URL, 
     738        license = LICENSE, 
     739        keywords = KEYWORDS, 
     740        classifiers = CLASSIFIERS, 
     741        packages = PACKAGES, 
     742        package_data = PACKAGE_DATA, 
     743        setup_requires = SETUP_REQUIRES, 
     744        extras_require = EXTRAS_REQUIRE, 
     745        install_requires = INSTALL_REQUIRES, 
     746        dependency_links = DEPENDENCY_LINKS, 
     747        entry_points = ENTRY_POINTS, 
     748        include_package_data = True, 
     749        zip_safe = False, 
     750 
     751        # TODO: Should migrate those for distribute (using entry points) 
     752        cmdclass = cmdclass, 
     753        ext_modules = ext_modules, 
     754        scripts = ( 
     755            "bin/orange-canvas", 
     756        ), 
     757    ) 
    780758 
    781759if __name__ == '__main__': 
Note: See TracChangeset for help on using the changeset viewer.