Uh oh!
There was an error while loading. Please reload this page.
Check for Python27 on path when building on Win32 - #2351
Conversation
jrsconfitto
commented
May 22, 2014
My comment:
bugged me, so i found that something like this exists. It's node-which. i tested it on my machine to see if python was present and it worked well. Should i include it and go down the road of running |
gustavohenke
commented
May 22, 2014
I would personally do the following:
|
avdg
commented
May 22, 2014
This was discussed in #2211 too. Also I wouldn't check if the path contains |
probablycorey
commented
May 22, 2014
The python requirement comes from node-gyp. It has some code that might be helpful in this discussion https://github.com/TooTallNate/node-gyp/blob/56dcb889091a6a0594854ccc517e498b21078d5f/lib/configure.js#L25. |
jrsconfitto
commented
May 22, 2014
Thanks for the link, @probablycorey. There's a lot of code there that looks helpful. i'll look into utilizing what i can from that here. |
probablycorey
commented
May 23, 2014
Would something like this be good enough for now? // Make sure python2.7 is installedif(process.platform=='win32'){varsystemDrive=process.env.SystemDrive||'C:\\'varpythonPath=path.join(systemDrive,'Python27')if(!fs.existsSync(pythonPath)){console.warn("You must have Python 2.7 installed at '"+pythonPath+"'");process.exit(1);}}It will still fail if the |
avdg
commented
May 24, 2014
@probablycorey Nice for pointing out the actual python check in node-gyp. That's the code we should have been used from the actual beginning. And // Make sure python2.7 is installedif(process.platform=='win32'){varsystemDrive=process.env.SystemDrive||'C:\\'varpythonPath=path.join(systemDrive,'Python27')if(!fs.existsSync(pythonPath)){console.warn("You must have Python 2.7 installed at '"+pythonPath+"'");process.exit(1);}}Is probably a good start for now (meh... its just another variation of whats been posted here), but the code is already written here... https://github.com/TooTallNate/node-gyp/blob/56dcb889091a6a0594854ccc517e498b21078d5f/lib/configure.js#L34 @jugglingnutcase Having python not installed at its default location, but still having it in the system path sounds to me like a good testcase. Since node-gyp actually does support executing from path locations, the question is if the script should support that too. Ok, just to be clear I want to show what happens if python was not installed (I just gave the python directory a temporary different name). This happened: https://imgur.com/uBXeEUu |
probablycorey
commented
May 27, 2014
@avdg shouldn't the code sample you provided protect against the error you posted? I'm assuming you renamed |
avdg
commented
May 27, 2014
Hmm, let me start with this... this pretty simple problem is just complicated because of the many cases it has. What I forgot was that python was still in my include path. (and yeah, you can test it with @probablycorey Whatever... I guess your code is the best anyway (yes it should prevent the error) as it is exactly the same as the code used on node-gyp (edit: when python is not found in $path). (and yes, it does still check for the python27 in the path, so you still can't use something like (I'm just dreaming of re-using node-gyp's checker code, but that dream is I guess technically too hard to realize.) |
avdg
commented
May 27, 2014
Code is up. |
jrsconfitto
commented
May 27, 2014
Sorry for not responding earlier. I was on vacation this past weekend and am just getting back from work now. I'll be able to continue working on this PR over the next few days. I'm taking a look at all this now and will add some more comments throughout the evening! |
probablycorey
commented
May 27, 2014
One thing to keep in mind is that |
avdg
commented
May 27, 2014
This prototype has no path checker as that code depends on https://www.npmjs.org/package/which. I believe the bootstrap code should be run without any npm dependencies. The best I can do is to add a copy of that code too in script/bootstrap, which makes me go yuck. Any alternatives?
Pls review: avdg@3d1dcd1 |
jrsconfitto
commented
May 27, 2014
If I understand that code properly, @probablycorey, i'd prefer that we don't (just) use this because then I'll still have to patch I originally created this PR because the current check blows up unfairly (imo)! I have python and my path set up properly to make sure node-gyp is happy, but atom's build script tells me I don't. my separate experience with node-gyp and python
towards a resolution?
Yeah, I think that because it is a conceptually simple problem with a (fairly) simple solution (install and reference python in a way that node-gyp likes!) we should go the route of removing this Python check completely and adding a section to the troubleshooting document explaining what a missing python looks like. It is a prerequisite after all. (Though I've spent a fair amount of time not following directions!) Edit: forget the following!
|
jrsconfitto
commented
May 28, 2014
@probablycorey what about vendoring the |
jrsconfitto
commented
May 28, 2014
💩 did not mean to do that. Sorry 😦 |
avdg
commented
May 28, 2014
Vendoring sounds like a great idea, even though I'm not familiar with that word. Looking into it as just copy-pasting the code has lead to a few problems where I'm not sure what happened... |
avdg
commented
May 28, 2014
See #2426 What you should expect:
Any comments? |
probablycorey
commented
May 28, 2014
I think we are getting close, but we need to restate the problem. GOAL Give people more information about why Existing Problem
I'd like to avoid relying on the documentation as the only way to diagnose this problem because many people don't read the documentation. So getting something in |
probablycorey
commented
May 28, 2014
Also, a question for @jugglingnutcase. Did my example code in #2351 (comment) fail because python is not located at the default directory? |
avdg
commented
May 28, 2014
Hmm...
Though users are likely not to read documentation I guess it would be nice to still have some documentation.
|
jrsconfitto
commented
May 28, 2014
@probablycorey, i'm on board with all those points. Thanks for restating the goal, i found that incredibly helpful and refreshing.
IIRC, yeah, it failed for that exact reason. My python was installed at i'll leave my current doc edits for now and try to include @avdg's work into this PR. |
jrsconfitto
commented
May 28, 2014
@avdg, i'm wavering between pulling your work into this PR, or just recommending we go with your PR. i'll take a look into your work first, but i'll have to wait until i get some free time later. If your stuff looks good to me, maybe i'll just recommend we close this and go with your PR. |
the (not a big deal) problem
Previous to 0b5b741 i was building atom on Win32 fine. The other day i fetched new commits from atom and my builds wouldn't work anymore 😢
i thought i broke something. i commented out that check and everything built fine because i do have python on my machine and its installed location on my path.
EDIT: See this much more better restatement of the problem
See this comment for a better statement of the problem.
i propose
This PR adds a check for Python27 on the path on win32 machines and if it isn't,
script/buildsays:My initial solution is just to tell win32 builders that Python should be on the path. It may not be the best way, but it seems like a step forward to me. That seems like a reasonable thing to ask someone trying to build this 😄. i wish i knew about a
which python-like solution for node.history and previous discussions
i'm conscious of this conversation and this one, both mentioning that Python isn't installed on the path by default, so i'm aware that this isn't a perfect solution or may not be what you're looking for (the idea has already been floated for what i've done).
If this isn't the way to go about it, maybe we can 🔨 that out here?
A brief aside
This isn't a big deal for me, and i could be wrong, so i'll quote Mr. Paul Betts's comment out of context:
This isn't hard for me to patch on my own. i'm 🆒 with just doing that.
For much personal improvement's sake: Next time i'm just going to install python in the default directory!