Mercurial > hg
comparison tests/hghave.py @ 28591:f29cab5c519c
hghave: change ssl check to just check ssl module
Previously, the "ssl" check effectively looked for PyOpenSSL
or Python 2.7.9. After this patch, we simply look for just the
"ssl" module.
After d962e955da08, there have been no references to PyOpenSSL in
the tree (the previous usage of PyOpenSSL was to implement ssl
support on old, no longer supported Python versions that didn't
have an ssl module (e.g. Python 2.4). So, the check for PyOpenSSL
served no purpose.
Pythons we support ship with the ssl module. Although it may not be
available in all installations. So, we still need the check for
whether the ssl module imports, hence the hghave check.
The main side-effect of this change is that we now run test-https.t
(the only test requiring the "ssl" hghave feature) on Python <2.7.9
when PyOpenSSL is not installed (which is probably most installations)
and the ssl module is available. Before, we wouldn't run this test
on these older Python versions.
I confirmed that test-https.t passes with Python 2.6.9 and 2.7.8 on
OS X 10.11.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 19 Mar 2016 13:51:00 -0700 |
parents | cdbc25306696 |
children | 45954a251a40 |
comparison
equal
deleted
inserted
replaced
28590:b0b9f6b0a777 | 28591:f29cab5c519c |
---|---|
339 def has_outer_repo(): | 339 def has_outer_repo(): |
340 # failing for other reasons than 'no repo' imply that there is a repo | 340 # failing for other reasons than 'no repo' imply that there is a repo |
341 return not matchoutput('hg root 2>&1', | 341 return not matchoutput('hg root 2>&1', |
342 r'abort: no repository found', True) | 342 r'abort: no repository found', True) |
343 | 343 |
344 @check("ssl", ("(python >= 2.6 ssl module and python OpenSSL) " | 344 @check("ssl", "ssl module available") |
345 "OR python >= 2.7.9 ssl")) | |
346 def has_ssl(): | 345 def has_ssl(): |
347 try: | 346 try: |
348 import ssl | 347 import ssl |
349 if getattr(ssl, 'create_default_context', False): | 348 ssl.CERT_NONE |
350 return True | |
351 import OpenSSL | |
352 OpenSSL.SSL.Context | |
353 return True | 349 return True |
354 except ImportError: | 350 except ImportError: |
355 return False | 351 return False |
356 | 352 |
357 @check("sslcontext", "python >= 2.7.9 ssl") | 353 @check("sslcontext", "python >= 2.7.9 ssl") |