Closed Bug 902209 Opened 12 years ago Closed 12 years ago

Add pastebin to mach tools

Categories

(Firefox Build System :: Mach Core, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla27

People

(Reporter: ffledgling, Assigned: ffledgling)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 2 obsolete files)

Attached file mozpaste.py (obsolete) —
A cli interface to pastebin.mozilla.org is a useful tool to have and saves the hassle of copying errors/logs/outputs/code from various places into pastebin.m.o need to add a pastebin tool to mach that can be used by calling "mach pastebin" from the cli. It would also be super useful if it can be run as a standalone script. It can be similar to something like fpaste [http://linux.die.net/man/1/fpaste] Attaching a first draft of the script. It works stand-alone only at the moment and needs to be integrated with the rest of the mach tools that reside in http://mxr.mozilla.org/mozilla-central/source/tools/mach_commands.py
QA Contact: ffledgling
Assignee: nobody → ffledgling
QA Contact: ffledgling
Nice. You should be able to toss this somewhere in /tools and hook it up with the /tools/mach_commands.py.
Attachment #786571 - Attachment mime type: text/x-python → text/plain
For reference, I use catlee's script for this: https://gist.github.com/djmitche/1110510
Attached patch adds pastebin to mach (obsolete) — Splinter Review
I've added pastebin to mach tools. Please take a look and tell me if everything is in order. Any feedback/critique is more than welcome. :)
Attachment #786571 - Attachment is obsolete: true
Attachment #816694 - Flags: feedback?(mbrubeck)
Comment on attachment 816694 [details] [diff] [review] adds pastebin to mach Review of attachment 816694 [details] [diff] [review]: ----------------------------------------------------------------- This looks good to me! Passing it on to gps for review. ::: tools/mach_commands.py @@ +223,5 @@ > + { 'value': 'bash', 'name': 'Bash', 'extension': 'sh' }, > + { 'value': 'c', 'name': 'C', 'extension': 'c' }, > + { 'value': 'cpp', 'name': 'C++', 'extension': 'cpp' }, > + { 'value': 'html4strict', 'name': 'HTML', 'extension': 'html' }, > + { 'value': 'javascript', 'name': 'Javascript', 'extension': 'js' }, It would be useful to add some additional extensions for some of these, for example .jsm -> JavaScript and .xul -> XML. But I guess using `file` is the right way to handle this in the long run.
Attachment #816694 - Flags: review?(gps)
Attachment #816694 - Flags: feedback?(mbrubeck)
Attachment #816694 - Flags: feedback+
Comment on attachment 816694 [details] [diff] [review] adds pastebin to mach Review of attachment 816694 [details] [diff] [review]: ----------------------------------------------------------------- Awesome! ::: tools/mach_commands.py @@ +233,5 @@ > + { 'value': 'css', 'name': 'CSS', 'extension': 'css' }, > + { 'value': 'diff', 'name': 'Diff', 'extension': 'diff' }, > + { 'value': 'ini', 'name': 'INI file', 'extension': 'ini' }, > + { 'value': 'java', 'name': 'Java', 'extension': 'java' }, > + { 'value': 'xml', 'name': 'XML', 'extension': 'xml' }] Nit: cuddle braces. @@ +246,5 @@ > + # Guess File-type based on file extension > + extension = file.split('.')[-1] > + for l in FILE_TYPES: > + if extension == l['extension']: > + print "Identified file as", l['name'] Nit: Use Python 3 compatible print() function, not statement.
Attachment #816694 - Flags: review?(gps) → review+
Fixes nits pointed out by both mbrubeck and gps. mbrubeck, the reason I haven't used file yet is, (1) It may not always be installed on all *nix distributions (though most new distributions always have it), (2) Windows doesn't have `file` or a `file`-like mime-type detection utility. gps, I'm carrying over the r+ but please feel free to change if the new patch has any sort of errors. Thanks!
Attachment #816694 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla27
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: