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

"""To use this setup script to install PyChecker:

        cd pychecker-version 
        python setup.py install

Contributed by:  <NAME>
"""

import sys
import os
import tempfile

from distutils.core import setup
from distutils import sysconfig

def remove_file(file):
    try :
        os.unlink(file)
    except :
        pass

if __name__ == '__main__' :
    DOC_FILES = ('COPYRIGHT', 'README', 'VERSION', 'CHANGELOG', 'KNOWN_BUGS', 
                 'MAINTAINERS', 'TODO',)
    LONG_DESCRIPTION = \
"""PyChecker is a tool for finding bugs in python source code.
It finds problems that are typically caught by a compiler for less
dynamic languages, like C and C++. Because of the dynamic nature of python,
some warnings may be incorrect; however, spurious warnings should be
fairly infrequent."""

    script_suffix = ''
    if sys.platform == 'win32' :
        script_suffix = '.bat'
    LOCAL_SCRIPT = 'pychecker' + script_suffix
    LOCAL_SCRIPT = os.path.join(tempfile.gettempdir(), LOCAL_SCRIPT)
    remove_file(LOCAL_SCRIPT)

    install_dir = sysconfig.get_python_lib() + os.sep + 'pychecker'
    checker_py = install_dir + os.sep + 'checker.py'
    py_exe = sys.executable

    script_str = '#! /bin/sh\n\n%s %s "$@"\n' % (py_exe, checker_py)
    if sys.platform == 'win32' :
        script_str = '%s %s %%*\n' % (py_exe, checker_py)

    try :
        fp = open(LOCAL_SCRIPT, "w")
        fp.write(script_str)
        fp.close()
        if sys.platform != 'mac' :
            os.chmod(LOCAL_SCRIPT, 0755)
    except :
        print "Unable to create utility script."
        raise

    setup(name                  = "PyChecker",
          version               = "0.9.0beta",
          license               = "BSD-like",
          description           = "Python source code checking tool",
          author                = "<NAME>, MetaSlash, Inc.",
          author_email          = "<EMAIL>",
          url                   = "http://pychecker.sourceforge.net/",
          packages              = [ 'pychecker' ],
          data_files            = [ (install_dir, DOC_FILES) ],
          scripts               = [ LOCAL_SCRIPT, ],
          long_description      = LONG_DESCRIPTION
         )

    # cleanup old script file, it should have been installed
    remove_file(LOCAL_SCRIPT)
<commit_msg>re-org, cleanup a bit and group win specific code<commit_after>#!/usr/local/bin/python

"""To use this setup script to install PyChecker:

        cd pychecker-version 
        python setup.py install

Contributed by:  <NAME>
"""

import sys
import os
import tempfile

from distutils.core import setup
from distutils import sysconfig

def remove_file(file):
    try :
        os.unlink(file)
    except :
        pass

if __name__ == '__main__' :
    DOC_FILES = ('COPYRIGHT', 'README', 'VERSION', 'CHANGELOG', 'KNOWN_BUGS', 
                 'MAINTAINERS', 'TODO',)
    LONG_DESCRIPTION = \
"""PyChecker is a tool for finding bugs in python source code.
It finds problems that are typically caught by a compiler for less
dynamic languages, like C and C++. Because of the dynamic nature of python,
some warnings may be incorrect; however, spurious warnings should be
fairly infrequent."""

    install_dir = sysconfig.get_python_lib() + os.sep + 'pychecker'
    checker_py = install_dir + os.sep + 'checker.py'
    py_exe = sys.executable

    script_suffix = ''
    script_str = '#! /bin/sh\n\n%s %s "$@"\n' % (py_exe, checker_py)
    if sys.platform == 'win32' :
        script_str = '%s %s %%*\n' % (py_exe, checker_py)
        script_suffix = '.bat'

    LOCAL_SCRIPT = 'pychecker' + script_suffix
    LOCAL_SCRIPT = os.path.join(tempfile.gettempdir(), LOCAL_SCRIPT)
    remove_file(LOCAL_SCRIPT)

    try :
        fp = open(LOCAL_SCRIPT, "w")
        fp.write(script_str)
        fp.close()
        if sys.platform != 'mac' :
            os.chmod(LOCAL_SCRIPT, 0755)
    except :
        print "Unable to create utility script."
        raise

    setup(name                  = "PyChecker",
          version               = "0.9.0beta",
          license               = "BSD-like",
          description           = "Python source code checking tool",
          author                = "<NAME>, MetaSlash, Inc.",
          author_email          = "<EMAIL>",
          url                   = "http://pychecker.sourceforge.net/",
          packages              = [ 'pychecker' ],
          data_files            = [ (install_dir, DOC_FILES) ],
          scripts               = [ LOCAL_SCRIPT, ],
          long_description      = LONG_DESCRIPTION
         )

    # cleanup old script file, it should have been installed
    remove_file(LOCAL_SCRIPT)

{'fraction_non_alphanumeric': 0.10816542948038176, 'fraction_numerical': 0.0042417815482502655, 'mean_word_length': 2.119047619047619, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1803175', 'n_tokens_mistral': 1493, 'n_tokens_neox': 1401, 'n_words': 391}