swiginac

Joshua Root jmr at macports.org
Sat Nov 14 13:24:11 PST 2015


On 2015-11-15 06:53 , Mark Brethen wrote:
> 
>> On Nov 14, 2015, at 1:25 PM, Mark Brethen <mark.brethen at gmail.com> wrote:
>>
>>
>>> On Nov 14, 2015, at 1:21 PM, Joshua Root <jmr at macports.org> wrote:
>>>
>>> Forgot to import LooseVersion from distutils.version?
>>
>> Setup.py:
>>
>> from distutils.core import setup, Extension
>> import distutils
>> from  sys import argv, exit
>> import os
>> from os.path import join as pjoin, sep as psep
>> import commands
>>
>> Mark
>>
>>
>>
>>
> 
> Added "from distutils.version import LooseVersion” but still fails:
> 
> :info:build running build
> :info:build running build_py
> :info:build file swiginac.py (for module swiginac) not found
> :info:build file swiginac.py (for module swiginac) not found
> :info:build running build_ext
> :info:build building '_swiginac' extension
> :info:build swigging swiginac.i to swiginac_wrap.c
> :info:build swig -python -o swiginac_wrap.c swiginac.i
> :info:build /opt/local/share/swig/3.0.7/python/std_common.i:73: Error: Syntax error in input(1).
> :info:build error: command 'swig' failed with exit status 1
> 
> StrictVersion did not work. What is argv.insert()? I could not find any documentation for this command.

Argv is just a list, so it's the standard list insert method.

It's not like we support python 2.3 anyway, so just do this:

--- setup.py.orig	2015-11-15 08:10:37.000000000 +1100
+++ setup.py	2015-11-15 08:18:00.000000000 +1100
@@ -42,18 +42,12 @@

 os.chdir(pjoin("src", "swiginac"))

-# The command line argument for running swig in c++ mode has changed from
-# Python 2.3 to 2.4. We support both.
-swig_opt = '--swig-cpp'
-if distutils.__version__ >= '2.4': swig_opt = '--swig-opts=-c++'
-
 if argv[1] == 'build':
     argv[1] = 'build_ext'
-if argv[1] == 'build_ext':
-    argv.insert(2, swig_opt)
-
+
 e = Extension(name='_swiginac',
               sources=['swiginac.i'],
+              swig_opts=['-c++'],
               **pkgconfig("ginac")
              )


- Josh


More information about the macports-dev mailing list