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

import shutil, os, argparse, sys, stat
sys.path.append(os.path.join(os.path.dirname(os.path.dirname(__file__)), "pyUtils"))
from utils import Utils

class genHelper:
    @staticmethod
    def generateCompfileFull(outFileName, externalDirLoc, cc, cxx, outName, installDirName, installDirLoc, neededLibs,ldFlags = ""):
        availableLibs = ["CPPITERTOOLS","CPPPROGUTILS","ZI_LIB","BOOST","R","BAMTOOLS","CPPCMS","MATHGL","ARMADILLO",
                         "MLPACK","LIBLINEAR","PEAR","CURL","GTKMM", "BIBSEQ", "BIBCPP", "SEEKDEEP", 
                         "BIBSEQDEV", "SEEKDEEPDEV", "CATCH", "JSONCPP",
                          "TWOBIT", "SEQSERVER","NJHRINSIDE", "PSTREAMS", "MONGOC", "MONGOCXX", "SHAREDMUTEX", "MAGIC"]
        neededLibraries = {}
        for lib in neededLibs:
            if ":" in lib:
                libSplit = lib.split(":")
                neededLibraries[libSplit[0].upper()] = libSplit[1]
            else:
                neededLibraries[lib.upper()] = ""
        """
            @todo: Make some of these default to an envirnment CC and CXX and maybe even CXXFLAGS as well 
            @todo: Make availableLibs a more universal constant
        """
        with open(outFileName, "w") as f:
            f.write("CC = {CC}\n".format(CC = cc))
            f.write("CXX = {CXX}\n".format(CXX = cxx))
            f.write("CXXOUTNAME = {NAME_OF_PROGRAM}\n".format(NAME_OF_PROGRAM = outName))
            #f.write("CXXFLAGS = -std=c++11\n")
            f.write("CXXFLAGS = -std=c++14\n")
            f.write("CXXFLAGS += -Wall -ftemplate-depth=1024 -Werror=uninitialized -Werror=return-type\n")
            if "" != ldFlags:
                f.write("LD_FLAGS = ")
                if not ldFlags.startswith("-"):
                    f.write("-")
                f.write("{ld_flags}\n".format(ld_flags = " ".join(ldFlags.split(","))))
            f.write("CXXOPT += -O2 -funroll-loops -DNDEBUG  \n")
            f.write("ifneq ($(shell uname -s),Darwin)\n")
            f.write("\tCXXOPT += -march=native -mtune=native\n" )
            f.write("endif\n")
            f.write("\n")
            f.write("#debug\n")
            f.write("CXXDEBUG = -g -gstabs+ \n")
            f.write("INSTALL_DIR={INSTALL_LOCATION}\n".format(INSTALL_LOCATION = os.path.join(installDirLoc,installDirName)))
            f.write("EXT_PATH=$(realpath {EXTERNAL})\n".format(EXTERNAL = externalDirLoc))
            #f.write("SCRIPTS_DIR=$(realpath scripts)\n")
            f.write("\n")
            for lib in availableLibs:
                if lib in neededLibraries:
                    if neededLibraries[lib] == "":
                        f.write("USE_{LIB} = 1\n".format(LIB = lib))
                    else:
                        f.write("USE_{LIB} = 1#{BRANCH}\n".format(LIB = lib, BRANCH = neededLibraries[lib]))
                else:
                    f.write("USE_{LIB} = 0\n".format(LIB = lib))
                    


    @staticmethod            
    def determineCC(args):<commit_msg>Update to setup<commit_after>#!/usr/bin/env python

import shutil, os, argparse, sys, stat
sys.path.append(os.path.join(os.path.dirname(os.path.dirname(__file__)), "pyUtils"))
from utils import Utils

class genHelper:
    @staticmethod
    def generateCompfileFull(outFileName, externalDirLoc, cc, cxx, outName, installDirName, installDirLoc, neededLibs,ldFlags = ""):
        availableLibs = ["CPPITERTOOLS","CPPPROGUTILS","ZI_LIB","BOOST","R","BAMTOOLS","CPPCMS","MATHGL","ARMADILLO",
                         "MLPACK","LIBLINEAR","PEAR","CURL","GTKMM", "BIBSEQ", "BIBCPP", "SEEKDEEP", 
                         "BIBSEQDEV", "SEEKDEEPDEV", "CATCH", "JSONCPP",
                          "TWOBIT", "SEQSERVER","NJHRINSIDE", "PSTREAMS", "MONGOC", "MONGOCXX", "SHAREDMUTEX", "MAGIC"]
        neededLibraries = {}
        for lib in neededLibs:
            if ":" in lib:
                libSplit = lib.split(":")
                neededLibraries[libSplit[0].upper()] = libSplit[1]
            else:
                neededLibraries[lib.upper()] = ""
        """
            @todo: Make some of these default to an envirnment CC and CXX and maybe even CXXFLAGS as well 
            @todo: Make availableLibs a more universal constant
        """
        with open(outFileName, "w") as f:
            f.write("CC = {CC}\n".format(CC = cc))
            f.write("CXX = {CXX}\n".format(CXX = cxx))
            f.write("CXXOUTNAME = {NAME_OF_PROGRAM}\n".format(NAME_OF_PROGRAM = outName))
            f.write("CXXFLAGS = -std=c++14\n")
            f.write("CXXFLAGS += -Wall -ftemplate-depth=1024 -Werror=uninitialized -Werror=return-type -Wno-missing-braces\n")
            if "" != ldFlags:
                f.write("LD_FLAGS = ")
                if not ldFlags.startswith("-"):
                    f.write("-")
                f.write("{ld_flags}\n".format(ld_flags = " ".join(ldFlags.split(","))))
            f.write("CXXOPT += -O2 -funroll-loops -DNDEBUG  \n")
            f.write("ifneq ($(shell uname -s),Darwin)\n")
            f.write("\tCXXOPT += -march=native -mtune=native\n" )
            f.write("endif\n")
            f.write("\n")
            f.write("#debug\n")
            f.write("CXXDEBUG = -g -gstabs+ \n")
            f.write("INSTALL_DIR={INSTALL_LOCATION}\n".format(INSTALL_LOCATION = os.path.join(installDirLoc,installDirName)))
            f.write("EXT_PATH=$(realpath {EXTERNAL})\n".format(EXTERNAL = externalDirLoc))
            f.write("\n")
            for lib in availableLibs:
                if lib in neededLibraries:
                    if neededLibraries[lib] == "":
                        f.write("USE_{LIB} = 1\n".format(LIB = lib))
                    else:
                        f.write("USE_{LIB} = 1#{BRANCH}\n".format(LIB = lib, BRANCH = neededLibraries[lib]))
                else:
                    f.write("USE_{LIB} = 0\n".format(LIB = lib))
                    


    @staticmethod            
    def determineCC(args):
{'fraction_non_alphanumeric': 0.1600665557404326, 'fraction_numerical': 0.004326123128119801, 'mean_word_length': 2.0100150225338007, 'pattern_counts': {'":': 6, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3846075', 'n_tokens_mistral': 1987, 'n_tokens_neox': 1901, 'n_words': 332}