Show More
@@ -119,9 +119,9 b' class CrashHandler(object):' | |||
|
119 | 119 | try: |
|
120 | 120 | rptdir = self.app.ipython_dir |
|
121 | 121 | except: |
|
122 | rptdir = os.getcwd() | |
|
122 | rptdir = os.getcwdu() | |
|
123 | 123 | if rptdir is None or not os.path.isdir(rptdir): |
|
124 | rptdir = os.getcwd() | |
|
124 | rptdir = os.getcwdu() | |
|
125 | 125 | report_name = os.path.join(rptdir,self.crash_report_fname) |
|
126 | 126 | # write the report filename into the instance dict so it can get |
|
127 | 127 | # properly expanded out in the user message template |
@@ -47,7 +47,7 b' class HistoryManager(Configurable):' | |||
|
47 | 47 | dir_hist = List() |
|
48 | 48 | def _dir_hist_default(self): |
|
49 | 49 | try: |
|
50 | return [os.getcwd()] | |
|
50 | return [os.getcwdu()] | |
|
51 | 51 | except OSError: |
|
52 | 52 | return [] |
|
53 | 53 | |
@@ -173,7 +173,7 b' class HistoryManager(Configurable):' | |||
|
173 | 173 | optionally open a new session.""" |
|
174 | 174 | self.output_hist.clear() |
|
175 | 175 | # The directory history can't be completely empty |
|
176 | self.dir_hist[:] = [os.getcwd()] | |
|
176 | self.dir_hist[:] = [os.getcwdu()] | |
|
177 | 177 | |
|
178 | 178 | if new_session: |
|
179 | 179 | if self.session_number: |
@@ -500,7 +500,7 b' class InteractiveShell(SingletonConfigurable, Magic):' | |||
|
500 | 500 | |
|
501 | 501 | # keep track of where we started running (mainly for crash post-mortem) |
|
502 | 502 | # This is not being used anywhere currently. |
|
503 | self.starting_dir = os.getcwd() | |
|
503 | self.starting_dir = os.getcwdu() | |
|
504 | 504 | |
|
505 | 505 | # Indentation management |
|
506 | 506 | self.indent_current_nsp = 0 |
@@ -2673,7 +2673,7 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2673 | 2673 | winext += '|py' |
|
2674 | 2674 | execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE) |
|
2675 | 2675 | isexec = lambda fname:os.path.isfile(fname) and execre.match(fname) |
|
2676 | savedir = os.getcwd() | |
|
2676 | savedir = os.getcwdu() | |
|
2677 | 2677 | |
|
2678 | 2678 | # Now walk the paths looking for executables to alias. |
|
2679 | 2679 | try: |
@@ -2726,7 +2726,7 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2726 | 2726 | In [9]: pwd |
|
2727 | 2727 | Out[9]: '/home/tsuser/sprint/ipython' |
|
2728 | 2728 | """ |
|
2729 | return os.getcwd() | |
|
2729 | return os.getcwdu() | |
|
2730 | 2730 | |
|
2731 | 2731 | @skip_doctest |
|
2732 | 2732 | def magic_cd(self, parameter_s=''): |
@@ -2772,7 +2772,7 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2772 | 2772 | parameter_s = parameter_s.strip() |
|
2773 | 2773 | #bkms = self.shell.persist.get("bookmarks",{}) |
|
2774 | 2774 | |
|
2775 | oldcwd = os.getcwd() | |
|
2775 | oldcwd = os.getcwdu() | |
|
2776 | 2776 | numcd = re.match(r'(-)(\d+)$',parameter_s) |
|
2777 | 2777 | # jump in directory history by number |
|
2778 | 2778 | if numcd: |
@@ -2846,7 +2846,7 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2846 | 2846 | except OSError: |
|
2847 | 2847 | print sys.exc_info()[1] |
|
2848 | 2848 | else: |
|
2849 | cwd = os.getcwd() | |
|
2849 | cwd = os.getcwdu() | |
|
2850 | 2850 | dhist = self.shell.user_ns['_dh'] |
|
2851 | 2851 | if oldcwd != cwd: |
|
2852 | 2852 | dhist.append(cwd) |
@@ -2856,7 +2856,7 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2856 | 2856 | os.chdir(self.shell.home_dir) |
|
2857 | 2857 | if hasattr(self.shell, 'term_title') and self.shell.term_title: |
|
2858 | 2858 | set_term_title('IPython: ' + '~') |
|
2859 | cwd = os.getcwd() | |
|
2859 | cwd = os.getcwdu() | |
|
2860 | 2860 | dhist = self.shell.user_ns['_dh'] |
|
2861 | 2861 | |
|
2862 | 2862 | if oldcwd != cwd: |
@@ -2880,7 +2880,7 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2880 | 2880 | |
|
2881 | 2881 | dir_s = self.shell.dir_stack |
|
2882 | 2882 | tgt = os.path.expanduser(parameter_s) |
|
2883 | cwd = os.getcwd().replace(self.home_dir,'~') | |
|
2883 | cwd = os.getcwdu().replace(self.home_dir,'~') | |
|
2884 | 2884 | if tgt: |
|
2885 | 2885 | self.magic_cd(parameter_s) |
|
2886 | 2886 | dir_s.insert(0,cwd) |
@@ -3145,7 +3145,7 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
3145 | 3145 | if not args: |
|
3146 | 3146 | raise UsageError("%bookmark: You must specify the bookmark name") |
|
3147 | 3147 | elif len(args)==1: |
|
3148 | bkms[args[0]] = os.getcwd() | |
|
3148 | bkms[args[0]] = os.getcwdu() | |
|
3149 | 3149 | elif len(args)==2: |
|
3150 | 3150 | bkms[args[0]] = args[1] |
|
3151 | 3151 | self.db['bookmarks'] = bkms |
@@ -167,7 +167,7 b' class ProfileDir(Configurable):' | |||
|
167 | 167 | is not found, a :class:`ProfileDirError` exception will be raised. |
|
168 | 168 | |
|
169 | 169 | The search path algorithm is: |
|
170 | 1. ``os.getcwd()`` | |
|
170 | 1. ``os.getcwdu()`` | |
|
171 | 171 | 2. ``ipython_dir`` |
|
172 | 172 | |
|
173 | 173 | Parameters |
@@ -224,9 +224,9 b' def str_safe(arg):' | |||
|
224 | 224 | except Exception,msg: |
|
225 | 225 | # let's keep this little duplication here, so that the most common |
|
226 | 226 | # case doesn't suffer from a double try wrapping. |
|
227 | out = '<ERROR: %s>' % msg | |
|
227 | out = '<ERRORx: %s>' % msg | |
|
228 | 228 | except Exception,msg: |
|
229 | out = '<ERROR: %s>' % msg | |
|
229 | out = '<ERRORy: %s>' % msg | |
|
230 | 230 | #raise # dbg |
|
231 | 231 | return out |
|
232 | 232 |
@@ -14,7 +14,7 b' def test_unicode_cwd():' | |||
|
14 | 14 | |
|
15 | 15 | old_wd = os.getcwdu() |
|
16 | 16 | os.chdir(wd) |
|
17 | #raise Exception(repr(os.getcwd())) | |
|
17 | #raise Exception(repr(os.getcwdu())) | |
|
18 | 18 | try: |
|
19 | 19 | app = BaseIPythonApplication() |
|
20 | 20 | # The lines below are copied from Application.initialize() |
@@ -196,7 +196,7 b' class Itpl:' | |||
|
196 | 196 | for live, chunk in self.chunks: |
|
197 | 197 | if live: app(str(eval(chunk,glob,loc))) |
|
198 | 198 | else: app(chunk) |
|
199 | out = ''.join(result) | |
|
199 | out = u''.join(result) | |
|
200 | 200 | try: |
|
201 | 201 | return str(out) |
|
202 | 202 | except UnicodeError: |
@@ -213,6 +213,9 b' class Itpl:' | |||
|
213 | 213 | |
|
214 | 214 | return self._str(glob,loc) |
|
215 | 215 | |
|
216 | def encode(self, encoding, errors): | |
|
217 | return str(self)#.encode(encoding, errors) | |
|
218 | ||
|
216 | 219 | class ItplNS(Itpl): |
|
217 | 220 | """Class representing a string with interpolation abilities. |
|
218 | 221 |
@@ -245,7 +245,7 b' class path(unicode):' | |||
|
245 | 245 | """ Return this path as a relative path, |
|
246 | 246 | based from the current working directory. |
|
247 | 247 | """ |
|
248 | cwd = self.__class__(os.getcwd()) | |
|
248 | cwd = self.__class__(os.getcwdu()) | |
|
249 | 249 | return cwd.relpathto(self) |
|
250 | 250 | |
|
251 | 251 | def relpathto(self, dest): |
@@ -104,7 +104,7 b' def rehashdir_f(self,arg):' | |||
|
104 | 104 | |
|
105 | 105 | execre = re.compile(r'(.*)\.(%s)$' % winext,re.IGNORECASE) |
|
106 | 106 | isexec = lambda fname:os.path.isfile(fname) and execre.match(fname) |
|
107 | savedir = os.getcwd() | |
|
107 | savedir = os.getcwdu() | |
|
108 | 108 | try: |
|
109 | 109 | # write the whole loop for posix/Windows so we don't have an if in |
|
110 | 110 | # the innermost part |
@@ -37,7 +37,7 b' def find_filename(filename):' | |||
|
37 | 37 | filename = "".join(filename) |
|
38 | 38 | |
|
39 | 39 | if not os.path.isabs(filename): |
|
40 | filename = os.path.join(os.getcwd(), filename) | |
|
40 | filename = os.path.join(os.getcwdu(), filename) | |
|
41 | 41 | |
|
42 | 42 | if os.path.isfile(filename): |
|
43 | 43 | return filename |
@@ -33,7 +33,7 b' def workdir_f(ip,line):' | |||
|
33 | 33 | if os.path.isfile(head): |
|
34 | 34 | cmd = os.path.abspath(head) + ' ' + tail |
|
35 | 35 | print "Execute command '" + cmd+ "' in",workdir |
|
36 | olddir = os.getcwd() | |
|
36 | olddir = os.getcwdu() | |
|
37 | 37 | os.chdir(workdir) |
|
38 | 38 | try: |
|
39 | 39 | os.system(cmd) |
@@ -92,7 +92,7 b' class AsyncJobQ(threading.Thread):' | |||
|
92 | 92 | self.output.append(out) |
|
93 | 93 | |
|
94 | 94 | def add(self,cmd): |
|
95 | self.q.put_nowait((cmd, os.getcwd())) | |
|
95 | self.q.put_nowait((cmd, os.getcwdu())) | |
|
96 | 96 | |
|
97 | 97 | def dumpoutput(self): |
|
98 | 98 | while self.output: |
@@ -220,7 +220,7 b' def jobctrl_shellcmd(ip,cmd):' | |||
|
220 | 220 | p = Popen(cmd,shell = True) |
|
221 | 221 | |
|
222 | 222 | jobentry = 'tasks/t' + str(p.pid) |
|
223 | ip.db[jobentry] = (p.pid,cmd,os.getcwd(),time.time()) | |
|
223 | ip.db[jobentry] = (p.pid,cmd,os.getcwdu(),time.time()) | |
|
224 | 224 | p.communicate() |
|
225 | 225 | |
|
226 | 226 | finally: |
@@ -385,7 +385,7 b' def run_iptestall():' | |||
|
385 | 385 | # to clean up any junk files left over by accident. This also makes it |
|
386 | 386 | # robust against being run in non-writeable directories by mistake, as the |
|
387 | 387 | # temp dir will always be user-writeable. |
|
388 | curdir = os.getcwd() | |
|
388 | curdir = os.getcwdu() | |
|
389 | 389 | testdir = tempfile.gettempdir() |
|
390 | 390 | os.chdir(testdir) |
|
391 | 391 |
@@ -250,7 +250,7 b' class DocTestCase(doctests.DocTestCase):' | |||
|
250 | 250 | # Save our current directory and switch out to the one where the |
|
251 | 251 | # test was originally created, in case another doctest did a |
|
252 | 252 | # directory change. We'll restore this in the finally clause. |
|
253 | curdir = os.getcwd() | |
|
253 | curdir = os.getcwdu() | |
|
254 | 254 | #print 'runTest in dir:', self._ori_dir # dbg |
|
255 | 255 | os.chdir(self._ori_dir) |
|
256 | 256 |
@@ -49,7 +49,7 b' class AvoidUNCPath(object):' | |||
|
49 | 49 | os.system(cmd) |
|
50 | 50 | """ |
|
51 | 51 | def __enter__(self): |
|
52 | self.path = os.getcwd() | |
|
52 | self.path = os.getcwdu() | |
|
53 | 53 | self.is_unc_path = self.path.startswith(r"\\") |
|
54 | 54 | if self.is_unc_path: |
|
55 | 55 | # change to c drive (as cmd.exe cannot handle UNC addresses) |
@@ -129,7 +129,7 b' def arg_split(s, posix=False):' | |||
|
129 | 129 | |
|
130 | 130 | def abbrev_cwd(): |
|
131 | 131 | """ Return abbreviated version of cwd, e.g. d:mydir """ |
|
132 | cwd = os.getcwd().replace('\\','/') | |
|
132 | cwd = os.getcwdu().replace('\\','/') | |
|
133 | 133 | drivepart = '' |
|
134 | 134 | tail = cwd |
|
135 | 135 | if sys.platform == 'win32': |
@@ -102,7 +102,7 b" if sys.platform == 'win32':" | |||
|
102 | 102 | |
|
103 | 103 | try: |
|
104 | 104 | # Cannot be on network share when issuing system commands |
|
105 | curr = os.getcwd() | |
|
105 | curr = os.getcwdu() | |
|
106 | 106 | os.chdir("C:") |
|
107 | 107 | ret = os.system("title " + title) |
|
108 | 108 | finally: |
@@ -15,7 +15,7 b" if sys.platform != 'win32':" | |||
|
15 | 15 | oscmd('sphinx-build -b latex -d build/doctrees source build/latex') |
|
16 | 16 | |
|
17 | 17 | # Produce pdf. |
|
18 | topdir = os.getcwd() | |
|
18 | topdir = os.getcwdu() | |
|
19 | 19 | os.chdir('build/latex') |
|
20 | 20 | |
|
21 | 21 | # Change chapter style to section style: allows chapters to start on |
@@ -69,7 +69,7 b" if __name__ == '__main__':" | |||
|
69 | 69 | with open('davinci%i.txt'%i, 'w') as f: |
|
70 | 70 | f.write('\n'.join(chunk)) |
|
71 | 71 | |
|
72 | cwd = os.path.abspath(os.getcwd()) | |
|
72 | cwd = os.path.abspath(os.getcwdu()) | |
|
73 | 73 | fnames = [ os.path.join(cwd, 'davinci%i.txt'%i) for i in range(n)] |
|
74 | 74 | tic = time.time() |
|
75 | 75 | pfreqs = pwordfreq(view,fnames) |
@@ -69,7 +69,7 b' def sh3(cmd):' | |||
|
69 | 69 | def init_repo(path): |
|
70 | 70 | """clone the gh-pages repo if we haven't already.""" |
|
71 | 71 | sh("git clone %s %s"%(pages_repo, path)) |
|
72 | here = os.getcwd() | |
|
72 | here = os.getcwdu() | |
|
73 | 73 | cd(path) |
|
74 | 74 | sh('git checkout gh-pages') |
|
75 | 75 | cd(here) |
@@ -87,7 +87,7 b" if __name__ == '__main__':" | |||
|
87 | 87 | except CalledProcessError: |
|
88 | 88 | tag = "dev" # Fallback |
|
89 | 89 | |
|
90 | startdir = os.getcwd() | |
|
90 | startdir = os.getcwdu() | |
|
91 | 91 | if not os.path.exists(pages_dir): |
|
92 | 92 | # init the repo |
|
93 | 93 | init_repo(pages_dir) |
@@ -16,7 +16,7 b' verbose = False' | |||
|
16 | 16 | |
|
17 | 17 | |
|
18 | 18 | def clone_repo(url, branch): |
|
19 | cwd = os.getcwd() | |
|
19 | cwd = os.getcwdu() | |
|
20 | 20 | tmpdir = tempfile.mkdtemp() |
|
21 | 21 | try: |
|
22 | 22 | cmd = 'git clone %s %s' % (url, tmpdir) |
@@ -18,7 +18,7 b" tar_name = '%s.tgz' % base_name" | |||
|
18 | 18 | # to the top of the tree. There are long threads (since 2007) on the git list |
|
19 | 19 | # about this and it still doesn't work in a sensible way... |
|
20 | 20 | |
|
21 | start_dir = os.getcwd() | |
|
21 | start_dir = os.getcwdu() | |
|
22 | 22 | cd('..') |
|
23 | 23 | git_tpl = 'git archive --format=tar --prefix={0}/ HEAD | gzip > {1}' |
|
24 | 24 | sh(git_tpl.format(base_name, tar_name)) |
General Comments 0
You need to be logged in to leave comments.
Login now