<commit_before>#!/usr/bin/env python

from __future__ import (absolute_import, division, print_function)#, unicode_literals)

__author__ = 'gicmo'

try:
    from setuptools import setup, Extension
except:
    from distutils.core import setup, Extension

# python version dependent import of getstatusoutput
try:
	from commands import getstatusoutput
except:
	from subprocess import getstatusoutput

import numpy as np
import sys
import os
import re
import fnmatch
import distutils
import platform

def find(pattern, path):
    result = []
    for root, dirs, files in os.walk(path):
        for name in files:
            if fnmatch.fnmatch(name, pattern):
                result.append(os.path.join(root, name))
    return result

with open('README.md') as f:
    description_text = f.read()

with open('LICENSE') as f:
    license_text = f.read()

with open('nix/info.py') as f:
    info = f.read()

VERSION         = re.search(r"VERSION\s*=\s*'([^']*)'", info).group(1)
AUTHOR          = re.search(r"AUTHOR\s*=\s*'([^']*)'", info).group(1)
CONTACT         = re.search(r"CONTACT\s*=\s*'([^']*)'", info).group(1)
BRIEF           = re.search(r"BRIEF\s*=\s*'([^']*)'", info).group(1)
HOMEPAGE        = re.search(r"HOMEPAGE\s*=\s*'([^']*)'", info).group(1)

# Replaced StandardError with Exception since StandardError is removed in Py3.x
class PackageNotFoundError(Exception):
    pass

def pkg_config(*packages, **kw):
    flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}

    ignore_error = 'ignore_error' in kw
    if ignore_error:
        del kw['ignore_error']

    pkg_string = ' '.join(packages)
    status, out = getstatusoutput("pkg-config --libs --cflags " + pkg_string)
    if status != 0:
        err_str = 'Some packages were not found: %s [%s]' % (pkg_string, out)
        if ignore_error:
            sys.stderr.write('WARNING: ' + err_str)
            out = ''
        else:
            raise PackageNotFoundError(err_str)

    for token in out.split():
        kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])

    # remove duplicated
    # replaced .iteritems() with .items, since .iteritems() is not available in Py3.x
    # could lead to increased memory usage and computation time.
    for k, v in kw.items():
        del kw[k]
        kw[k] = list(set(v))

    return kw

nix_inc_dir = os.getenv('NIX_INCDIR', '/usr/local/include')
nix_lib_dir = os.getenv('NIX_LIBDIR', '/usr/local/lib')
if os.name != 'nt':
    nix_lnk_arg = ['-lnix']
else:
    nix_lnk_arg = ['/LIBPATH:'+nix_lib_dir, '/DEFAULTLIB:nix.lib']

nixpy_sources = [
    'src/PyUtil.cpp',
    'src/core.cc',
    'src/docstrings.cpp',
    'src/PyExceptions.cpp',
    'src/PyBlock.cpp',
    'src/PyFile.cpp',
    'src/PySection.cpp',
    'src/PyProperty.cpp',
    'src/PyValue.cpp',
    'src/PySource.cpp',
    'src/PyDataArray.cpp',
    'src/PyDataSet.cpp',
    'src/PyDimensions.cpp',
    'src/PyFeature.cpp',
    'src/PyTag.cpp',
    'src/PyMultiTag.cpp',
    'src/PyResult.cpp'
]

boost_inc_dir = os.getenv('BOOST_INCDIR', '/usr/local/include')
boost_lib_dir = os.getenv('BOOST_LIBDIR', '/usr/local/lib')

if os.name != 'nt':
    boost_lnk_arg = ['-lboost_python']

    if sys.version_info[0] == 3:  # python 3
        if platform.system().lower() == 'linux':
            boost_lnk_arg = ['-lboost_python-py34']

        elif platform.system().lower() == 'darwin':
            boost_lnk_arg = ['-lboost_python3']

else:  # windows
    boostlib = find('libboost_python*.lib', boost_lib_dir)
    boost_lnk_arg = ['/LIBPATH:'+boost_lib_dir, '/DEFAULTLIB:'+boostlib[0]]

classifiers   = [
                    'Development Status :: 5 - Production/Stable',
                    'Programming Language :: Python',
                    'Programming Language :: Python :: 2.6',
                    'Programming Language :: Python :: 2.7',
                    'Programming Language :: Python :: 3.4',
                    'Topic :: Scientific/Engineering'
]

