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 the libraries are not found. Webpmux (WebP metadata) relies on WebP
support. Tcl and Tk also must be used together. 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 library search process to dump all paths searched for and found to
stdout. 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 ('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 ('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): def initialize_options(self):
self.disable_platform_guessing = None
build_ext.initialize_options(self) build_ext.initialize_options(self)
for x in self.feature: for x in self.feature:
setattr(self, 'disable_%s' % x, None) setattr(self, 'disable_%s' % x, None)
@ -220,7 +224,10 @@ class pil_build_ext(build_ext):
# #
# add platform directories # 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 # pythonX.Y.dll.a is in the /usr/lib/pythonX.Y/config directory
_add_directory(library_dirs, _add_directory(library_dirs,
os.path.join("/usr/lib", "python%s" % os.path.join("/usr/lib", "python%s" %
@ -382,11 +389,13 @@ class pil_build_ext(build_ext):
# look for tcl specific subdirectory (e.g debian) # look for tcl specific subdirectory (e.g debian)
if _tkinter: if _tkinter:
if not self.disable_platform_guessing:
tcl_dir = "/usr/include/tcl" + TCL_VERSION tcl_dir = "/usr/include/tcl" + TCL_VERSION
if os.path.isfile(os.path.join(tcl_dir, "tk.h")): if os.path.isfile(os.path.join(tcl_dir, "tk.h")):
_add_directory(include_dirs, tcl_dir) _add_directory(include_dirs, tcl_dir)
# standard locations # standard locations
if not self.disable_platform_guessing:
_add_directory(library_dirs, "/usr/local/lib") _add_directory(library_dirs, "/usr/local/lib")
_add_directory(include_dirs, "/usr/local/include") _add_directory(include_dirs, "/usr/local/include")