-
Notifications
You must be signed in to change notification settings - Fork 7.3k
OpenSuse Tumbleweed gcc (v. 5.1.1) -dumpversion issues #25671
Conversation
I received the same error you reported here and with your modification to the configure file I was able to install node, thanks. |
This looks fine to me, but let's see what @orangemocha or @misterdjules think |
Interesting. So there is no other way of telling the minor version (.1) on this platform? |
The change per se LGTM. I probably would have implemented it with an if statement but the try-except works. |
@orangemocha. By default gcc 5.1+ dont returns to me a minor version of their compiler. I dont know if they have plans to reinsert the minor version in forward releases. |
|
||
try: | ||
o['variables']['gcc_version'] = 10 * cc_version[0] + cc_version[1] | ||
except IndexError: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are expecting at least one element then we can do if len(cc_version) == 2: ... else: ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or:
o['variables']['gcc_version'] = 10 * cc_version[0]
if len(cc_version) >= 2:
o['variables']['gcc_version'] += cc_version[1]
else:
print 'Warning: no gcc minor version found, assuming 0'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya something like this. I didn't have a computer at that moment, so couldn't express myself clearly. Sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
o['variables']['gcc_version'] = 10 * cc_version[0]
This line always run, because cc_version[0]
refers the major version of gcc.
Now I think, we only need to check if cc_version[1]
exists. If exists, use your value, if not exists show a warning message. Like the code above.
I've used try .. except
because Python encourages use of try
.
I've tested if .. else
way and my try ... except
way, both ways have solved this issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that Python encourages EAFP: Easier to ask for forgiveness than permission. But I wanted to make sure that the code is easily understandable. Anyway I am not going to hold this PR with this discussion. Please continue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Will land as is.
@thefourtheye . Really, the |
I was worried that if the number of elements is zero then we ll not know which access throws the error. |
Just noticed that this PR is against master. If it is meant to go in v0.12, then it should be against the v0.12 branch. Otherwise, it probably makes more sense to do it in io.js master. @jasnell @misterdjules is that right? |
Yes. Commits here need to be targeted at v0.12 or v0.10. Commits against master need to go into nodejs/io.js moving forward. |
@jasnell : makes sense, thank you. Assuming that 'being able to compile' is one of those fixes that we want to include in v0.10, this should land in v0.10 first. I can do the cherry-picking. |
PR-URL: #25671 Reviewed-By: Alexis Campailla <alexis@janeasystems.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Landed in 8564a9f. |
grep is not required for the functionality in this instance. This avoids an unnecessary fork, and also avoids a duplicated dumpversion call. Furthermore, it also corrects behavior when no minor version number is present, see e.g nodejs/node-v0.x-archive#25671. Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Hello,
I found some difficulties when attempting to configure and compile NodeJS packages in openSUSE Tumbleweed.
The error reported when running ./configure
In the configure file, specifically the compiler_version function. It returned a tuple to cc_version variable. However, in OpenSUSE, if we execute:
It returns a single integer value, making the variable that contains the tuple store (5,), resulting in IndexError exception.
I made this change in my configure file, allowing the compilation of NodeJS in my Tumbleweed environment.
ps: Excuse me for my English, it is not my native language. I'm learning it yet. :)