Bug 1231325

Summary: python-setuptools: requirement of ssl_match_hostname is no longer needed since Python 2.7.9
Product: [Fedora] Fedora Reporter: Carl George 🤠 <carlwgeorge>
Component: python-setuptoolsAssignee: Fedora Infrastructure SIG <infra-sig>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: infra-sig, kevin, lmacken, mhroncok, mstuchli, rkuska
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-setuptools-17.1.1-3.fc22 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-06-20 19:51:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1229409    

Description Carl George 🤠 2015-06-12 16:55:23 UTC
Description of problem:

Python 3.4's entire ssl module was backported to 2.7.9 [1].  Setuptools already has a try/except statement to import CertificateError and match_hostname from the standard library ssl module if they are available [2].  Effectively, the rpm has a dependency that isn't being used.  Because of that, I believe that these lines should be removed from the python-setuptools spec file [2].

-Requires:       python-backports-ssl_match_hostname
-BuildRequires:  python-backports-ssl_match_hostname

Version-Release number of selected component (if applicable):

python-setuptools-12.0.3-1.fc22.noarch

How reproducible:

$ # CertificateError in the standard library
$ grep 'class CertificateError' /usr/lib64/python2.7/ssl.py
class CertificateError(ValueError):

$ # match_hostname in the standard library
$ grep 'def match_hostname' /usr/lib64/python2.7/ssl.py
def match_hostname(cert, hostname):

$ # setuptools tries to import from the standard library first [3]
$ grep -B1 -A7 'from ssl' /usr/lib/python2.7/site-packages/setuptools/ssl_support.py
try:
    from ssl import CertificateError, match_hostname
except ImportError:
    try:
        from backports.ssl_match_hostname import CertificateError
        from backports.ssl_match_hostname import match_hostname
    except ImportError:
        CertificateError = None
        match_hostname = None

Actual results:

The RPM has a dependency that it isn't using.

Expected results:

The RPM only depends on things it actually needs.

Additional info:

[1] https://www.python.org/downloads/release/python-279/
[2] http://pkgs.fedoraproject.org/cgit/python-setuptools.git/tree/python-setuptools.spec#n42
[3] https://bitbucket.org/pypa/setuptools/src/bf8c5bcacd49bf0f9648013a40ebfc8f7c727f7b/setuptools/ssl_support.py?at=12.0.3#cl-45

Comment 1 Kevin Fenzi 2015-06-20 19:51:01 UTC
https://koji.fedoraproject.org/koji/taskinfo?taskID=10171190

Built in rawhide. If you need/want f22 too, let me know.

Comment 2 Carl George 🤠 2015-06-22 13:22:13 UTC
Thanks Kevin.  I would like the fix added to F22 as well.  F22 is the first release of Fedora that has python 2.7.9 (when the ssl module was backported).

Comment 3 Fedora Update System 2015-06-22 22:50:11 UTC
python-setuptools-17.1.1-3.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/python-setuptools-17.1.1-3.fc22

Comment 4 Fedora Update System 2015-06-30 00:20:44 UTC
python-setuptools-17.1.1-3.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.