blob: cab1498e1bcdee2acb2893de6223d8bd80031150 [file] [log] [blame]
Tristan Matthews0a329cc2013-07-17 13:20:14 -04001# $Id: setup-vc.py 4122 2012-05-14 11:04:46Z bennylp $
2#
3# pjsua Setup script for Visual Studio
4#
5# Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
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#
21from distutils.core import setup, Extension
22import os
23import sys
24
25# Find version
26pj_version=""
27pj_version_major=""
28pj_version_minor=""
29pj_version_rev=""
30pj_version_suffix=""
31f = open('../../../version.mak', 'r')
32for line in f:
33 if line.find("export PJ_VERSION_MAJOR") != -1:
34 tokens=line.split("=")
35 if len(tokens)>1:
36 pj_version_major= tokens[1].strip()
37 elif line.find("export PJ_VERSION_MINOR") != -1:
38 tokens=line.split("=")
39 if len(tokens)>1:
40 pj_version_minor= line.split("=")[1].strip()
41 elif line.find("export PJ_VERSION_REV") != -1:
42 tokens=line.split("=")
43 if len(tokens)>1:
44 pj_version_rev= line.split("=")[1].strip()
45 elif line.find("export PJ_VERSION_SUFFIX") != -1:
46 tokens=line.split("=")
47 if len(tokens)>1:
48 pj_version_suffix= line.split("=")[1].strip()
49
50f.close()
51if not pj_version_major:
52 print 'Unable to get PJ_VERSION_MAJOR'
53 sys.exit(1)
54
55pj_version = pj_version_major + "." + pj_version_minor
56if pj_version_rev:
57 pj_version += "." + pj_version_rev
58if pj_version_suffix:
59 pj_version += "-" + pj_version_suffix
60
61#print 'PJ_VERSION = "'+ pj_version + '"'
62
63
64# Check that extension has been built
65if not os.access('../../lib/_pjsua.pyd', os.R_OK):
66 print 'Error: file "../../lib/_pjsua.pyd" does not exist!'
67 print ''
68 print 'Please build the extension with Visual Studio first'
69 print 'For more info, see http://trac.pjsip.org/repos/wiki/Python_SIP_Tutorial'
70 sys.exit(1)
71
72setup(name="pjsua",
73 version=pj_version,
74 description='SIP User Agent Library based on PJSIP',
75 url='http://trac.pjsip.org/repos/wiki/Python_SIP_Tutorial',
76 data_files=[('lib/site-packages', ['../../lib/_pjsua.pyd'])],
77 py_modules=["pjsua"]
78 )
79
80