Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distutils blows up with an incorrect pypirc, should be caught #74081

Closed
TommyCarpenter mannequin opened this issue Mar 24, 2017 · 4 comments
Closed

Distutils blows up with an incorrect pypirc, should be caught #74081

TommyCarpenter mannequin opened this issue Mar 24, 2017 · 4 comments
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@TommyCarpenter
Copy link
Mannequin

TommyCarpenter mannequin commented Mar 24, 2017

BPO 29895
Nosy @merwok, @berkerpeksag, @zooba, @dstufft
Files
  • issue29895_test.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-02-03.18:21:24.376>
    created_at = <Date 2017-03-24.14:24:33.594>
    labels = ['3.7', 'type-bug', 'library']
    title = 'Distutils blows up with an incorrect pypirc, should be caught'
    updated_at = <Date 2021-02-03.18:21:24.375>
    user = 'https://bugs.python.org/TommyCarpenter'

    bugs.python.org fields:

    activity = <Date 2021-02-03.18:21:24.375>
    actor = 'steve.dower'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-02-03.18:21:24.376>
    closer = 'steve.dower'
    components = ['Distutils']
    creation = <Date 2017-03-24.14:24:33.594>
    creator = 'Tommy Carpenter'
    dependencies = []
    files = ['46863']
    hgrepos = []
    issue_num = 29895
    keywords = ['patch']
    message_count = 4.0
    messages = ['290090', '293637', '293860', '386351']
    nosy_count = 5.0
    nosy_names = ['eric.araujo', 'berker.peksag', 'steve.dower', 'dstufft', 'Tommy Carpenter']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue29895'
    versions = ['Python 2.7', 'Python 3.5', 'Python 3.6', 'Python 3.7']

    @TommyCarpenter
    Copy link
    Mannequin Author

    TommyCarpenter mannequin commented Mar 24, 2017

    Full details and stacktrace are at: http://stackoverflow.com/questions/43001446/python-pypi-configparser-blowing-up-when-pointing-to-certain-repo/43001770#43001770

    Essentially, I had an index-servers section that listed a repo, that was not listed in the remainder of the .pypirc file. Instead of distutils catching this, it blows up in an obscure ConfigParsing error.

    @TommyCarpenter TommyCarpenter mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Mar 24, 2017
    @berkerpeksag
    Copy link
    Member

    Thanks for the report, Tommy. I think the configparser exception is pretty descriptive here. You had a .pypirc file like the following:

    [distutils]
    index-servers = 
      pypi
      global
    
    [pypi]
    username:spam
    password:eggs
    

    You passed -r global and you got:

        Traceback (most recent call last):
          ...
        ConfigParser.NoSectionError: No section: 'global'

    Which says you don't have a section named 'global' in your .pypirc.

    There are three options here:

    a) do nothing
    b) catch configparser.NoSectionError and raise a distutils exception with better wording. Since we don't have DistutilsConfigError, I'm not sure which one is more appropriate here.
    c) ignore configparser.NoSectionError if server name cannot be found in sections in PyPIRCCommand._read_pypirc(). IMO this is the worst option.

    Here is a test case to demonstrate the problem described at the SO question.

    @berkerpeksag berkerpeksag added the 3.7 (EOL) end of life label May 14, 2017
    @TommyCarpenter
    Copy link
    Mannequin Author

    TommyCarpenter mannequin commented May 17, 2017

    Hi,

    I think option B might be best, because the issue was that I didn't know at first that the problem was in my .pypirc. I think this stack trace is not the most elegant way for the user to figure that out. Maybe catching this and then presenting a human readable error to the user would be better.

    @zooba
    Copy link
    Member

    zooba commented Feb 3, 2021

    Distutils is now deprecated (see PEP-632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.

    If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools

    @zooba zooba closed this as completed Feb 3, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants