[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: svn commit: r37522 - trunk/build/generator

From: Bert Huijben <rhuijben_at_sharpsvn.net>
Date: Mon, 4 May 2009 15:23:11 +0200

> -----Original Message-----
> From: Arfrever Frehtes Taifersar Arahesis [mailto:Arfrever.FTA_at_GMail.Com]
> Sent: vrijdag 1 mei 2009 5:22
> To: svn_at_subversion.tigris.org
> Subject: svn commit: r37522 - trunk/build/generator
>
> Author: arfrever
> Date: Thu Apr 30 20:22:13 2009
> New Revision: 37522
>
> Log:
> * build/generator/gen_win.py
> (WinGeneratorBase._find_swig): Use subprocess.Popen() instead of
os.popen4()
> for compatibility with Python 3.
>
> Tested by: pburba
>
> Modified:
> trunk/build/generator/gen_win.py
>
> Modified: trunk/build/generator/gen_win.py
> URL:
>
http://svn.collab.net/viewvc/svn/trunk/build/generator/gen_win.py?pathrev=37
52
> 2&r1=37521&r2=37522
>
============================================================================
==
> --- trunk/build/generator/gen_win.py Thu Apr 30 15:15:06 2009
(r37521)
> +++ trunk/build/generator/gen_win.py Thu Apr 30 20:22:13 2009
(r37522)
> @@ -6,6 +6,7 @@ import os
> import sys
> import fnmatch
> import re
> +import subprocess
> import glob
> import generator.swig.header_wrappers
> import generator.swig.checkout_swig_header
> @@ -1220,8 +1221,13 @@ class WinGeneratorBase(GeneratorBase):
> else:
> self.swig_exe = 'swig'
>
> - infp, outfp = os.popen4(self.swig_exe + ' -version')
> - infp.close()
> + try:
> + outfp = subprocess.Popen([self.swig_exe, '-version'],
> stdout=subprocess.PIPE, universal_newlines=True).stdout
> + except OSError:
> + sys.stderr.write('Could not find installed SWIG,'
> + ' assuming version %s\n' % default_version)
> + self.swig_libdir = ''
> +
> try:
> txt = outfp.read()
> if txt:

This code fails on my development environment because outfp is not assigned
in the next block. (First on the outfp.read() and then in the outfp.close())

     [exec] build\generator\gen_vcnet_vcproj.py:6: DeprecationWarning: the
md5 m
odule is deprecated; use hashlib instead
     [exec] import md5
     [exec] Found libdb44.lib in ../build/win32/lib
     [exec] Generating for VS.NET 2008
     [exec] Could not detect Ruby version.
     [exec] Ruby bindings will be linked with msvcrt-ruby18.lib
     [exec] Found installed perl version number.
     [exec] Perl bindings will be linked with perl510.lib
     [exec] Could not find installed SWIG, assuming version 1.3.25
     [exec] Traceback (most recent call last):
     [exec] File "gen-make.py", line 286, in <module>
     [exec] main(conf, gentype, skip_depends=skip,
other_options=rest.list)
     [exec] File "gen-make.py", line 40, in main
     [exec] generator = gen_module.Generator(fname, verfname,
other_options)

     [exec] File "build\generator\gen_vcnet_vcproj.py", line 18, in
__init__
     [exec] 'vcnet-vcproj')
     [exec] File "build\generator\gen_win.py", line 211, in __init__
     [exec] self._find_swig()
     [exec] File "build\generator\gen_win.py", line 1254, in _find_swig
     [exec] outfp.close()
     [exec] UnboundLocalError: local variable 'outfp' referenced before
assignment

        Bert

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2056414
Received on 2009-05-04 15:23:43 CEST

This is an archived mail posted to the Subversion Dev mailing list.