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

Disable-platform-guessing in setup.py #1875

Merged
merged 3 commits into from May 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion docs/installation.rst
Expand Up @@ -202,7 +202,12 @@ Build Options
the libraries are not found. Webpmux (WebP metadata) relies on WebP
support. Tcl and Tk also must be used together.

* Build flags: ``--debug``. Adds a debugging flag to the include and
* Build flag: ``--disable-platform-guessing``. Skips all of the
platform dependent guessing of include and library directories for
automated build systems that configure the proper paths in the
environment variables (e.g. Buildroot).

* Build flag: ``--debug``. Adds a debugging flag to the include and
library search process to dump all paths searched for and found to
stdout.

Expand Down
35 changes: 22 additions & 13 deletions setup.py
Expand Up @@ -146,9 +146,13 @@ def __iter__(self):
('disable-%s' % x, None, 'Disable support for %s' % x) for x in feature
] + [
('enable-%s' % x, None, 'Enable support for %s' % x) for x in feature
] + [('debug', None, 'Debug logging')]
] + [
('disable-platform-guessing', None, 'Disable platform guessing on Linux'),
('debug', None, 'Debug logging')
]

def initialize_options(self):
self.disable_platform_guessing = None
build_ext.initialize_options(self)
for x in self.feature:
setattr(self, 'disable_%s' % x, None)
Expand Down Expand Up @@ -220,7 +224,10 @@ def build_extensions(self):
#
# add platform directories

if sys.platform == "cygwin":
if self.disable_platform_guessing:
pass

elif sys.platform == "cygwin":
# pythonX.Y.dll.a is in the /usr/lib/pythonX.Y/config directory
_add_directory(library_dirs,
os.path.join("/usr/lib", "python%s" %
Expand Down Expand Up @@ -318,10 +325,10 @@ def build_extensions(self):
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
# work ;-)
self.add_multiarch_paths()
# XXX Kludge. Above /\ we brute force support multiarch. Here we
# try Barry's more general approach. Afterward, something should
# work ;-)
self.add_multiarch_paths()

elif sys.platform.startswith("gnu"):
self.add_multiarch_paths()
Expand Down Expand Up @@ -382,16 +389,18 @@ def build_extensions(self):

# look for tcl specific subdirectory (e.g debian)
if _tkinter:
tcl_dir = "/usr/include/tcl" + TCL_VERSION
if os.path.isfile(os.path.join(tcl_dir, "tk.h")):
_add_directory(include_dirs, tcl_dir)
if not self.disable_platform_guessing:
tcl_dir = "/usr/include/tcl" + TCL_VERSION
if os.path.isfile(os.path.join(tcl_dir, "tk.h")):
_add_directory(include_dirs, tcl_dir)

# standard locations
_add_directory(library_dirs, "/usr/local/lib")
_add_directory(include_dirs, "/usr/local/include")
if not self.disable_platform_guessing:
_add_directory(library_dirs, "/usr/local/lib")
_add_directory(include_dirs, "/usr/local/include")

_add_directory(library_dirs, "/usr/lib")
_add_directory(include_dirs, "/usr/include")
_add_directory(library_dirs, "/usr/lib")
_add_directory(include_dirs, "/usr/include")

# on Windows, look for the OpenJPEG libraries in the location that
# the official installer puts them
Expand Down