mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Merge pull request #1340 from radarhere/osx_tk_tcl
Allow Tcl/Tk frameworks to be disabled on OS X by setup arguments
This commit is contained in:
commit
5f367e5764
51
setup.py
51
setup.py
|
@ -464,7 +464,7 @@ class pil_build_ext(build_ext):
|
||||||
if _find_library_file(self, "lcms2"):
|
if _find_library_file(self, "lcms2"):
|
||||||
feature.lcms = "lcms2"
|
feature.lcms = "lcms2"
|
||||||
elif _find_library_file(self, "lcms2_static"):
|
elif _find_library_file(self, "lcms2_static"):
|
||||||
#alternate Windows name.
|
# alternate Windows name.
|
||||||
feature.lcms = "lcms2_static"
|
feature.lcms = "lcms2_static"
|
||||||
|
|
||||||
if _tkinter and _find_include_file(self, "tk.h"):
|
if _tkinter and _find_include_file(self, "tk.h"):
|
||||||
|
@ -571,32 +571,33 @@ class pil_build_ext(build_ext):
|
||||||
exts.append(Extension(
|
exts.append(Extension(
|
||||||
"PIL._webp", ["_webp.c"], libraries=libs, define_macros=defs))
|
"PIL._webp", ["_webp.c"], libraries=libs, define_macros=defs))
|
||||||
|
|
||||||
if sys.platform == "darwin":
|
if feature.tcl and feature.tk:
|
||||||
# locate Tcl/Tk frameworks
|
if sys.platform == "darwin":
|
||||||
frameworks = []
|
# locate Tcl/Tk frameworks
|
||||||
framework_roots = [
|
frameworks = []
|
||||||
"/Library/Frameworks",
|
framework_roots = [
|
||||||
"/System/Library/Frameworks"]
|
"/Library/Frameworks",
|
||||||
for root in framework_roots:
|
"/System/Library/Frameworks"]
|
||||||
if (
|
for root in framework_roots:
|
||||||
os.path.exists(os.path.join(root, "Tcl.framework")) and
|
root_tcl = os.path.join(root, "Tcl.framework")
|
||||||
os.path.exists(os.path.join(root, "Tk.framework"))):
|
root_tk = os.path.join(root, "Tk.framework")
|
||||||
print("--- using frameworks at %s" % root)
|
if (os.path.exists(root_tcl) and os.path.exists(root_tk)):
|
||||||
frameworks = ["-framework", "Tcl", "-framework", "Tk"]
|
print("--- using frameworks at %s" % root)
|
||||||
dir = os.path.join(root, "Tcl.framework", "Headers")
|
frameworks = ["-framework", "Tcl", "-framework", "Tk"]
|
||||||
_add_directory(self.compiler.include_dirs, dir, 0)
|
dir = os.path.join(root_tcl, "Headers")
|
||||||
dir = os.path.join(root, "Tk.framework", "Headers")
|
_add_directory(self.compiler.include_dirs, dir, 0)
|
||||||
_add_directory(self.compiler.include_dirs, dir, 1)
|
dir = os.path.join(root_tk, "Headers")
|
||||||
break
|
_add_directory(self.compiler.include_dirs, dir, 1)
|
||||||
if frameworks:
|
break
|
||||||
|
if frameworks:
|
||||||
|
exts.append(Extension(
|
||||||
|
"PIL._imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"],
|
||||||
|
extra_compile_args=frameworks,
|
||||||
|
extra_link_args=frameworks))
|
||||||
|
else:
|
||||||
exts.append(Extension(
|
exts.append(Extension(
|
||||||
"PIL._imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"],
|
"PIL._imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"],
|
||||||
extra_compile_args=frameworks, extra_link_args=frameworks))
|
libraries=[feature.tcl, feature.tk]))
|
||||||
feature.tcl = feature.tk = 1 # mark as present
|
|
||||||
elif feature.tcl and feature.tk:
|
|
||||||
exts.append(Extension(
|
|
||||||
"PIL._imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"],
|
|
||||||
libraries=[feature.tcl, feature.tk]))
|
|
||||||
|
|
||||||
if os.path.isfile("_imagingmath.c"):
|
if os.path.isfile("_imagingmath.c"):
|
||||||
exts.append(Extension("PIL._imagingmath", ["_imagingmath.c"]))
|
exts.append(Extension("PIL._imagingmath", ["_imagingmath.c"]))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user