提交 9c92ff18 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Merge pull request #118 from gwtaylor/master

Modified OSX fix to also support Enthought Python Distribution (EPD)
...@@ -287,8 +287,10 @@ def remove_python_framework_dir(cmd): ...@@ -287,8 +287,10 @@ def remove_python_framework_dir(cmd):
# http://groups.google.com/group/theano-users/browse_thread/thread/c84bfe31bb411493 # http://groups.google.com/group/theano-users/browse_thread/thread/c84bfe31bb411493
# It was improved later following a bug report by Benjamin Hamner: # It was improved later following a bug report by Benjamin Hamner:
# https://groups.google.com/group/theano-users/browse_thread/thread/374ec2dadd3ac369/024e2be792f98d86 # https://groups.google.com/group/theano-users/browse_thread/thread/374ec2dadd3ac369/024e2be792f98d86
# It was modified by Graham Taylor to support Enthought Python Distribution
# 7.x (32 and 64 bit)
# TODO It is a bit hack-ish, is it possible to find a more generic fix? # TODO It is a bit hack-ish, is it possible to find a more generic fix?
fwk_pattern = 'Python.framework/Versions/2\.[0-9]/Python$' fwk_pattern = '(Python|EPD64).framework/Versions/(2\.[0-9]|7\.[0-9])/Python$'
rval = [element for element in cmd rval = [element for element in cmd
if (re.search(fwk_pattern, element) is None if (re.search(fwk_pattern, element) is None
# Keep this element if it turns out to be part of an argument # Keep this element if it turns out to be part of an argument
......
...@@ -25,8 +25,10 @@ def test_remove_python_framework_dir(): ...@@ -25,8 +25,10 @@ def test_remove_python_framework_dir():
# as otherwise it is difficult to do it properly. # as otherwise it is difficult to do it properly.
try: try:
warnings.catch_warnings warnings.catch_warnings
test_warning = True
except AttributeError: except AttributeError:
return test_warning = False
if test_warning:
cmd.append('Frameworks/Python.framework/Versions/2.6/Python') cmd.append('Frameworks/Python.framework/Versions/2.6/Python')
# Python 2.4 "emulation" of `with` statement. It is necessary even if this # Python 2.4 "emulation" of `with` statement. It is necessary even if this
# code is not executed, because using `with` would result in a SyntaxError. # code is not executed, because using `with` would result in a SyntaxError.
...@@ -38,3 +40,11 @@ def test_remove_python_framework_dir(): ...@@ -38,3 +40,11 @@ def test_remove_python_framework_dir():
assert 'remove_python_framework_dir' in str(record[0].message) assert 'remove_python_framework_dir' in str(record[0].message)
finally: finally:
with_context.__exit__(None, None, None) with_context.__exit__(None, None, None)
# Now test some more typical arguments that should be caught by the regex.
for arg_to_remove in [
'/Library/Frameworks/EPD64.framework/Versions/7.1/Python',
'/Library/Frameworks/Python.framework/Versions/7.2/Python',
]:
# Make sure those arguments are removed.
assert not remove_python_framework_dir([arg_to_remove])
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论