-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Pull Request Suggestion for #4062 #4094
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
Changes from all commits
c731dab
444bc5f
5a8275d
f7d4604
e532e97
b252e49
b18df27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
The objective of this Pull Request is to make installation more robust on mac's regarding freetype paths | ||
|
||
Analysis on existing commit(master 8f10470): | ||
+ Setup.py has a list of pre-requisit packages "mpl_packages." | ||
+ A for loop after "__main__" check goes through this list. | ||
+ If package.check() returns a value other than None, setup recognizes that package. | ||
|
||
+ Setupext.py has a class for Freetype incluidng check(). | ||
+ FreeType check() method searches for a header file name "ft2build.h." | ||
|
||
+ On mac, FreeType check() method works as follows. | ||
++ Using "freetype-config --ftversion" command, check version. | ||
++ check() returns the return value from _check_for_pkg_config(). | ||
|
||
+++ _check_for_pkg_config() belongs to superclass SetupPackage of setupext.py | ||
+++ _check_for_pkg_config() calls self.get_extension() to obtain ext object | ||
Here, because FreeType doesn't overload get_extension() method, | ||
calls SetupPackage.get_extension() returning None | ||
+++ Then, _check_for_pkg_config() calls make_extension('test', []) for ext object | ||
whose include_dirs covers | ||
['/usr/local/include', '/usr/include', '/usr/X11/include', '/opt/X11/include', '.'] | ||
+++ _check_for_pkg_config() returns result from check_include_file() | ||
|
||
++++ check_include_file() searches for include files within paths in ext.include_dirs | ||
++++ check_include_file() calls has_include_file(include_dirs, filename) | ||
+++++ has_include_file(include_dirs, filename) searches for following files | ||
/usr/local/include/ft2build.h | ||
/usr/include/ft2build.h | ||
/usr/X11/include/ft2build.h | ||
/opt/X11/include/ft2build.h | ||
./ft2build.h | ||
+++++ possible locations are | ||
/opt/X11/include/freetype2 | ||
/usr/local/include/freetype2 | ||
|
||
++ Hence, it could be more desirable if FreeType get_extension() could return | ||
an ext object with include_dirs information about paths above |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -933,6 +933,20 @@ def add_flags(self, ext): | |
default_libraries=['freetype', 'z']) | ||
|
||
|
||
def get_extension(self): | ||
sources = [] | ||
include_dirs = ['include/freetype2', 'freetype2', | ||
'lib/freetype2/include', | ||
'lib/freetype2/include/freetype2', | ||
'/opt/X11/include/freetype2', # mac osx X window installation | ||
'/usr/local/include/freetype2' # ref : http://stackoverflow.com/questions/4092994/unable-to-install-matplotlib-on-mac-os-x | ||
] | ||
ext = make_extension('matplotlib.freetype', sources, | ||
include_dirs = include_dirs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit : no spaces around There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean like this, for example? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. exactly edit: just for |
||
Numpy().add_flags(ext) | ||
return ext | ||
|
||
|
||
class FT2Font(SetupPackage): | ||
name = 'ft2font' | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import setupext | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please put this in the testing directory with the rest of the tests? We use nose every where else instead of unit test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See http://matplotlib.org/devel/testing.html and all of the existing tests. |
||
import unittest | ||
from pprint import pprint | ||
reload(setupext) | ||
|
||
class testFreetypeRobustInstallation (unittest.TestCase): | ||
def setUp(self): | ||
self.ft = setupext.FreeType() | ||
|
||
def test_check(self): | ||
self.assertEqual(r"version 2.5.5", self.ft.check()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only actual test in this as far as I can tell... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was planning to add more lines to the test_*() methods below. |
||
|
||
def test_get_extension(self): | ||
'''test FreeType get_extension() for returnedn .include_dirs''' | ||
print "test_get_extension ".ljust(60, '+') | ||
ext = self.ft.get_extension() | ||
print "ext.include_dirs ".ljust(30, '+') | ||
pprint (ext.include_dirs) | ||
|
||
def test_make_extension(self): | ||
ext = setupext.make_extension('test', []) | ||
print "test_make_extension ".ljust(60, '*') | ||
print ext.include_dirs | ||
|
||
def tearDown(self): | ||
del self.ft | ||
|
||
if "__main__" == __name__: | ||
unittest.main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useful information, but should not go into the repo as a tracked file. This seems better suited as a commit message or comments in the code.