Merge pull request #1875 from wiredfool/pr_1861

Disable-platform-guessing in setup.py
This commit is contained in:
wiredfool 2016-05-03 19:53:09 +01:00
commit db4b41e78f
2 changed files with 28 additions and 14 deletions

View File

@ -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.

View File

@ -146,9 +146,13 @@ class pil_build_ext(build_ext):
('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)
@ -220,7 +224,10 @@ class pil_build_ext(build_ext):
#
# 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" %
@ -318,10 +325,10 @@ class pil_build_ext(build_ext):
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()
@ -382,16 +389,18 @@ class pil_build_ext(build_ext):
# 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