From e05f492147f622789bcafbf9c6900e5cc35a7146 Mon Sep 17 00:00:00 2001 From: Christoph Gohlke Date: Fri, 18 Sep 2015 14:32:24 -0700 Subject: [PATCH 1/5] Add build option to package DLL files --- setup.cfg.template | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/setup.cfg.template b/setup.cfg.template index 09fd92f7134e..9d50b4441582 100644 --- a/setup.cfg.template +++ b/setup.cfg.template @@ -83,3 +83,9 @@ # #backend = Agg # + +[package_data] +# Package additional files found in the lib/matplotlib directories. +# +# On Windows, package DLL files. +#dlls = True From 9a1ac18d316a39e034678f1c934e2aac4221319f Mon Sep 17 00:00:00 2001 From: Christoph Gohlke Date: Fri, 18 Sep 2015 14:38:14 -0700 Subject: [PATCH 2/5] Add OptionalPackageData class to package DLL files --- setupext.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/setupext.py b/setupext.py index 3011bf9e9834..b26c2d2cb92d 100755 --- a/setupext.py +++ b/setupext.py @@ -2165,3 +2165,22 @@ def check(self): pass raise CheckFailed() + + +class OptionalPackageData(OptionalPackage): + config_category = "package_data" + + +class Dlls(OptionalPackageData): + """ + On Windows, this packages any DLL files that can be found in the + lib/matplotlib/* directories. + """ + name = "dlls" + + def check_requirements(self): + if sys.platform != 'win32': + raise CheckFailed("Microsoft Windows only") + + def get_package_data(self): + return {'': ['*.dll']} From 95d90e80cc6572082d3ffb287aa57380c5780772 Mon Sep 17 00:00:00 2001 From: Christoph Gohlke Date: Fri, 18 Sep 2015 14:41:35 -0700 Subject: [PATCH 3/5] Register class to package DLLs --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index b896f6f84c11..be5bc855bff8 100644 --- a/setup.py +++ b/setup.py @@ -111,6 +111,8 @@ setupext.Ghostscript(), setupext.LaTeX(), setupext.PdfToPs() + 'Optional package data', + setupext.Dlls(), ] From edd1faf4ddcd3173f7b3f7297f0ad9a9d27097a6 Mon Sep 17 00:00:00 2001 From: Christoph Gohlke Date: Fri, 18 Sep 2015 14:57:05 -0700 Subject: [PATCH 4/5] Fix invalid syntax --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index be5bc855bff8..392ed2c8c28b 100644 --- a/setup.py +++ b/setup.py @@ -110,7 +110,7 @@ setupext.DviPng(), setupext.Ghostscript(), setupext.LaTeX(), - setupext.PdfToPs() + setupext.PdfToPs(), 'Optional package data', setupext.Dlls(), ] From 0263ad4a14ca44b8bf39e70fa962a21efc0dfda0 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Thu, 29 Oct 2015 10:00:57 -0400 Subject: [PATCH 5/5] MNT: Consult config about bundling dlls Defaults to not (current behavior) --- setupext.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/setupext.py b/setupext.py index b26c2d2cb92d..33b4a5c30f58 100755 --- a/setupext.py +++ b/setupext.py @@ -2173,7 +2173,7 @@ class OptionalPackageData(OptionalPackage): class Dlls(OptionalPackageData): """ - On Windows, this packages any DLL files that can be found in the + On Windows, this packages any DLL files that can be found in the lib/matplotlib/* directories. """ name = "dlls" @@ -2184,3 +2184,15 @@ def check_requirements(self): def get_package_data(self): return {'': ['*.dll']} + + @classmethod + def get_config(cls): + """ + Look at `setup.cfg` and return one of ["auto", True, False] indicating + if the package is at default state ("auto"), forced by the user (True) + or opted-out (False). + """ + try: + return config.getboolean(cls.config_category, cls.name) + except: + return False # <-- default