Alexandre Lision | 8af73cb | 2013-12-10 14:11:20 -0500 | [diff] [blame] | 1 | # $Id: setup-vc.py 4122 2012-05-14 11:04:46Z bennylp $ |
Tristan Matthews | 0a329cc | 2013-07-17 13:20:14 -0400 | [diff] [blame] | 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 | # |
| 21 | from distutils.core import setup, Extension |
| 22 | import os |
| 23 | import sys |
| 24 | |
| 25 | # Find version |
| 26 | pj_version="" |
| 27 | pj_version_major="" |
| 28 | pj_version_minor="" |
| 29 | pj_version_rev="" |
| 30 | pj_version_suffix="" |
| 31 | f = open('../../../version.mak', 'r') |
| 32 | for 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 | |
| 50 | f.close() |
| 51 | if not pj_version_major: |
| 52 | print 'Unable to get PJ_VERSION_MAJOR' |
| 53 | sys.exit(1) |
| 54 | |
| 55 | pj_version = pj_version_major + "." + pj_version_minor |
| 56 | if pj_version_rev: |
| 57 | pj_version += "." + pj_version_rev |
| 58 | if 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 |
| 65 | if 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 | |
| 72 | setup(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 | |