File: setup.py

package info (click to toggle)
python-ctypeslib 0.0.0%2Bsvn20100125-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 332 kB
  • ctags: 398
  • sloc: python: 2,845; makefile: 38
file content (108 lines) | stat: -rwxr-xr-x 3,322 bytes parent folder | download | duplicates (2)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env python
"""ctypeslib contains these packages:

 - ``ctypeslib.codegen``       - a code generator

 - ``ctypeslib.contrib``       - various contributed modules

 - ``ctypeslib.util``          - assorted small helper functions

 - ``ctypeslib.test``          - unittests

There is not yet an official release, but ctypeslib can be installed
directly from the subversion repository with::

    easy_install ctypeslib==dev

The SVN repository is here:

http://svn.python.org/projects/ctypes/trunk/ctypeslib/#egg=ctypeslib-dev

"""
import os, sys
from distutils.core import setup, Command

class test(Command):
    # Original version of this class posted
    # by Berthold Hoellmann to distutils-sig@python.org
    description = "run tests"

    user_options = [
        ('tests=', 't',
         "comma-separated list of packages that contain test modules"),
        ('use-resources=', 'u',
         "resources to use - resource names are defined by tests"),
        ('refcounts', 'r',
         "repeat tests to search for refcount leaks (requires 'sys.gettotalrefcount')"),
        ]

    boolean_options = ["refcounts"]

    def initialize_options(self):
        self.build_base = 'build'
        self.use_resources = ""
        self.refcounts = False
        self.tests = "ctypeslib.test"

    # initialize_options()

    def finalize_options(self):
        if self.refcounts and not hasattr(sys, "gettotalrefcount"):
            raise DistutilsOptionError("refcount option requires Python debug build")
        self.tests = self.tests.split(",")
        self.use_resources = self.use_resources.split(",")

    # finalize_options()

    def run(self):
        self.run_command('build')

        import ctypeslib.test
        ctypeslib.test.use_resources.extend(self.use_resources)

        for name in self.tests:
            package = __import__(name, globals(), locals(), ['*'])
            print "Testing package", name, (sys.version, sys.platform, os.name)
            ctypeslib.test.run_tests(package,
                                     "test_*.py",
                                     self.verbose,
                                     self.refcounts)

    # run()

# class test

classifiers = [
    'Development Status :: 3 - Alpha',
    'Development Status :: 4 - Beta',
##    'Development Status :: 5 - Production/Stable',
    'Intended Audience :: Developers',
    'License :: OSI Approved :: MIT License',
##    'Operating System :: Microsoft :: Windows',
    'Programming Language :: Python',
    'Topic :: Software Development :: Libraries :: Python Modules',
    ]


setup(name="ctypeslib",
      packages = ['ctypeslib',
                  'ctypeslib.codegen',
                  'ctypeslib.contrib',
                  'ctypeslib.util',
                  'ctypeslib.test'],
      scripts = ['scripts/h2xml.py', 'scripts/xml2py.py'],
      description="ctypeslib - useful additions to the ctypes FFI library",
      long_description = __doc__,
      author="Thomas Heller",
      author_email="theller@ctypes.org",
      license="MIT License",
      version = "0.5.6",

      classifiers = classifiers,

##      url="http://starship.python.net/crew/theller/ctypeswiki.cgi",
##      download_url="http://svn.python.org/projects/ctypes/trunk/ctypeslib",

      cmdclass = {'test': test},

      )