diff options
author | Tor Norbye <tnorbye@google.com> | 2014-08-20 17:01:23 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2014-08-20 17:01:23 -0700 |
commit | 1aa2e09bdbd413eacb677e9fa4b50630530d0656 (patch) | |
tree | 2f4cc6d69645bd460aa253fdecb606d764fbd25d /python/helpers/pydev/_pydev_execfile.py | |
parent | 02cf98d65c798d368fcec43ed64a001d513bdd4f (diff) | |
download | idea-1aa2e09bdbd413eacb677e9fa4b50630530d0656.tar.gz |
Snapshot idea/138.1696 from git://git.jetbrains.org/idea/community.git
Change-Id: I50c97b83a815ce635e49a38380ba5b8765e4b16a
Diffstat (limited to 'python/helpers/pydev/_pydev_execfile.py')
-rw-r--r-- | python/helpers/pydev/_pydev_execfile.py | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/python/helpers/pydev/_pydev_execfile.py b/python/helpers/pydev/_pydev_execfile.py deleted file mode 100644 index d60d7ed94bb0..000000000000 --- a/python/helpers/pydev/_pydev_execfile.py +++ /dev/null @@ -1,38 +0,0 @@ -#We must redefine it in Py3k if it's not already there -def execfile(file, glob=None, loc=None): - if glob is None: - import sys - glob = sys._getframe().f_back.f_globals - if loc is None: - loc = glob - stream = open(file, 'rb') - try: - encoding = None - #Get encoding! - for _i in range(2): - line = stream.readline() #Should not raise an exception even if there are no more contents - #Must be a comment line - if line.strip().startswith(b'#'): - #Don't import re if there's no chance that there's an encoding in the line - if b'coding' in line: - import re - p = re.search(br"coding[:=]\s*([-\w.]+)", line) - if p: - try: - encoding = p.group(1).decode('ascii') - break - except: - encoding = None - finally: - stream.close() - - if encoding: - stream = open(file, encoding=encoding) - else: - stream = open(file) - try: - contents = stream.read() - finally: - stream.close() - - exec(compile(contents+"\n", file, 'exec'), glob, loc) #execute the script
\ No newline at end of file |