<commit_before>#!/usr/bin/env python
import logging
logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger(__name__)

from setuptools import setup
import subprocess
import sys
import os

###########################################
# Dependency or optional-checking functions
###########################################
# (see notes below.)

GR1C_MIN_VERSION = (0,9,0)
def check_gr1c():
    try:
        v_str = subprocess.check_output(["gr1c", "-V"])
    except OSError:
        return False
    try:
        v_str = v_str.split()[1]
        major, minor, micro = v_str.split(".")
        major = int(major)
        minor = int(minor)
        micro = int(micro)
        if not (major > GR1C_MIN_VERSION[0]
                or (major == GR1C_MIN_VERSION[0]
                    and (minor > GR1C_MIN_VERSION[1]
                         or (minor == GR1C_MIN_VERSION[1]
                             and micro >= GR1C_MIN_VERSION[2])))):
            return False
    except:
        return False
    return True

def check_java():
    try:
        subprocess.check_output(['java', '-help'], stderr=subprocess.STDOUT)
    except OSError as e:
        if e.errno == os.errno.ENOENT:
            return False
        else:
            raise
    return True

def check_glpk():
    try:
        import cvxopt.glpk
    except ImportError:
        return False
    return True

def check_mpl():
    try:
        import matplotlib
    except ImportError:
        return False
    return True

def check_pydot():
    try:
        import pydot
        from distutils.version import StrictVersion
        if StrictVersion(pydot.__version__) < StrictVersion('1.0.28'):
            print('Pydot version >= 1.0.28 required.' +
                'found: ' +pydot.__version__)
    except ImportError:
        return False
    return True

# Handle "dry-check" argument to check for dependencies without
# installing the tulip package; checking occurs by default if
# "install" is given, unless both "install" and "nocheck" are given
# (but typical users do not need "nocheck").

java_msg = (
    'java not found.\n'
    "The jtlv synthesis tool included in the tulip distribution\n"
    'will not be able to run. Unless the tool gr1c is installed,\n'
    'it will not be possible to solve games.'
)

# You *must* have these to run TuLiP.  Each item in other_depends must
# be treated specially; thus other_depends is a dictionary with
#
#   keys   : names of dependency;

#   values : list of callable and string, which is printed on failure
#           (i.e. package not found); we interpret the return value
#           True to be success, and False failure.
other_depends = {'java': [check_java, 'Java  found.', java_msg]}

glpk_msg = (
    'GLPK seems to be missing\n'
    'and thus apparently not used by your installation of CVXOPT.\n'
    'If you\'re interested, see http://www.gnu.org/s/glpk/')
gr1c_msg = (
    'gr1c not found or of version prior to '
    ".".join([str(vs) for vs in GR1C_MIN_VERSION]) +
    '.\n'
    'If you\'re interested in a GR(1) synthesis tool besides JTLV,\n'
    'see http://scottman.net/2012/gr1c')
mpl_msg = (
    'matplotlib not found.\n'
    'For many graphics drawing features in TuLiP, you must install\n'
    'matplotlib (http://matplotlib.org/).')
pydot_msg = (
    'pydot not found.\n'
    'Several graph image file creation and dot (http://www.graphviz.org/)\n'
    'export routines will be unavailable unless you install\n'
    'pydot (http://code.google.com/p/pydot/).')

# These are nice to have but not necessary. Each item is of the form
#
#   keys   : name of optional package;
#   values : list of callable and two strings, first string printed on
#           success, second printed on failure (i.e. package not
#           found); we interpret the return value True to be success,
#           and False failure.
optionals = {'glpk' : [check_glpk, 'GLPK found.', glpk_msg],
             'gr1c' : [check_gr1c, 'gr1c found.', gr1c_msg],
             'matplotlib' : [check_mpl, 'matplotlib found.', mpl_msg],
             'pydot' : [check_pydot, 'pydot found.', pydot_msg]}

