Skip to content

windows dlls packaging #5348

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

Merged
merged 5 commits into from
Oct 29, 2015
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions setup.cfg.template
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,9 @@
#
#backend = Agg
#

[package_data]
# Package additional files found in the lib/matplotlib directories.
#
# On Windows, package DLL files.
#dlls = True
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@
setupext.DviPng(),
setupext.Ghostscript(),
setupext.LaTeX(),
setupext.PdfToPs()
setupext.PdfToPs(),
'Optional package data',
setupext.Dlls(),
]


Expand Down
31 changes: 31 additions & 0 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -2165,3 +2165,34 @@ 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']}

@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