Repository: numpy/numpy

Issue:
Condition comparing incompatible types in "numpy.distutils.system_info.libpaths"
Hello,

While analyzing numpy on SonarCloud I saw what looks like an error in [`numpy/distutils/system_info.py`](https://github.com/numpy/numpy/blob/385575faba79b5c857112199206119bf9ac2277f/numpy/distutils/system_info.py#L293):

<img width="1590" alt="Screenshot 2020-10-07 at 14 58 09" src="https://user-images.githubusercontent.com/40498978/95333938-b856e900-08ad-11eb-8e41-23450f0fcf3a.png">


You can see the issue in SonarCloud [here](https://sonarcloud.io/project/issues?id=nicolas-harraudeau-sonarsource_numpy&issues=AXUCzxJG_fo4ewk0XE72&open=AXUCzxJG_fo4ewk0XE72).

The condition of this `if` statement will always be False because it compares a `tuple` and a string with the operator `==`. The [documentation of `platform.architecture()`](https://docs.python.org/3.8/library/platform.html#platform.architecture) explicitly says:
> Returns a tuple (bits, linkage) which contain information about the bit architecture and the linkage format used for the executable. Both values are returned as strings.

I guess the developer intended to write instead:
```
if platform.architecture()[0] == '32bit':
```

In case you have any question, suggestion or if you see a False Positive on SonarCloud you can reach out on [SonarSource community forum](https://community.sonarsource.com/).

A few notes in case you want to use SonarCloud:
* I am currently testing the python analyzer so [the numpy project I created on SonarCloud](https://sonarcloud.io/dashboard?id=nicolas-harraudeau-sonarsource_numpy) will only show python issues, but SonarCloud can also analyze C/C++ code and other languages.
* SonarCloud can easily import pylint and flake8 issues in case you want to use a rule SonarCloud does not already provide. Note however that pylint/flake8 rules and SonarCloud rules are implemented differently. You might see new issues with SonarCloud, or less issues in some cases (we try to avoid False Positives as much as possible).
* SonarCloud is free for open-source projects.


Discussion:
I'm curious - are you writing these issues manually, or is this automated?
@eric-wieser The detection is automatic on SonarCloud. I wrote the Github issues manually. At SonarSource we validate our static code analyzers by testing them on popular open source projects, such as numpy, to make sure that we find valuable issues and raise no False Positives. This is how I saw these bugs.

I will report one more issue and stop there for now as I have to to take a look at other open source projects. If you want to see all the bugs we detected you can look at [this list here](https://sonarcloud.io/project/issues?id=nicolas-harraudeau-sonarsource_numpy&languages=py&open=AXUCzxtX_fo4ewk0XFDT&resolved=false&types=BUG).

As mentioned above, if you see any False Positives or if you have a question or feedback don't hesitate to share it [on the community forum](https://community.sonarsource.com/).
This was introduced in ea083bdbd39d37023f7ab7b366d5a9cd0d9707b2 by @xoviat, which interestingly seems to have no PR associated with it. So at any rate, this was never a regression - it was just a feature that didn't work for 32-bit platforms, likely because few windows users have one.
xoviat ~was banned by~ left GitHub and his PRs disappeared. I don't recall if that also included merged PRs.

Edit: changed misleading text
Email archive to the rescue - it was #9854
I wasn't banned from GitHub, I deleted my account because these projects were consuming all of my time. I've been back for some time now, but have been working on other projects for now. I may come back to this, but have no immediate plans. I apologize if my account deletion affected PRs.
No need to apologise for a UI bug in github @xoviat - glad to here you were able to reallocate your time in a way that worked better for you.

Resolving patch:
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
--- a/numpy/distutils/system_info.py
+++ b/numpy/distutils/system_info.py
@@ -290,7 +290,7 @@ def add_system_root(library_root):
     vcpkg = shutil.which('vcpkg')
     if vcpkg:
         vcpkg_dir = os.path.dirname(vcpkg)
-        if platform.architecture() == '32bit':
+        if platform.architecture()[0] == '32bit':
             specifier = 'x86'
         else:
             specifier = 'x64'


Test patch: