From 34f18fd7f00b4a0c58e09309918f90b4eb7b5b0b Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Tue, 6 May 2008 23:44:04 +0000 Subject: [PATCH] Create a TextMate directory in Misc to house a Python-Dev bundle. --- .../2 to 3 - Module Deletion.tmCommand | 38 +++++++++++++++++++ .../Commands/Build Docs.tmCommand | 23 +++++++++++ .../Commands/Build.tmCommand | 25 ++++++++++++ .../Commands/Go to Issue.tmCommand | 20 ++++++++++ .../Commands/Open Docs.tmCommand | 32 ++++++++++++++++ .../Commands/Open PEP.tmCommand | 23 +++++++++++ Misc/TextMate/Python-Dev.tmbundle/info.plist | 33 ++++++++++++++++ 7 files changed, 194 insertions(+) create mode 100644 Misc/TextMate/Python-Dev.tmbundle/Commands/2 to 3 - Module Deletion.tmCommand create mode 100644 Misc/TextMate/Python-Dev.tmbundle/Commands/Build Docs.tmCommand create mode 100644 Misc/TextMate/Python-Dev.tmbundle/Commands/Build.tmCommand create mode 100644 Misc/TextMate/Python-Dev.tmbundle/Commands/Go to Issue.tmCommand create mode 100644 Misc/TextMate/Python-Dev.tmbundle/Commands/Open Docs.tmCommand create mode 100644 Misc/TextMate/Python-Dev.tmbundle/Commands/Open PEP.tmCommand create mode 100644 Misc/TextMate/Python-Dev.tmbundle/info.plist diff --git a/Misc/TextMate/Python-Dev.tmbundle/Commands/2 to 3 - Module Deletion.tmCommand b/Misc/TextMate/Python-Dev.tmbundle/Commands/2 to 3 - Module Deletion.tmCommand new file mode 100644 index 00000000000..31b88377bae --- /dev/null +++ b/Misc/TextMate/Python-Dev.tmbundle/Commands/2 to 3 - Module Deletion.tmCommand @@ -0,0 +1,38 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/python + +template = """from warnings import warnpy3k +warnpy3k("the ${1:%s} module has been removed in Python 3.0", stacklevel=2) +del warnpy3k +$0""" + +import imp +import os + +file_name = os.path.split(os.environ['TM_FILEPATH'])[1] +for suffix in (tuple_[0] for tuple_ in imp.get_suffixes()): + if not file_name.endswith(suffix): + continue + module_name = file_name[:-len(suffix)] + print (template % module_name), + break +else: + print (template % "XXX"), + input + none + name + 2 to 3 - Module Deletion + output + insertAsSnippet + tabTrigger + 2to3moddel + uuid + 9519C22B-6AB8-41A1-94F6-079E0B45C147 + + diff --git a/Misc/TextMate/Python-Dev.tmbundle/Commands/Build Docs.tmCommand b/Misc/TextMate/Python-Dev.tmbundle/Commands/Build Docs.tmCommand new file mode 100644 index 00000000000..7e4d53b2106 --- /dev/null +++ b/Misc/TextMate/Python-Dev.tmbundle/Commands/Build Docs.tmCommand @@ -0,0 +1,23 @@ + + + + + beforeRunningCommand + nop + command + # XXX Leopard-specific unless have easy way to specific alternative Python executable. + +cd $TM_PROJECT_DIRECTORY/Doc +make html 2>&1 | pre + +rescan_project + input + none + name + Build Docs + output + showAsHTML + uuid + 6EF151E5-7149-4F82-8796-0CC40FE589FA + + diff --git a/Misc/TextMate/Python-Dev.tmbundle/Commands/Build.tmCommand b/Misc/TextMate/Python-Dev.tmbundle/Commands/Build.tmCommand new file mode 100644 index 00000000000..6ffda5cdd0d --- /dev/null +++ b/Misc/TextMate/Python-Dev.tmbundle/Commands/Build.tmCommand @@ -0,0 +1,25 @@ + + + + + beforeRunningCommand + nop + command + # XXX TODO +# - Highlight any compiler warnings for Python code. +# - Point out if compile failed. + +cd $TM_PROJECT_DIRECTORY +make -s -j2 2>&1 | pre + +rescan_project + input + none + name + Build Python + output + showAsHTML + uuid + B545BB1B-A8E1-426C-B50A-426E78B96D38 + + diff --git a/Misc/TextMate/Python-Dev.tmbundle/Commands/Go to Issue.tmCommand b/Misc/TextMate/Python-Dev.tmbundle/Commands/Go to Issue.tmCommand new file mode 100644 index 00000000000..65d30bc7283 --- /dev/null +++ b/Misc/TextMate/Python-Dev.tmbundle/Commands/Go to Issue.tmCommand @@ -0,0 +1,20 @@ + + + + + beforeRunningCommand + nop + command + open "http://bugs.python.org/issue$(cat)" + fallbackInput + word + input + selection + name + Go to Issue + output + discard + uuid + FD25A8DC-22DC-4ED4-B222-B943C8A9117D + + diff --git a/Misc/TextMate/Python-Dev.tmbundle/Commands/Open Docs.tmCommand b/Misc/TextMate/Python-Dev.tmbundle/Commands/Open Docs.tmCommand new file mode 100644 index 00000000000..501be43ab2d --- /dev/null +++ b/Misc/TextMate/Python-Dev.tmbundle/Commands/Open Docs.tmCommand @@ -0,0 +1,32 @@ + + + + + beforeRunningCommand + nop + command + # Search order: +# - Current project. +# - TM_PYTHONDEV_DOCS. +# - Online docs in development. + +html_index=$TM_PROJECT_DIRECTORY/Doc/build/html/index.html +if [[ -f $html_index ]]; then + open $html_index +elif [[ $TM_PYTHONDEV_DOCS ]]; then + open $TM_PYTHONDEV_DOCS +else + open http://docs.python.org/dev/ +fi + input + none + keyEquivalent + @H + name + Open Docs + output + discard + uuid + BF336FFF-E14D-4BF1-A156-71CF768AC034 + + diff --git a/Misc/TextMate/Python-Dev.tmbundle/Commands/Open PEP.tmCommand b/Misc/TextMate/Python-Dev.tmbundle/Commands/Open PEP.tmCommand new file mode 100644 index 00000000000..af5533a68e8 --- /dev/null +++ b/Misc/TextMate/Python-Dev.tmbundle/Commands/Open PEP.tmCommand @@ -0,0 +1,23 @@ + + + + + beforeRunningCommand + nop + command + # XXX Worth supporting using a local copy? + +# Dumb luck that an unrecognized number leads to a 0 being used. +open `printf "http://www.python.org/dev/peps/pep-%04d" $(cat)` + fallbackInput + word + input + selection + name + Open PEP + output + discard + uuid + EDBB037F-AAE3-4512-863F-D9AA82C9E51E + + diff --git a/Misc/TextMate/Python-Dev.tmbundle/info.plist b/Misc/TextMate/Python-Dev.tmbundle/info.plist new file mode 100644 index 00000000000..2e0ea9a6ce0 --- /dev/null +++ b/Misc/TextMate/Python-Dev.tmbundle/info.plist @@ -0,0 +1,33 @@ + + + + + mainMenu + + items + + 9519C22B-6AB8-41A1-94F6-079E0B45C147 + ------------------------------------ + B545BB1B-A8E1-426C-B50A-426E78B96D38 + 6EF151E5-7149-4F82-8796-0CC40FE589FA + ------------------------------------ + BF336FFF-E14D-4BF1-A156-71CF768AC034 + FD25A8DC-22DC-4ED4-B222-B943C8A9117D + EDBB037F-AAE3-4512-863F-D9AA82C9E51E + + submenus + + + name + Python-Dev + ordering + + B545BB1B-A8E1-426C-B50A-426E78B96D38 + 6EF151E5-7149-4F82-8796-0CC40FE589FA + FD25A8DC-22DC-4ED4-B222-B943C8A9117D + BF336FFF-E14D-4BF1-A156-71CF768AC034 + + uuid + A932ECD1-D43A-4F57-B7FB-A1CEC3B65D20 + +