##// END OF EJS Templates
Fix for py2exe when using uncompressed lib/
Jorgen Stenarson -
Show More
@@ -928,12 +928,17 b' def get_home_dir():'
928 # first, check py2exe distribution root directory for _ipython.
928 # first, check py2exe distribution root directory for _ipython.
929 # This overrides all. Normally does not exist.
929 # This overrides all. Normally does not exist.
930
930
931 if '\\library.zip\\' in IPython.__file__.lower():
931 if hasattr(sys, "frozen"): #Is frozen by py2exe
932 root, rest = IPython.__file__.lower().split('library.zip')
932 if '\\library.zip\\' in IPython.__file__.lower():#libraries compressed to zip-file
933 if isdir(root + '_ipython'):
933 root, rest = IPython.__file__.lower().split('library.zip')
934 if isdir(root + '_ipython'):
935 os.environ["IPYKITROOT"] = root.rstrip('\\')
936 return root
937 else:
938 root=os.path.abspath(os.path.join(os.path.split(IPython.__file__)[0],"../../"))
939 if isdir(os.path.join(root, '_ipython')):
934 os.environ["IPYKITROOT"] = root.rstrip('\\')
940 os.environ["IPYKITROOT"] = root.rstrip('\\')
935 return root
941 return root
936
937 try:
942 try:
938 homedir = env['HOME']
943 homedir = env['HOME']
939 if not isdir(homedir):
944 if not isdir(homedir):
@@ -16,12 +16,26 b' __docformat__ = "restructuredtext en"'
16 #-----------------------------------------------------------------------------
16 #-----------------------------------------------------------------------------
17
17
18 from IPython import genutils
18 from IPython import genutils
19 import os
20 env = os.environ
19
21
20
22
21 def test_get_home_dir():
23 def test_get_home_dir_1():
22 """Make sure we can get the home directory."""
24 """Make sure we can get the home directory."""
23 home_dir = genutils.get_home_dir()
25 home_dir = genutils.get_home_dir()
24
26
27 def test_get_home_dir_2():
28 """Make sure we can get the home directory."""
29 old=env["HOME"]
30 env["HOME"]=os.path.join(".","home_test_dir")
31 home_dir = genutils.get_home_dir()
32 assert home_dir==env["HOME"]
33 env["HOME"]=old
34
35
36
37
38
25 def test_get_ipython_dir():
39 def test_get_ipython_dir():
26 """Make sure we can get the ipython directory."""
40 """Make sure we can get the ipython directory."""
27 ipdir = genutils.get_ipython_dir()
41 ipdir = genutils.get_ipython_dir()
General Comments 0
You need to be logged in to leave comments. Login now