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

Py3k libraries path fix (issue #41) #60

Merged
merged 1 commit into from
Mar 5, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,18 @@ def build_extensions(self):
_add_directory(include_dirs, "/usr/X11/include")

elif sys.platform.startswith("linux"):
if platform.processor() == "x86_64":
platform_ = platform.processor()
if not platform_:
platform_ = platform.architecture()[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just do this always?

Copy link
Contributor

Choose a reason for hiding this comment

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

The python docs warn of use of platform.architecture()[0] being unreliable in some cases and that sys.maxsize is better. Something like:

arch_bits = int(math.log(sys.maxsize, 2) + 1)

might be a more cross platform way of getting the architecture's bit size.

HTH

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not so cross-platform part of the code, it is Linux-only. Why I'm leaving platform.processor() requests is because most of the people are not facing this issue (or I am wrong and we have many people discussing my bugreport?), so I left default implementation and when it fails - I'm trying different approach.

Copy link
Contributor

Choose a reason for hiding this comment

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

or I am wrong and we have many people discussing my bugreport

Sorry, no - I was doing a bit of github surfing and saw this. I don't have any specific perspective on this, I just spotted it and thought I would comment 😄 - on reflection I don't think my comments are that useful - sorry for the noise.

Cheers,


if platform_ in ["x86_64", "64bit"]:
_add_directory(library_dirs, "/lib64")
_add_directory(library_dirs, "/usr/lib64")
_add_directory(library_dirs, "/usr/lib/x86_64-linux-gnu")
else:
elif platform_ in ["i386", "i686", "32bit"]:
_add_directory(library_dirs, "/usr/lib/i386-linux-gnu")
else:
raise ValueError("Unable to identify Linux platform: `%s`" % platform_)

# XXX Kludge. Above /\ we brute force support multiarch. Here we
# try Barry's more general approach. Afterward, something should
Expand Down