Skip to content

Add option to package DLL files #5103

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 4 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
19 changes: 19 additions & 0 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incidentally, is it preferable to use platform.system? I confess, I've tried in the past to understand what the win32 means, but it always escapes me - as far as I can remember, even 64-bit windows reports win32, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think sys.platform != 'win32' is correct here. The win32 probably refers to the implementation of Python using the Windows API, formerly named Win32. Other Python implementations for Windows, which this patch does not apply to, are using cygwin or cli (.NET).

raise CheckFailed("Microsoft Windows only")

def get_package_data(self):
return {'': ['*.dll']}