Source

orange-text / setup.py

Full commit
#!/usr/bin/env python
"""\
Text Mining Add-On for Orange

Orange Text Mining is an addon for the Orange data
mining software package.
"""
DOCLINES = __doc__.split("\n")

try:
    from setuptools import setup
    have_setuptools = True
except ImportError:
    from distutils.core import setup
    have_setuptools = False
    
from distutils.core import Extension
import distutils.ccompiler
import os, sys, glob


CLASSIFIERS = """\
Development Status :: 4 - Beta
Programming Language :: Python
License :: OSI Approved :: GNU General Public License (GPL)
Operating System :: POSIX
Operating System :: Microsoft :: Windows
Topic :: Scientific/Engineering :: Information Analysis
Intended Audience :: Education
Intended Audience :: Science/Research
"""

KEYWORDS = """\
data mining 
machine learning,
artificial intelligence
text mining
"""                      

NAME                = "Orange-Text-Mining"
DESCRIPTION         = DOCLINES[0]
LONG_DESCRIPTION    = "\n".join(DOCLINES[2:])
URL                 = "https://bitbucket.org/biolab/orange-addon-text"
DOWNLOAD_URL        = "https://bitbucket.org/biolab/orange-addon-text/downloads"
LICENSE             = "GNU General Public License (GPL)"
CLASSIFIERS         = filter(None, CLASSIFIERS.split("\n"))
AUTHOR              = "Bojana Dalbelo Basic, Sasa Petrovic, Frane Saric, Mladen Kolar, Annie Morin, Jean-Hugues Chauchat"
KEYWORDS            = filter(None, KEYWORDS.split('\n'))

MAYOR = 1
MINOR = 1
MICRO = 0
ISRELEASED = False

VERSION = "{0}.{1}a.{2}".format(MAYOR,MINOR, MICRO)

extra_compile_args=[
        '-fno-strict-aliasing',
        '-Wall',
        '-Wno-sign-compare',
        '-Woverloaded-virtual'
        ]

if sys.platform == "win32":
    # For mingw compiler
    extra_link_args=["-static-libgcc", "-static-libstdc++"] 
else:
    extra_link_args = []
    
# list all documentation files that need to be included
docFiles = []
for (dirp, dirns, n) in os.walk('doc'):
	nr = [n1.replace('\\', '/') for n1 in n]
	dirn = dirp.replace('\\', '/')[4:]
	if len(dirn):
		dirn = dirn + '/'
	docFiles.extend( [dirn + n1r for n1r in nr if '.svn' not in dirp + '/' + n1r] )

modules = [
        Extension(
                '_orngTextWrapper',
                sources=[
                                'source/orngTextWrapper/Wrapper_wrap.cxx',
                                'source/orngTextWrapper/Wrapper.cpp',
                                'source/tmt/common/Common.cpp',
                                'source/tmt/common/Files.cpp',
                                'source/tmt/lemmatization/FSADictionary.cpp',
                                'source/tmt/lemmatization/FSALemmatization.cpp',
                                'source/tmt/lemmatization/Lemmatization.cpp',
                                'source/tmt/lemmatization/PorterStemmer.cpp',
                                'source/tmt/strings/StringUtils.cpp',
                                'source/tmt/strings/UTF8Tokenizer.cpp',
                                'source/lemmagen/RdrLemmatizer.cpp'
                ],
                extra_compile_args=extra_compile_args,
                include_dirs=['.', 'source'],
                define_macros=[('TMTNOZLIB','1'), ('NDEBUG', '1')],
                language='c++',
                extra_link_args=extra_link_args
        )
]

DEST_DIR="Orange/add-ons/Text"

if os.path.exists("VERSION.txt"):
    VERSION = open("VERSION.txt", "rb").read()

if have_setuptools:
    setuptool_args = {"install_requires": ["Orange"],
                      "zip_safe": False,
                     }
else:
    setuptool_args = {}
    
    
PACKAGES = [ 'widgets', 'widgets.prototypes', 'doc', '' ]

PACKAGE_DATA = {'doc': docFiles, 
                'widgets': ['icons/*.png'],
                '': ['addon.xml']
                }

if __name__ == "__main__":
        setup(name = NAME,
              version = VERSION,
              description = DESCRIPTION,
              long_description = LONG_DESCRIPTION,
              author = AUTHOR,
              url = URL,
              download_url = DOWNLOAD_URL,
              license = LICENSE,
              package_dir = {"": "."},
              packages = PACKAGES,
              package_data = PACKAGE_DATA,
              py_modules = [ 'orngText', 'orngTextWrapper', 'textConfiguration'],
              extra_path = ("orange-text", DEST_DIR),
              ext_modules = modules,
              **setuptool_args)