~ubuntu-branches/ubuntu/wily/sflphone/wily

« back to all changes in this revision

Viewing changes to daemon/libs/pjproject-2.2.1/pjsip-apps/src/swig/python/setup.py

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2015-01-07 14:51:16 UTC
  • mfrom: (4.3.5 sid)
  • Revision ID: package-import@ubuntu.com-20150107145116-yxnafinf4lrdvrmx
Tags: 1.4.1-0.1ubuntu1
* Merge with Debian, remaining changes:
 - Drop soprano, nepomuk build-dep
* Drop ubuntu patches, now upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# $Id: setup.py 4756 2014-02-21 07:49:37Z nanang $
 
2
#
 
3
# pjsua2 Setup script.
 
4
#
 
5
# Copyright (C)2012 Teluu Inc. (http://www.teluu.com)
 
6
#
 
7
# This program is free software; you can redistribute it and/or modify
 
8
# it under the terms of the GNU General Public License as published by
 
9
# the Free Software Foundation; either version 2 of the License, or
 
10
# (at your option) any later version.
 
11
#
 
12
# This program is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU General Public License
 
18
# along with this program; if not, write to the Free Software
 
19
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
 
20
#
 
21
from distutils.core import setup, Extension
 
22
import os
 
23
import sys
 
24
import platform
 
25
 
 
26
# find pjsip version
 
27
pj_version=""
 
28
pj_version_major=""
 
29
pj_version_minor=""
 
30
pj_version_rev=""
 
31
pj_version_suffix=""
 
32
f = open('../../../../version.mak', 'r')
 
33
for line in f:
 
34
    if line.find("export PJ_VERSION_MAJOR") != -1:
 
35
        tokens=line.split("=")
 
36
        if len(tokens)>1:
 
37
                pj_version_major= tokens[1].strip()
 
38
    elif line.find("export PJ_VERSION_MINOR") != -1:
 
39
        tokens=line.split("=")
 
40
        if len(tokens)>1:
 
41
                pj_version_minor= line.split("=")[1].strip()
 
42
    elif line.find("export PJ_VERSION_REV") != -1:
 
43
        tokens=line.split("=")
 
44
        if len(tokens)>1:
 
45
                pj_version_rev= line.split("=")[1].strip()
 
46
    elif line.find("export PJ_VERSION_SUFFIX") != -1:
 
47
        tokens=line.split("=")
 
48
        if len(tokens)>1:
 
49
                pj_version_suffix= line.split("=")[1].strip()
 
50
 
 
51
f.close()
 
52
if not pj_version_major:
 
53
    print 'Unable to get PJ_VERSION_MAJOR'
 
54
    sys.exit(1)
 
55
 
 
56
pj_version = pj_version_major + "." + pj_version_minor
 
57
if pj_version_rev:
 
58
        pj_version += "." + pj_version_rev
 
59
if pj_version_suffix:
 
60
        pj_version += "-" + pj_version_suffix
 
61
 
 
62
#print 'PJ_VERSION = "'+ pj_version + '"'
 
63
 
 
64
# Get targetname
 
65
f = os.popen("make --no-print-directory -f helper.mak target_name")
 
66
pj_target_name = f.read().rstrip("\r\n")
 
67
f.close()
 
68
 
 
69
# Fill in extra_compile_args
 
70
extra_compile_args = []
 
71
f = os.popen("make --no-print-directory -f helper.mak cflags")
 
72
for line in f:
 
73
    extra_compile_args.append(line.rstrip("\r\n"))
 
74
f.close()
 
75
 
 
76
# Fill in libraries
 
77
libraries = []
 
78
f = os.popen("make --no-print-directory -f helper.mak libs")
 
79
for line in f:
 
80
    libraries.append(line.rstrip("\r\n"))
 
81
f.close()
 
82
 
 
83
# Fill in extra_link_args
 
84
extra_link_args = []
 
85
f = os.popen("make --no-print-directory -f helper.mak ldflags")
 
86
for line in f:
 
87
    extra_link_args.append(line.rstrip("\r\n"))
 
88
f.close()
 
89
 
 
90
# MinGW specific action: put current working dir to PATH, so Python distutils
 
91
# will invoke our dummy gcc/g++ instead, which is in the current working dir.
 
92
if platform.system()=='Windows' and os.environ["MSYSTEM"].find('MINGW')!=-1:
 
93
    os.environ["PATH"] = "." + os.pathsep + os.environ["PATH"]
 
94
 
 
95
setup(name="pjsua2", 
 
96
      version=pj_version,
 
97
      description='SIP User Agent Library based on PJSIP',
 
98
      url='http://www.pjsip.org',
 
99
      ext_modules = [Extension("_pjsua2", 
 
100
                               ["pjsua2_wrap.cpp"],
 
101
                               libraries=libraries,
 
102
                               extra_compile_args=extra_compile_args,
 
103
                               extra_link_args=extra_link_args
 
104
                              )
 
105
                    ],
 
106
      py_modules=["pjsua2"]
 
107
     )
 
108
 
 
109