summaryrefslogtreecommitdiffstats
path: root/debian/pyrex/pyrex-0.9.9/setup.py
blob: a6ea6945134a3e481b4dea41bf6668c221f6560c (plain)
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
#
#   Pyrex setup file
#

import distutils
from distutils.core import setup
from distutils.sysconfig import get_python_lib
import os, sys
execfile(distutils.util.convert_path('Pyrex/Compiler/Version.py'))

compiler_dir = os.path.join(get_python_lib(prefix=''), 'Pyrex', 'Compiler')

# Workaround for problem with distutils wininst
if sys.platform == "win32" and 'bdist_wininst' in sys.argv:
 compiler_dir = compiler_dir[len(sys.prefix)+1:]


def packages():
    result = []
    def find_packages(dir, parent_names):
        for name in os.listdir(dir):
            subdir = os.path.join(dir, name)
            if os.path.isdir(subdir) and os.path.exists(os.path.join(subdir, "__init__.py")):
                pkg_names = parent_names + [name]
                result.append(".".join(pkg_names))
                find_packages(subdir, pkg_names)
    source_dir = os.path.dirname(__file__) or os.curdir
    find_packages(source_dir, [])
    return result

def scripts():
    if os.name == "posix":
        return ["bin/pyrexc"]
    else:
        return ["pyrexc.py"]

setup(
    name = 'Pyrex', 
    version = version,
    url = 'http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/',
    author = 'Greg Ewing',
    author_email = 'greg.ewing@canterbury.ac.nz',
    scripts = scripts(),
    packages = packages(),
    data_files=[
        (compiler_dir, ['Pyrex/Compiler/Lexicon.pickle'])
    ]
)