<commit_before>#********************************************************************************
#                                                                               *
#                              TnFOX scons library                              *
#                                                                               *
#********************************************************************************
#        Copyright (C) 2003 by <NAME>.   All Rights Reserved.            *
#       NOTE THAT I DO NOT PERMIT ANY OF MY CODE TO BE PROMOTED TO THE GPL      *
#********************************************************************************
# This code is free software; you can redistribute it and/or modify it under    *
# the terms of the GNU Library General Public License v2.1 as published by the  *
# Free Software Foundation EXCEPT that clause 3 does not apply ie; you may not  *
# "upgrade" this code to the GPL without my prior written permission.           *
# Please consult the file "License_Addendum2.txt" accompanying this file.       *
#                                                                               *
# This code is distributed in the hope that it will be useful,                  *
# but WITHOUT ANY WARRANTY; without even the implied warranty of                *
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                          *
#********************************************************************************

import os
import sys
import string
import datetime

def libAsLA(leaf=False):
    ret=str(DLL)
    ret=ret[:string.find(ret, ".so")]+".la"
    if leaf: ret=ret[string.rfind(ret, '/')+1:]
    return ret

def VersionedSharedLibraryName(env, target, version, debug=False):
    ABIversion, interface, sourcev, backwards=version
    if ABIversion: target+="-"+ABIversion
    suffix=""
    if debug: target+="d"
    # Hack for scons misinterpreting '.' in target name
    if sys.platform=="win32":
        suffix+=".dll"
    else:
        suffix+=".so"
        suffix+=".%d.%d.%d" % (interface, sourcev, backwards)
    return target,suffix

def VersionedSharedLibrary(env, target, version, installpath, sources, debug=False, genstaticlib=False, **args):
    """Produces a versioned shared library on POSIX and Windows platforms.
    version is a tuple of (ABI string, interface rev, source rev,
    backwards compatible level (usually same as interface rev) ).
    installpath is used only on GNU and is /usr/lib or /usr/local/lib etc."""
    target=os.path.abspath(target)
    targetorig=target
    ABIversion, interface, sourcev, backwards=version
    target,suffix=VersionedSharedLibraryName(env, target, version, debug)
    libtool=sys.platform!="win32"
    DLL=env.SharedLibrary(target+suffix, sources, SHLIBSUFFIX=suffix, **args)
    basetarget=str(DLL[-1])
    print "basetarget=",basetarget
    stem,ext=os.path.split(targetorig)
    mpos=string.rfind(basetarget, '-')
    lpos=string.rfind(basetarget, os.sep)
    dpos=string.find(basetarget, '.')
    sopos=string.find(basetarget, '.', dpos+1)
    vIpos=string.find(basetarget, '.', sopos+1)
    vSpos=string.find(basetarget, '.', vIpos+1)
    vBpos=string.find(basetarget, '.', vSpos+1)
    LAIname=os.path.join(stem, basetarget[lpos+1:sopos]+".la")
    def genLAIfile(target, source, env):
        print "Generating LAI file at",LAIname
        oh=file(LAIname, "wt")
        try:
            
            oh.write("# "+LAIname+" - a libtool library file\n")
            oh.write("# Generated by scons for libtool ("+datetime.datetime.now().isoformat()+")\n#\n")
            oh.write("# Please DO NOT delete this file!\n# It is necessary for linking the library.\n\n")
            oh.write("# The name that we can dlopen(3).\n")
            oh.write("dlname='"+basetarget[lpos+1:vSpos]+"'\n\n")
            oh.write("# Names of this library.\n")
            oh.write("library_names='"+basetarget[lpos+1:]+" "+basetarget[lpos+1:vSpos]+" "+basetarget[lpos+1:vIpos]+"'\n\n")
            oh.write("# The name of the static archive.\n")
            oh.write("old_library='"+basetarget[lpos+1:sopos]+".a'\n\n")
            oh.write("# Libraries that this one depends upon.\n")
            oh.write("dependency_libs='")
            for lib in env['LIBS']:
                oh.write(" -l"+lib)
            oh.write("'\n\n")
            oh.write("# Version information for libtnfox.\n")<commit_msg>Accidentally broke win32 with last update<commit_after>#********************************************************************************
