[issue14858] 'pysetup create' off-by-one when choosing classification maturity status interactively.
Éric Araujo added the comment: distutils2 is replaced by other projects. -- resolution: - out of date stage: test needed - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14858 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14858] 'pysetup create' off-by-one when choosing classification maturity status interactively.
Todd DeLuca todddel...@gmail.com added the comment: This patch fixes the problem where the user would select a maturity status when runnning 'pysetup create' and the resulting setup.cfq would have a maturity status one less than the user selected. It also fixes the behavior where a user can select '0' as a maturity status, which is not a valid selection, and setup.cfg will contain maturity status 'Development Status :: 7 - Inactive'. This behavior is related to the implementation of the off-by-one error above, since '0' is translated into a list lookup using the index -1. Finally, the patch addresses behavior where a user cannot enter a blank maturity status (e.g. by just pressing the 'return' key) in order to skip the question. The unit tests added to 'test_create.py' cover expected behavior when entering and blank selection, an invalid selection, and a valid selection. These tests were run using Python 2.7.3 on my Mac OS X 10.6.8 (Snow Leopard). -- keywords: +patch Added file: http://bugs.python.org/file25731/issue14858.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14858 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14858] 'pysetup create' off-by-one when choosing classification maturity status interactively.
Todd DeLuca todddel...@gmail.com added the comment: I'm working on a unit test and fix for a patch. There are a couple other possible bugs in the function that I coud fix (and test). Should I submit separate patches for each bug or one patch that fixes all 3 (small) bugs? Also should I open issues for each bug? The other issues I could open are: - the function forces you to choose a maturity status (instead of being able to skip it) - you can enter an out of range number (0) and it sets a valid value (the last item in the list.). Thanks for your advice. Regards, Todd On Sat, May 26, 2012 at 1:02 AM, Éric Araujo rep...@bugs.python.org wrote: Éric Araujo mer...@netwok.org added the comment: distutils indeed supports 2.5-2.7. The first proposed fix should be fine, what’s needed is a unit test (more info in the devguide). -- stage: needs patch - test needed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14858 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14858 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14858] 'pysetup create' off-by-one when choosing classification maturity status interactively.
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14858 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14858] 'pysetup create' off-by-one when choosing classification maturity status interactively.
Éric Araujo mer...@netwok.org added the comment: Thanks for the report and fix. Someone interested in contributing can turn your fix into a patch with a test. -- keywords: +easy stage: - needs patch versions: +3rd party, Python 3.3 -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14858 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14858] 'pysetup create' off-by-one when choosing classification maturity status interactively.
Sharif Nassar mrwack...@gmail.com added the comment: Even better: diff -r 747eec42e7ae distutils2/create.py --- a/distutils2/create.py Mon May 21 17:01:44 2012 -0400 +++ b/distutils2/create.py Fri May 25 19:04:22 2012 -0700 @@ -674,7 +674,7 @@ %s Status''' % '\n'.join('%s - %s' % (i, maturity_name(n)) - for i, n in enumerate(PROJECT_MATURITY)) + for i, n in enumerate(PROJECT_MATURITY, 1 )) while True: choice = ask(dedent(maturity_question), required=False) -- nosy: +Sharif.Nassar ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14858 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14858] 'pysetup create' off-by-one when choosing classification maturity status interactively.
Todd DeLuca todddel...@gmail.com added the comment: That was my first thought, but if python2.5 compatibility is important, I don't think using the start parameter is an option. http://docs.python.org/library/functions.html#enumerate Changed in version 2.6: The start parameter was added. Regards, Todd On Fri, May 25, 2012 at 9:59 PM, Sharif Nassar rep...@bugs.python.orgwrote: Sharif Nassar mrwack...@gmail.com added the comment: Even better: diff -r 747eec42e7ae distutils2/create.py --- a/distutils2/create.py Mon May 21 17:01:44 2012 -0400 +++ b/distutils2/create.py Fri May 25 19:04:22 2012 -0700 @@ -674,7 +674,7 @@ %s Status''' % '\n'.join('%s - %s' % (i, maturity_name(n)) - for i, n in enumerate(PROJECT_MATURITY)) + for i, n in enumerate(PROJECT_MATURITY, 1 )) while True: choice = ask(dedent(maturity_question), required=False) -- nosy: +Sharif.Nassar ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14858 ___ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14858 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14858] 'pysetup create' off-by-one when choosing classification maturity status interactively.
Éric Araujo mer...@netwok.org added the comment: distutils indeed supports 2.5-2.7. The first proposed fix should be fine, what’s needed is a unit test (more info in the devguide). -- stage: needs patch - test needed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14858 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14858] 'pysetup create' off-by-one when choosing classification maturity status interactively.
New submission from Todd DeLuca todddel...@gmail.com: Today I installed distutils2 via pip and ran 'pysetup create'. During the selection of Trove classifiers for Development status I chose '2 - Alpha' but setup.cfg ended up incorrectly indicating that my project is Pre-Alpha. Here is a screenshot of the interactive setup with me choosing '2 - Alpha': ``` Do you want to set Trove classifiers? (y/n): y Please select the project status: 0 - Planning 1 - Pre-Alpha 2 - Alpha 3 - Beta 4 - Production/Stable 5 - Mature 6 - Inactive Status: 2 ``` Here is the relevant line in setup.cfg: classifier = Development Status :: 2 - Pre-Alpha Here are the relevant Trove classifications from http://pypi.python.org/pypi?%3Aaction=list_classifiers: ``` Development Status :: 1 - Planning Development Status :: 2 - Pre-Alpha Development Status :: 3 - Alpha Development Status :: 4 - Beta Development Status :: 5 - Production/Stable Development Status :: 6 - Mature Development Status :: 7 - Inactive ``` Notice above that the numbers assigned to the Trove classifiers are greater (by one) than the numbers displayed in the pysetup script. The problem is in file distutil2/create.py (http://hg.python.org/distutils2/file/d015f9edccb8/distutils2/create.py) in class MainProgram, method set_maturity_status(). Changing the following line: 676 Status''' % '\n'.join('%s - %s' % (i, maturity_name(n)) To the following: 676 Status''' % '\n'.join('%s - %s' % (i + 1, maturity_name(n)) Should display the numbers correctly and fix the problem. I tested this fix on my system (using python2.7.3) and it works correctly. Regards, Todd P.S. Apologies for not submitting a Pull request. -- assignee: eric.araujo components: Distutils2 messages: 161129 nosy: alexis, eric.araujo, tarek, todddeluca priority: normal severity: normal status: open title: 'pysetup create' off-by-one when choosing classification maturity status interactively. type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14858 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com