Show More
@@ -306,7 +306,7 b' class SSHLauncher(BaseLauncher):' | |||
|
306 | 306 | program = List(['date'], config=True) |
|
307 | 307 | program_args = List([], config=True) |
|
308 | 308 | hostname = Str('', config=True) |
|
309 |
user = Str( |
|
|
309 | user = Str('', config=True) | |
|
310 | 310 | location = Str('') |
|
311 | 311 | |
|
312 | 312 | def _hostname_changed(self, name, old, new): |
@@ -717,10 +717,17 b' class HomeDirError(Error):' | |||
|
717 | 717 | def get_home_dir(): |
|
718 | 718 | """Return the closest possible equivalent to a 'home' directory. |
|
719 | 719 | |
|
720 | We first try $HOME. Absent that, on NT it's $HOMEDRIVE\$HOMEPATH. | |
|
721 | ||
|
720 | * On POSIX, we try $HOME. | |
|
721 | * On Windows we try: | |
|
722 | - %HOMESHARE% | |
|
723 | - %HOMEDRIVE\%HOMEPATH% | |
|
724 | - %USERPROFILE% | |
|
725 | - Registry hack | |
|
726 | * On Dos C:\ | |
|
727 | ||
|
722 | 728 | Currently only Posix and NT are implemented, a HomeDirError exception is |
|
723 |
raised for all other OSes. |
|
|
729 | raised for all other OSes. | |
|
730 | """ | |
|
724 | 731 | |
|
725 | 732 | isdir = os.path.isdir |
|
726 | 733 | env = os.environ |
@@ -737,50 +744,70 b' def get_home_dir():' | |||
|
737 | 744 | if isdir(os.path.join(root, '_ipython')): |
|
738 | 745 | os.environ["IPYKITROOT"] = root |
|
739 | 746 | return root.decode(sys.getfilesystemencoding()) |
|
740 | try: | |
|
741 | homedir = env['HOME'] | |
|
742 | if not isdir(homedir): | |
|
743 | # in case a user stuck some string which does NOT resolve to a | |
|
744 | # valid path, it's as good as if we hadn't foud it | |
|
745 |
|
|
|
746 | return homedir.decode(sys.getfilesystemencoding()) | |
|
747 | except KeyError: | |
|
748 | if os.name == 'posix': | |
|
749 | raise HomeDirError,'undefined $HOME, IPython can not proceed.' | |
|
750 | elif os.name == 'nt': | |
|
751 |
|
|
|
752 | try: | |
|
753 | homedir = os.path.join(env['HOMEDRIVE'],env['HOMEPATH']) | |
|
754 | if not isdir(homedir): | |
|
755 | homedir = os.path.join(env['USERPROFILE']) | |
|
756 | if not isdir(homedir): | |
|
757 | raise HomeDirError | |
|
747 | ||
|
748 | if os.name == 'posix': | |
|
749 | # Linux, Unix, AIX, OS X | |
|
750 | try: | |
|
751 | homedir = env['HOME'] | |
|
752 | except KeyError: | |
|
753 | raise HomeDirError('Undefined $HOME, IPython cannot proceed.') | |
|
754 | else: | |
|
755 | return homedir.decode(sys.getfilesystemencoding()) | |
|
756 | elif os.name == 'nt': | |
|
757 | # Now for win9x, XP, Vista, 7? | |
|
758 | # For some strange reason all of these return 'nt' for os.name. | |
|
759 | # First look for a network home directory. This will return the UNC | |
|
760 | # path (\\server\\Users\%username%) not the mapped path (Z:\). This | |
|
761 | # is needed when running IPython on cluster where all paths have to | |
|
762 | # be UNC. | |
|
763 | try: | |
|
764 | homedir = env['HOMESHARE'] | |
|
765 | except KeyError: | |
|
766 | pass | |
|
767 | else: | |
|
768 | if isdir(homedir): | |
|
758 | 769 | return homedir.decode(sys.getfilesystemencoding()) |
|
759 | except KeyError: | |
|
760 | try: | |
|
761 | # Use the registry to get the 'My Documents' folder. | |
|
762 | import _winreg as wreg | |
|
763 | key = wreg.OpenKey(wreg.HKEY_CURRENT_USER, | |
|
764 | "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders") | |
|
765 | homedir = wreg.QueryValueEx(key,'Personal')[0] | |
|
766 | key.Close() | |
|
767 | if not isdir(homedir): | |
|
768 | e = ('Invalid "Personal" folder registry key ' | |
|
769 | 'typically "My Documents".\n' | |
|
770 | 'Value: %s\n' | |
|
771 | 'This is not a valid directory on your system.' % | |
|
772 | homedir) | |
|
773 | raise HomeDirError(e) | |
|
774 | return homedir.decode(sys.getfilesystemencoding()) | |
|
775 | except HomeDirError: | |
|
776 | raise | |
|
777 | except: | |
|
778 | return 'C:\\'.decode(sys.getfilesystemencoding()) | |
|
779 | elif os.name == 'dos': | |
|
780 | # Desperate, may do absurd things in classic MacOS. May work under DOS. | |
|
781 | return 'C:\\'.decode(sys.getfilesystemencoding()) | |
|
770 | ||
|
771 | # Now look for a local home directory | |
|
772 | try: | |
|
773 | homedir = os.path.join(env['HOMEDRIVE'],env['HOMEPATH']) | |
|
774 | except KeyError: | |
|
775 | pass | |
|
782 | 776 | else: |
|
783 | raise HomeDirError,'support for your operating system not implemented.' | |
|
777 | if isdir(homedir): | |
|
778 | return homedir.decode(sys.getfilesystemencoding()) | |
|
779 | ||
|
780 | # Now the users profile directory | |
|
781 | try: | |
|
782 | homedir = os.path.join(env['USERPROFILE']) | |
|
783 | except KeyError: | |
|
784 | pass | |
|
785 | else: | |
|
786 | if isdir(homedir): | |
|
787 | return homedir.decode(sys.getfilesystemencoding()) | |
|
788 | ||
|
789 | # Use the registry to get the 'My Documents' folder. | |
|
790 | try: | |
|
791 | import _winreg as wreg | |
|
792 | key = wreg.OpenKey( | |
|
793 | wreg.HKEY_CURRENT_USER, | |
|
794 | "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" | |
|
795 | ) | |
|
796 | homedir = wreg.QueryValueEx(key,'Personal')[0] | |
|
797 | key.Close() | |
|
798 | except: | |
|
799 | pass | |
|
800 | else: | |
|
801 | if isdir(homedir): | |
|
802 | return homedir.decode(sys.getfilesystemencoding()) | |
|
803 | ||
|
804 | # If all else fails, raise HomeDirError | |
|
805 | raise HomeDirError('No valid home directory could be found') | |
|
806 | elif os.name == 'dos': | |
|
807 | # Desperate, may do absurd things in classic MacOS. May work under DOS. | |
|
808 | return 'C:\\'.decode(sys.getfilesystemencoding()) | |
|
809 | else: | |
|
810 | raise HomeDirError('No valid home directory could be found for your OS') | |
|
784 | 811 | |
|
785 | 812 | |
|
786 | 813 | def get_ipython_dir(): |
@@ -119,8 +119,8 b' def find_packages():' | |||
|
119 | 119 | add_package(packages, 'frontend.wx') |
|
120 | 120 | add_package(packages, 'gui') |
|
121 | 121 | add_package(packages, 'gui.wx') |
|
122 |
add_package(packages, 'kernel', config= |
|
|
123 |
add_package(packages, 'kernel.core', config= |
|
|
122 | add_package(packages, 'kernel', config=False, tests=True, scripts=True) | |
|
123 | add_package(packages, 'kernel.core', config=False, tests=True) | |
|
124 | 124 | add_package(packages, 'lib', tests=True) |
|
125 | 125 | add_package(packages, 'quarantine', tests=True) |
|
126 | 126 | add_package(packages, 'scripts') |
General Comments 0
You need to be logged in to leave comments.
Login now