File: setup.py

package info (click to toggle)
pychecker 0.8.10-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,276 kB
  • ctags: 1,331
  • sloc: python: 6,214; sh: 92; makefile: 37
file content (73 lines) | stat: -rw-r--r-- 2,325 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/local/bin/python

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

        cd pychecker-version 
        python setup.py install

Contributed by:  Nicolas Chauvat
"""

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.8.10",
          license               = "BSD-like",
          description           = "Python source code checking tool",
          author                = "Neal Norwitz, MetaSlash, Inc.",
          author_email          = "pychecker@metaslash.com",
          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)