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

bpo-30362 : Add list options to launcher. #1578

Merged
merged 14 commits into from
Jun 28, 2017

Conversation

GadgetSteve
Copy link
Contributor

These changes add to the windows launcher the options to list the available pythons, (-l or --list), or list with the paths, (-L or --long-list), and then terminate.

In the process the output of the help messages has been moved to a distinct function, (show_help_text).

Note that informational messages are sent to stderr and only the possible -x.y-bb flags or the flags and paths are output to stdout, this is intended to allow pipe of the flags for onward processing or scripting.

@mention-bot
Copy link

@GadgetSteve, thanks for your PR! By analyzing the history of the files in this pull request, we identified @briancurtin, @zooba and @vsajip to be potential reviewers.

@GadgetSteve GadgetSteve changed the title pbo-30362 : Add list options to launcher. bpo-30362 : Add list options to launcher. May 14, 2017
@codecov
Copy link

codecov bot commented May 14, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@9977629). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1578   +/-   ##
=========================================
  Coverage          ?   82.69%           
=========================================
  Files             ?     1432           
  Lines             ?   353213           
  Branches          ?        0           
=========================================
  Hits              ?   292073           
  Misses            ?    61140           
  Partials          ?        0

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9977629...60dbcae. Read the comment docs.

@brettcannon brettcannon requested a review from zooba May 16, 2017 21:45
@vsajip
Copy link
Member

vsajip commented May 17, 2017

I agree this is a useful feature, but I'm not sure I like the patch stylistically. Haven't yet had time to look at it in more detail.

else
{
for (i = 0; i < num_installed_pythons; i++, ip++) {
fwprintf(stdout, fmt, ip->version, ip->bits, ip->executable);
Copy link
Contributor

@eryksun eryksun May 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it really need to print the executable path? It's trivial to get that information manually.

PC/launcher.c Outdated
if (ip == NULL)
fwprintf(stderr, L"\n\nCan't find a Default Python.\n\n");
else
fwprintf(stderr, \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of printing the default version to stderr, it could indicate the default version in the list with an asterisk. For example, *3.6-64.

PC/launcher.c Outdated
if (argc == 2) {
slen = wcslen(L"-0");
if(!wcsncmp(p, L"-0", slen)) /* Starts with -0 */
show_python_list(argv); /* Check for -0 FIRST */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we return the exit code from show_python_list rather than using exit() in it? It's probably safe enough (because I'm sure enough people have done it in the past that the MS CRT protects itself against people doing it), but better to return from the entry point than to force an exit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restructured to allow exit via return from main rather than direct exit call.

PC/launcher.c Outdated
}
}

ip = locate_python(L"", FALSE);
/*ip = locate_python(L"", FALSE);*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this if it's not needed now.

@zooba
Copy link
Member

zooba commented Jun 27, 2017

Please also see https://devguide.python.org/committing/#what-s-new-and-news-entries and add a NEWS and what's new item for this.

Removed commented out line of code in PC/launcher.c.
Added the results of using blurb to add details of bpo-30362 & bpo-30291.
Updated Doc/whatsnew/3.7.rst to add a Windows only section covering both tickets.
@GadgetSteve
Copy link
Contributor Author

I am unable to resolve conflict in Doc/whatsnew/3.7.rst

@GadgetSteve
Copy link
Contributor Author

Conflict resolved.

@zooba
Copy link
Member

zooba commented Jun 28, 2017

Thanks. I shortened the two NEWS items so they are in line with the rest of our items. Once the checks are complete then I'll merge. Thanks for this!

@zooba zooba merged commit 5b8f972 into python:master Jun 28, 2017
@GadgetSteve GadgetSteve deleted the fix-issue-30362 branch June 29, 2017 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants