Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'bug': 0.02; 'versions,': 0.05; 'subject:version': 0.07; 'terry': 0.07; 'python': 0.08; 'ssh': 0.09; 'subject:python': 0.10; 'output': 0.10; '25,': 0.12; 'things.': 0.12; 'tries': 0.15; 'cc:addr:python-list': 0.15; '"copyright",': 0.16; '"credits"': 0.16; '"license"': 0.16; '[gcc': 0.16; 'adam': 0.16; 'constructs': 0.16; 'constructs.': 0.16; 'fallback': 0.16; 'linux2': 0.16; 'nick': 0.16; 'openssl': 0.16; 'possibly,': 0.16; 'reedy': 0.16; 'subject:linked': 0.16; 'wrote:': 0.16; 'wed,': 0.17; '>>>': 0.18; 'jan': 0.19; 'seems': 0.19; 'header:In-Reply-To:1': 0.22; 'assumes': 0.23; 'debian': 0.23; 'code': 0.25; 'otherwise,': 0.25; 'import': 0.27; 'looks': 0.27; 'cc:addr:python.org': 0.29; 'subject:?': 0.30; 'cc:2**2': 0.30; 'version': 0.31; 'certain': 0.34; 'parse': 0.34; 'ssl': 0.34; '...': 0.35; 'things': 0.35; 'install': 0.35; 'run': 0.37; 'but': 0.37; 'replace': 0.38; 'think': 0.38; 'easier': 0.38; 'except': 0.39; 'subject:: ': 0.39; 'type': 0.60; 'more': 0.61; 'your': 0.61; 'header:Received:6': 0.61; 'target': 0.62; 'reply- to:no real name:2**0': 0.72; 'header:Reply-to:1': 0.84; "'if": 0.84 To: Adam Mercer From: Nick Dokos Subject: Re: Determining version of OpenSSL linked against python? In-Reply-To: Message from Adam Mercer of "Wed, 25 Jan 2012 14:41:49 CST." References: Organization: HPCS X-Mailer: MH-E 8.3.1; nmh 1.3; GNU Emacs 24.0.92 Date: Wed, 25 Jan 2012 15:56:19 -0500 Sender: nicholas.dokos@hp.com Cc: python-list@python.org, Terry Reedy X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: nicholas.dokos@hp.com List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1327524989 news.xs4all.nl 6980 [2001:888:2000:d::a6]:39866 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19432 Adam Mercer wrote: > On Wed, Jan 25, 2012 at 14:04, Terry Reedy wrote: > > > If you are not willing to tell Debian Squeeze users to install 2.7, or that > > they cannot run your program, ask the bug reporter to tell you what version > > of OpenSSL the system comes with and code it into your program. > > I would like to only support python-2.7 as that would make a few other > things easier but the powers that be think otherwise, I unfortunately > need to target python-2.6. > > > Or possibly, depending on what you do with the version info and what the > > differences are between versions, replace 'if version ...' constructs with > > 'try ... except...' constructs. > > My code already has a try... except block that tries the > ssl.OPENSSL_VERSION approach first but I wanted to have a fallback > method that works with python-2.6. Looks like I may need to hardcode > certain things. > One other possibility is to parse the output of ssh -V: ,---- | $ ssh -V | OpenSSH_5.8p1 Debian-1ubuntu3, OpenSSL 0.9.8o 01 Jun 2010 | $ python | Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) | [GCC 4.5.2] on linux2 | Type "help", "copyright", "credits" or "license" for more information. | >>> import ssl | >>> ssl.OPENSSL_VERSION | 'OpenSSL 0.9.8o 01 Jun 2010' | >>> `---- This assumes that ssh and python would use the same version of openssl: not guaranteed, but seems like a "reasonable" assumption to me. Nick