File: setup.py

package info (click to toggle)
python-pytc 0.8-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 200 kB
  • sloc: ansic: 3,641; python: 45; makefile: 20
file content (56 lines) | stat: -rwxr-xr-x 1,552 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env python
import sys
from distutils.core import setup, Extension
import commands
import re
import os

if sys.version_info < (2, 3):
  raise Error, "Python 2.3 or later is required"

include_dirs = []
library_dirs = ['/usr/local/lib']

if sys.platform == 'linux2':
  os.environ['PATH'] += ":/usr/local/bin:$home/bin:.:..:../.."

  tcinc = commands.getoutput('tcucodec conf -i 2>/dev/null')
  m = re.search(r'-I([/\w]+)', tcinc)
  if m:
    for path in m.groups():
      include_dirs.append(path)
    include_dirs = sorted(set(include_dirs), key=include_dirs.index)

  tclib = commands.getoutput('tcucodec conf -l 2>/dev/null')
  m = re.search(r'-L([/\w]+)', tclib)
  if m:
    for path in m.groups():
      library_dirs.append(path)
    library_dirs = sorted(set(library_dirs), key=library_dirs.index)

if sys.platform == 'darwin':
  # darwin ports
  include_dirs.append('/opt/local/include')
  library_dirs.append('/opt/local/lib')
  # fink
  include_dirs.append('/sw/include')
  library_dirs.append('/sw/lib')

ext = Extension('pytc',
                libraries = ['tokyocabinet'],
                sources = ['pytc.c'],
                include_dirs = include_dirs,
                library_dirs = library_dirs,
               )

setup(name = 'pytc',
      version = '0.8',
      description = 'Tokyo Cabinet Python bindings',
      long_description = '''
        Tokyo Cabinet Python bindings
      ''',
      license='BSD',
      author = 'Tasuku SUENAGA',
      author_email = 'gunyarakun@sourceforge.jp',
      ext_modules = [ext]
     )