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

from __future__ import print_function

try:
    import numpy as np
except ImportError:
    raise RuntimeError(
        "numpy cannot be imported. numpy must be installed "
        "prior to installing root_numpy")

try:
    # try to use setuptools if installed
    from pkg_resources import parse_version, get_distribution
    from setuptools import setup, Extension
    if get_distribution('setuptools').parsed_version < parse_version('0.7'):
        # before merge with distribute
        raise ImportError
except ImportError:
    # fall back on distutils
    from distutils.core import setup, Extension

import os
import sys
import subprocess
from glob import glob

# Prevent setup from trying to create hard links
# which are not allowed on AFS between directories.
# This is a hack to force copying.
try:
    del os.link
except AttributeError:
    pass

local_path = os.path.dirname(os.path.abspath(__file__))
# setup.py can be called from outside the root_numpy directory
os.chdir(local_path)
sys.path.insert(0, local_path)


def root_flags(root_config='root-config'):
    root_cflags = subprocess.Popen(
        [root_config, '--cflags'],
        stdout=subprocess.PIPE).communicate()[0].strip()
    root_ldflags = subprocess.Popen(
        [root_config, '--libs'],
        stdout=subprocess.PIPE).communicate()[0].strip()
    if sys.version > '3':
        root_cflags = root_cflags.decode('utf-8')
        root_ldflags = root_ldflags.decode('utf-8')
    return root_cflags.split(), root_ldflags.split()


def root_has_feature(feature, root_config='root-config'):
    has_feature = subprocess.Popen(
        [root_config, '--has-{0}'.format(feature)],
        stdout=subprocess.PIPE).communicate()[0].strip()
    if sys.version > '3':
        has_feature = has_feature.decode('utf-8')
    return has_feature == 'yes'


rootsys = os.getenv('ROOTSYS', None)
if rootsys is not None:
    try:<commit_msg>can override TMVA subpackage installation with NO_ROOT_NUMPY_TMVA=1<commit_after>#!/usr/bin/env python

from __future__ import print_function

try:
    import numpy as np
except ImportError:
    raise RuntimeError(
        "numpy cannot be imported. numpy must be installed "
        "prior to installing root_numpy")

try:
    # try to use setuptools if installed
    from pkg_resources import parse_version, get_distribution
    from setuptools import setup, Extension
    if get_distribution('setuptools').parsed_version < parse_version('0.7'):
        # before merge with distribute
        raise ImportError
except ImportError:
    # fall back on distutils
    from distutils.core import setup, Extension

import os
import sys
import subprocess
from glob import glob

# Prevent setup from trying to create hard links
# which are not allowed on AFS between directories.
# This is a hack to force copying.
try:
    del os.link
except AttributeError:
    pass

local_path = os.path.dirname(os.path.abspath(__file__))
# setup.py can be called from outside the root_numpy directory
os.chdir(local_path)
sys.path.insert(0, local_path)


def root_flags(root_config='root-config'):
    root_cflags = subprocess.Popen(
        [root_config, '--cflags'],
        stdout=subprocess.PIPE).communicate()[0].strip()
    root_ldflags = subprocess.Popen(
        [root_config, '--libs'],
        stdout=subprocess.PIPE).communicate()[0].strip()
    if sys.version > '3':
        root_cflags = root_cflags.decode('utf-8')
        root_ldflags = root_ldflags.decode('utf-8')
    return root_cflags.split(), root_ldflags.split()


def root_has_feature(feature, root_config='root-config'):
    if os.getenv('NO_ROOT_NUMPY_{0}'.format(feature.upper())):
        # override
        return False
    has_feature = subprocess.Popen(
        [root_config, '--has-{0}'.format(feature)],
        stdout=subprocess.PIPE).communicate()[0].strip()
    if sys.version > '3':
        has_feature = has_feature.decode('utf-8')
    return has_feature == 'yes'


rootsys = os.getenv('ROOTSYS', None)
if rootsys is not None:
    try:
{'fraction_non_alphanumeric': 0.10427477143563134, 'fraction_numerical': 0.006424511984185817, 'mean_word_length': 3.6, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4831781', 'n_tokens_mistral': 1269, 'n_tokens_neox': 1231, 'n_words': 340}