native_ext    = Extension(
                    'nix.core',
                    extra_compile_args = ['-std=c++11'] if os.name!='nt' else ['/DBOOST_PYTHON_STATIC_LIB', '/EHsc'],<commit_msg>updateSetup: make linux boost_python link more generic<commit_after>#!/usr/bin/env python

from __future__ import (absolute_import, division, print_function)#, unicode_literals)

__author__ = 'gicmo'

try:
    from setuptools import setup, Extension
except:
    from distutils.core import setup, Extension

# python version dependent import of getstatusoutput
try:
	from commands import getstatusoutput
except:
	from subprocess import getstatusoutput

import numpy as np
import sys
import os
import re
import fnmatch
import distutils
import platform

def find(pattern, path):
    result = []
    for root, dirs, files in os.walk(path):
        for name in files:
            if fnmatch.fnmatch(name, pattern):
                result.append(os.path.join(root, name))
    return result

with open('README.md') as f:
    description_text = f.read()

with open('LICENSE') as f:
    license_text = f.read()

with open('nix/info.py') as f:
    info = f.read()

VERSION         = re.search(r"VERSION\s*=\s*'([^']*)'", info).group(1)
AUTHOR          = re.search(r"AUTHOR\s*=\s*'([^']*)'", info).group(1)
CONTACT         = re.search(r"CONTACT\s*=\s*'([^']*)'", info).group(1)
BRIEF           = re.search(r"BRIEF\s*=\s*'([^']*)'", info).group(1)
HOMEPAGE        = re.search(r"HOMEPAGE\s*=\s*'([^']*)'", info).group(1)

# Replaced StandardError with Exception since StandardError is removed in Py3.x
class PackageNotFoundError(Exception):
    pass

def pkg_config(*packages, **kw):
    flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}

    ignore_error = 'ignore_error' in kw
    if ignore_error:
        del kw['ignore_error']

    pkg_string = ' '.join(packages)
    status, out = getstatusoutput("pkg-config --libs --cflags " + pkg_string)
    if status != 0:
        err_str = 'Some packages were not found: %s [%s]' % (pkg_string, out)
        if ignore_error:
            sys.stderr.write('WARNING: ' + err_str)
            out = ''
        else:
            raise PackageNotFoundError(err_str)

    for token in out.split():
        kw.setdefault(flag_map.get(token[:2]), []).append(token[2:])

    # remove duplicated
    # replaced .iteritems() with .items, since .iteritems() is not available in Py3.x
    # could lead to increased memory usage and computation time.
    for k, v in kw.items():
        del kw[k]
        kw[k] = list(set(v))

    return kw

nix_inc_dir = os.getenv('NIX_INCDIR', '/usr/local/include')
nix_lib_dir = os.getenv('NIX_LIBDIR', '/usr/local/lib')
if os.name != 'nt':
    nix_lnk_arg = ['-lnix']
else:
    nix_lnk_arg = ['/LIBPATH:'+nix_lib_dir, '/DEFAULTLIB:nix.lib']

nixpy_sources = [
    'src/PyUtil.cpp',
    'src/core.cc',
    'src/docstrings.cpp',
    'src/PyExceptions.cpp',
    'src/PyBlock.cpp',
    'src/PyFile.cpp',
    'src/PySection.cpp',
    'src/PyProperty.cpp',
    'src/PyValue.cpp',
    'src/PySource.cpp',
    'src/PyDataArray.cpp',
    'src/PyDataSet.cpp',
    'src/PyDimensions.cpp',
    'src/PyFeature.cpp',
    'src/PyTag.cpp',
    'src/PyMultiTag.cpp',
    'src/PyResult.cpp'
]

boost_inc_dir = os.getenv('BOOST_INCDIR', '/usr/local/include')
boost_lib_dir = os.getenv('BOOST_LIBDIR', '/usr/local/lib')

if os.name != 'nt':
    boost_lnk_arg = ['-lboost_python-py%s%s' % sys.version_info[0:2]]

    if sys.version_info[0] == 3 and platform.system().lower() == 'darwin':  # python 3
        boost_lnk_arg = ['-lboost_python3']

else:  # windows
    boostlib = find('libboost_python*.lib', boost_lib_dir)
    boost_lnk_arg = ['/LIBPATH:'+boost_lib_dir, '/DEFAULTLIB:'+boostlib[0]]

classifiers   = [
                    'Development Status :: 5 - Production/Stable',
                    'Programming Language :: Python',
                    'Programming Language :: Python :: 2.6',
                    'Programming Language :: Python :: 2.7',
                    'Programming Language :: Python :: 3.4',
                    'Topic :: Scientific/Engineering'
]

native_ext    = Extension(
                    'nix.core',
                    extra_compile_args = ['-std=c++11'] if os.name!='nt' else ['/DBOOST_PYTHON_STATIC_LIB', '/EHsc'],
{'fraction_non_alphanumeric': 0.1582385676264215, 'fraction_numerical': 0.0062908299056375514, 'mean_word_length': 2.8504890544946435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1803394', 'n_tokens_mistral': 2910, 'n_tokens_neox': 2810, 'n_words': 615}