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

# from distutils.core import setup
#from distutils.extension import Extension
import os, sys

from setuptools import setup, Extension

# This list will contain the messages to print just before the end of the setup
# so that the user actually note them, instead of loosing them in the tons of
# messages of the build process

final_messages = []

# Decide whether to build or not the C++ part
# I really wanted to do this in a cleaner way, but couldn't find a solution other than subclassing Command and hence
# recoding the whole build process!

copy_args = sys.argv[1:]

if '--with-boost' in copy_args:

    final_messages.append("Built the boost.python extension. You can now use C/C++ plugins.")

    build_boost = True

    copy_args.remove('--with-boost')

    # Probe whether the user has specified its own boost directory through the BOOSTROOT
    # environment variable

    boost_root = os.environ.get("BOOSTROOT")

    if boost_root:

        # The user want to override pre-defined location of boost

        print("\n\n **** Using boost.python from the env. variable $BOOSTROOT (%s)" % (boost_root))

        include_dirs = [os.path.join(boost_root, 'include')]
        library_dirs = [os.path.join(boost_root, 'lib')]

        final_messages.append("Used boost.python from the env. variable BOOSTROOT")
        final_messages.append("     Include dir: %s" % include_dirs)
        final_messages.append("     Library dir: %s" % library_dirs)

    else:

        include_dirs = []
        library_dirs = []

        final_messages.append("Using boost.python from the system path.")

    # Configure the variables to build the external module with the C/C++ wrapper

    ext_modules_configuration = [

        Extension("threeML.pyModelInterface",

                  ["threeML/models/pyToCppModelInterface.cxx",
                   "threeML/models/FixedPointSource.cxx",
                   "threeML/models/ModelInterface_boost.cxx"],

                  libraries=["boost_python"],

                  include_dirs=include_dirs,

                  library_dirs=library_dirs)]

    headers_configuration = ["threeML/models/ModelInterface.h",
                             "threeML/models/pyToCppModelInterface.h",
                             "threeML/models/FakePlugin.h",
                             "threeML/models/FixedPointSource.h"]


else:

    # No need to build the C/C++ wrappers, set up the ext_modules_configuration
    # and the headers configuration accordingly

    final_messages.append("- boost.python extension not built. If you didn't built it previously, you will not be able "
                          "to use C/C++ plugins.")

    build_boost = False

    ext_modules_configuration = None
    headers_configuration = None


setup(

    script_args = copy_args,

    name="threeML",

    packages=['threeML',
              'threeML/exceptions',
              'threeML/bayesian',
              'threeML/minimizer',
              'threeML/models',
              'threeML/models/fluxModels',
              'threeML/models/spatialModels',
              'threeML/plugins',
              'threeML/classicMLE',
              'threeML/catalogs',
              'threeML/io',
              'threeML/utils',
              'threeML/parallel',
              'threeML/config'],

    version='v0.2.0',

    description="The Multi-Mission Maximum Likelihood framework",
<commit_msg>Improved the messages<commit_after>#!/usr/bin/env python

# from distutils.core import setup
#from distutils.extension import Extension
import os, sys

from setuptools import setup, Extension

# This list will contain the messages to print just before the end of the setup
# so that the user actually note them, instead of loosing them in the tons of
# messages of the build process

final_messages = []

# Decide whether to build or not the C++ part
# I really wanted to do this in a cleaner way, but couldn't find a solution other than subclassing Command and hence
# recoding the whole build process!

copy_args = sys.argv[1:]

if '--with-boost' in copy_args:

    final_messages.append("Built the boost.python extension.")

    copy_args.remove('--with-boost')

    # Probe whether the user has specified its own boost directory through the BOOSTROOT
    # environment variable

    boost_root = os.environ.get("BOOSTROOT")

    if boost_root:

        # Check that the directory provided actually exists

        if not os.path.exists(boost_root):

            print("\nERROR: the directory %s specified in BOOSTROOT does not exist!" % boost_root)
            sys.exit(-1)

        # The user want to override pre-defined location of boost

        print("\n\n **** Using boost.python from the env. variable $BOOSTROOT (%s)" % (boost_root))

        include_dirs = [os.path.join(boost_root, 'include')]
        library_dirs = [os.path.join(boost_root, 'lib')]

        # Check that the include and library directories exist

        if not os.path.exists(include_dirs[0]):

            print("\nERROR: the include directory %s for boost.python does not exist!" % include_dirs[0])

            sys.exit(-1)


        if not os.path.exists(library_dirs[0]):

            print("\nERROR: the library directory %s for boost.python does not exist!" % library_dirs[0])

            sys.exit(-1)

        final_messages.append("Used boost.python from the env. variable BOOSTROOT")
        final_messages.append("     Include dir: %s" % include_dirs)
        final_messages.append("     Library dir: %s" % library_dirs)

    else:

        include_dirs = []
        library_dirs = []

        final_messages.append("Using boost.python from the system path.")

    # Configure the variables to build the external module with the C/C++ wrapper

    ext_modules_configuration = [

        Extension("threeML.pyModelInterface",

                  ["threeML/models/pyToCppModelInterface.cxx",
                   "threeML/models/FixedPointSource.cxx",
                   "threeML/models/ModelInterface_boost.cxx"],

                  libraries=["boost_python"],

                  include_dirs=include_dirs,

                  library_dirs=library_dirs)]

    headers_configuration = ["threeML/models/ModelInterface.h",
                             "threeML/models/pyToCppModelInterface.h",
                             "threeML/models/FakePlugin.h",
                             "threeML/models/FixedPointSource.h"]


else:

    # No need to build the C/C++ wrappers, set up the ext_modules_configuration
    # and the headers configuration accordingly

    ext_modules_configuration = None
    headers_configuration = None


setup(

    script_args = copy_args,

    name="threeML",

    packages=['threeML',
              'threeML/exceptions',
              'threeML/bayesian',
              'threeML/minimizer',
              'threeML/models',
              'threeML/models/fluxModels',
              'threeML/models/spatialModels',
              'threeML/plugins',
              'threeML/classicMLE',
              'threeML/catalogs',
              'threeML/io',
              'threeML/utils',
              'threeML/parallel',
              'threeML/config'],

    version='v0.2.0',

    description="The Multi-Mission Maximum Likelihood framework",

{'fraction_non_alphanumeric': 0.09395604395604396, 'fraction_numerical': 0.0020604395604395605, 'mean_word_length': 2.3583948339483394, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6751985', 'n_tokens_mistral': 2048, 'n_tokens_neox': 1962, 'n_words': 572}