#                                                                               *
#                              TnFOX scons library                              *
#                                                                               *
#********************************************************************************
#        Copyright (C) 2003 by <NAME>.   All Rights Reserved.            *
#       NOTE THAT I DO NOT PERMIT ANY OF MY CODE TO BE PROMOTED TO THE GPL      *
#********************************************************************************
# This code is free software; you can redistribute it and/or modify it under    *
# the terms of the GNU Library General Public License v2.1 as published by the  *
# Free Software Foundation EXCEPT that clause 3 does not apply ie; you may not  *
# "upgrade" this code to the GPL without my prior written permission.           *
# Please consult the file "License_Addendum2.txt" accompanying this file.       *
#                                                                               *
# This code is distributed in the hope that it will be useful,                  *
# but WITHOUT ANY WARRANTY; without even the implied warranty of                *
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                          *
#********************************************************************************

import os
import sys
import string
import datetime

def libAsLA(leaf=False):
    ret=str(DLL)
    ret=ret[:string.find(ret, ".so")]+".la"
    if leaf: ret=ret[string.rfind(ret, '/')+1:]
    return ret

def VersionedSharedLibraryName(env, target, version, debug=False):
    ABIversion, interface, sourcev, backwards=version
    if ABIversion: target+="-"+ABIversion
    suffix=""
    if debug: target+="d"
    # Hack for scons misinterpreting '.' in target name
    if sys.platform=="win32":
        suffix+=".dll"
    else:
        suffix+=".so"
        suffix+=".%d.%d.%d" % (interface, sourcev, backwards)
    return target,suffix

def VersionedSharedLibrary(env, target, version, installpath, sources, debug=False, genstaticlib=False, **args):
    """Produces a versioned shared library on POSIX and Windows platforms.
    version is a tuple of (ABI string, interface rev, source rev,
    backwards compatible level (usually same as interface rev) ).
    installpath is used only on GNU and is /usr/lib or /usr/local/lib etc."""
    target=os.path.abspath(target)
    targetorig=target
    ABIversion, interface, sourcev, backwards=version
    target,suffix=VersionedSharedLibraryName(env, target, version, debug)
    libtool=sys.platform!="win32"
    DLL=env.SharedLibrary(target+suffix, sources, SHLIBSUFFIX=suffix, **args)
    basetarget=str(DLL[0])
    print "basetarget=",basetarget
    stem,ext=os.path.split(targetorig)
    mpos=string.rfind(basetarget, '-')
    lpos=string.rfind(basetarget, os.sep)
    dpos=string.find(basetarget, '.')
    sopos=string.find(basetarget, '.', dpos+1)
    vIpos=string.find(basetarget, '.', sopos+1)
    vSpos=string.find(basetarget, '.', vIpos+1)
    vBpos=string.find(basetarget, '.', vSpos+1)
    LAIname=os.path.join(stem, basetarget[lpos+1:sopos]+".la")
    def genLAIfile(target, source, env):
        print "Generating LAI file at",LAIname
        oh=file(LAIname, "wt")
        try:
            
            oh.write("# "+LAIname+" - a libtool library file\n")
            oh.write("# Generated by scons for libtool ("+datetime.datetime.now().isoformat()+")\n#\n")
            oh.write("# Please DO NOT delete this file!\n# It is necessary for linking the library.\n\n")
            oh.write("# The name that we can dlopen(3).\n")
            oh.write("dlname='"+basetarget[lpos+1:vSpos]+"'\n\n")
            oh.write("# Names of this library.\n")
            oh.write("library_names='"+basetarget[lpos+1:]+" "+basetarget[lpos+1:vSpos]+" "+basetarget[lpos+1:vIpos]+"'\n\n")
            oh.write("# The name of the static archive.\n")
            oh.write("old_library='"+basetarget[lpos+1:sopos]+".a'\n\n")
            oh.write("# Libraries that this one depends upon.\n")
            oh.write("dependency_libs='")
            for lib in env['LIBS']:
                oh.write(" -l"+lib)
            oh.write("'\n\n")
            oh.write("# Version information for libtnfox.\n")
{'fraction_non_alphanumeric': 0.18788697512101768, 'fraction_numerical': 0.005853878194303727, 'mean_word_length': 2.515631183221211, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1940006', 'n_tokens_mistral': 2526, 'n_tokens_neox': 2431, 'n_words': 676}