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

Re: [PATCH] dynamically link swig runtime on windows (Can I commit this?)

From: Branko Čibej <brane_at_xbc.nu>
Date: 2003-08-08 01:06:04 CEST

Russell Yanofsky wrote:

>Russell Yanofsky wrote:
>
>
>>Branko Čibej wrote:
>>
>>
>>>Russell Yanofsky wrote:
>>>
>>>
>>>
>>>> (Generator.get_win_libs): add perl56.lib library for perl
>>>> modules
>>>>
>>>>
>>>>
>>>Is there a remote possibility that we might detect the version of
>>>Perl, instead of hardcoding support for 5.6? For example, I have
>>>version 5.8 on my box. Running "perl -e 'print $]'" and converting
>>>the output would do just fine.
>>>
>>>
>
>"perl -e 'print $]'" returns "5.006001" for me. What's the most reliable way
>to derive perl56.lib from that? I'm thinking:
>
> _re_perl_version = re.compile(r'(\d+)\.(\d{3})')
>
> def perl_library(version):
> match = _re_perl_version.match(version)
> return 'perl' + match.group(1) + str(int(match.group(2))) + '.lib'
>
> perl_library('5.006001')
>
>Does this work on perl 5.8?
>
>
Should do, my 5.8 prints "5.008", and your regexp should match that
nicely. But there's no need to use regular expression matching here:

    import string
    def perl_library(version):
      dot = string.find(version, '.')
      if dot < 0 or len(version) < dot+4:
        return None
      return 'perl' + version[0:dot] + str(int(version[dot+1:dot+4]))

Funny though, I tried "string.lstrip(version[dot+1:dot+4], '0')", but it
seems that lstrip doesn't take the second argument even though it's
documented...

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Aug 8 01:08:57 2003

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.