def retrieve_git_info():
    """Return commit hash of HEAD, or "release", or None if failure.

    If the git command fails, then return None.

    If HEAD has tag with prefix "tulip-" or "vM" where M is an<commit_msg>move java to optional dependencies, because default is `gr1c`<commit_after>#!/usr/bin/env python
import logging
logging.basicConfig(level=logging.WARNING)
logger = logging.getLogger(__name__)

from setuptools import setup
import subprocess
import sys
import os

###########################################
# Dependency or optional-checking functions
###########################################
# (see notes below.)

GR1C_MIN_VERSION = (0,9,0)
def check_gr1c():
    try:
        v_str = subprocess.check_output(["gr1c", "-V"])
    except OSError:
        return False
    try:
        v_str = v_str.split()[1]
        major, minor, micro = v_str.split(".")
        major = int(major)
        minor = int(minor)
        micro = int(micro)
        if not (major > GR1C_MIN_VERSION[0]
                or (major == GR1C_MIN_VERSION[0]
                    and (minor > GR1C_MIN_VERSION[1]
                         or (minor == GR1C_MIN_VERSION[1]
                             and micro >= GR1C_MIN_VERSION[2])))):
            return False
    except:
        return False
    return True

def check_java():
    try:
        subprocess.check_output(['java', '-help'], stderr=subprocess.STDOUT)
    except OSError as e:
        if e.errno == os.errno.ENOENT:
            return False
        else:
            raise
    return True

def check_glpk():
    try:
        import cvxopt.glpk
    except ImportError:
        return False
    return True

def check_mpl():
    try:
        import matplotlib
    except ImportError:
        return False
    return True

def check_pydot():
    try:
        import pydot
        from distutils.version import StrictVersion
        if StrictVersion(pydot.__version__) < StrictVersion('1.0.28'):
            print('Pydot version >= 1.0.28 required.' +
                'found: ' +pydot.__version__)
    except ImportError:
        return False
    return True

# Handle "dry-check" argument to check for dependencies without
# installing the tulip package; checking occurs by default if
# "install" is given, unless both "install" and "nocheck" are given
# (but typical users do not need "nocheck").

# You *must* have these to run TuLiP.  Each item in other_depends must
# be treated specially; thus other_depends is a dictionary with
#
#   keys   : names of dependency;

#   values : list of callable and string, which is printed on failure
#           (i.e. package not found); we interpret the return value
#           True to be success, and False failure.
other_depends = dict()

java_msg = (
    'java not found.\n'
    "The jtlv synthesis tool included in the tulip distribution\n"
    'will not be able to run. Unless `gr1c` or `slugs` is installed,\n'
    'it will not be possible to solve games.')
glpk_msg = (
    'GLPK seems to be missing\n'
    'and thus apparently not used by your installation of CVXOPT.\n'
    'If you\'re interested, see http://www.gnu.org/s/glpk/')
gr1c_msg = (
    'gr1c not found or of version prior to '
    ".".join([str(vs) for vs in GR1C_MIN_VERSION]) +
    '.\n'
    'If you\'re interested in a GR(1) synthesis tool besides JTLV,\n'
    'see http://scottman.net/2012/gr1c')
mpl_msg = (
    'matplotlib not found.\n'
    'For many graphics drawing features in TuLiP, you must install\n'
    'matplotlib (http://matplotlib.org/).')
pydot_msg = (
    'pydot not found.\n'
    'Several graph image file creation and dot (http://www.graphviz.org/)\n'
    'export routines will be unavailable unless you install\n'
    'pydot (http://code.google.com/p/pydot/).')

# These are nice to have but not necessary. Each item is of the form
#
#   keys   : name of optional package;
#   values : list of callable and two strings, first string printed on
#           success, second printed on failure (i.e. package not
#           found); we interpret the return value True to be success,
#           and False failure.
optionals = {'java': [check_java, 'Java found.', java_msg],
             'glpk' : [check_glpk, 'GLPK found.', glpk_msg],
             'gr1c' : [check_gr1c, 'gr1c found.', gr1c_msg],
             'matplotlib' : [check_mpl, 'matplotlib found.', mpl_msg],
             'pydot' : [check_pydot, 'pydot found.', pydot_msg]}

def retrieve_git_info():
    """Return commit hash of HEAD, or "release", or None if failure.

    If the git command fails, then return None.

    If HEAD has tag with prefix "tulip-" or "vM" where M is an
{'fraction_non_alphanumeric': 0.12085145342183566, 'fraction_numerical': 0.00904097047379263, 'mean_word_length': 2.5992586490939042, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '270439', 'n_tokens_mistral': 2730, 'n_tokens_neox': 2649, 'n_words': 916}