1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
5
<key>beforeRunningCommand</key>
8
<string>#!/usr/bin/python
9
"""Generate code to warn about a module's removal in Python 3.0.
12
- Module's in a package do not have their full name generated.
13
- Package's __init__ module; should detect and use the package's name instead.
16
py_template = """from warnings import warnpy3k
17
warnpy3k("the ${1:%s} module has been removed in Python 3.0", stacklevel=2)
21
if (PyErr_WarnPy3k("the ${1:%s} module has been removed in "
22
"Python 3.0", 2) < 0)
29
file_name = os.path.split(os.environ['TM_FILEPATH'])[1]
31
py_suffixes = reversed(sorted((suffix[0] for suffix in imp.get_suffixes() if suffix[2] == imp.PY_SOURCE), key=len))
32
c_suffixes = reversed(sorted((os.path.splitext(suffix[0])[0] + '.c'
33
for suffix in imp.get_suffixes() if suffix[2] == imp.C_EXTENSION), key=len))
35
pairings = ((py_suffixes, py_template), (c_suffixes, c_template))
37
def create_template(suffixes, template):
38
for suffix in suffixes:
39
if not file_name.endswith(suffix):
41
module_name = file_name[:-len(suffix)]
42
return template % module_name
46
for template in (create_template(*pair) for pair in pairings):
52
print 'XXX Could not generate code.'</string>
56
<string>2 to 3 - Module Deletion</string>
58
<string>insertAsSnippet</string>
60
<string>2to3moddel</string>
62
<string>9519C22B-6AB8-41A1-94F6-079E0B45C147</string>