Re: [Pythonmac-SIG] [Pythonmac-SIG] Spotlight and Python

2005-05-12 Thread Jonathan Wight
Version 0.7 is now online at: http://toxicsoftware.com/_private/Python%20Metadata%20Importer/Version %200.7/Python%20Metadata%20Importer.dmg Thanks to David Reed for helping me test and iron out the Unicode problems. This version should work for pretty much anyone (famous last words). I've

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-11 Thread David Reed
On May 11, 2005, at 2:12 PM, Jonathan Wight wrote: > For me it worked: > > "org_python_functions" = ("get_bits", "set_lsb", "get_lsb", > "value_from_bits"); > > But then I just made a new BBEdit Bits.py file and pasted your code > into it. > > The importer does seem to be crashing, but I'

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-11 Thread Jonathan Wight
For me it worked: "org_python_functions" = ("get_bits", "set_lsb", "get_lsb", "value_from_bits"); But then I just made a new BBEdit Bits.py file and pasted your code into it. The importer does seem to be crashing, but I'm not sure whether the python or the ObjC is dying. Is there a cr

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-11 Thread David Reed
On May 11, 2005, at 11:06 AM, Jonathan Wight wrote: > It is entirely possible I screwed something up and that it doesn't > work on anything other than my Powerbook ;-) > > However: > > As the last part of the install process the installer kicks off a > script to reindex the Python files on th

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-11 Thread Jonathan Wight
On May 11, 2005, at 10:51, David Reed wrote: > Also, how do you uninstall your plugin? Remove "Python Metadata Importer.mdimporter" from /Library/Spotlight ___ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-11 Thread Jonathan Wight
On May 11, 2005, at 11:16, Schollnick, Benjamin wrote: >>> had time to index my drive by now. It does seem to have indexed >>> files that are part of python packages but it hasn't index Python >>> files in my home directory and subdirectories. Is it >>> >> skipping these >> >>> on purpose or does

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-11 Thread Schollnick, Benjamin
PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Wight > Sent: Wednesday, May 11, 2005 11:07 AM > To: David Reed > Cc: PythonMac > Subject: Re: [Pythonmac-SIG] Spotlight and Python > > > It is entirely possible I screwed something up and that it doesn't

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-11 Thread Jonathan Wight
It is entirely possible I screwed something up and that it doesn't work on anything other than my Powerbook ;-) However: As the last part of the install process the installer kicks off a script to reindex the Python files on the hard drive. This could be failing. To manually reindex runt th

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-11 Thread David Reed
On May 11, 2005, at 2:28 AM, Jonathan Wight wrote: > OK. The first version is online at: > > http://toxicsoftware.com/_private/Python%20Metadata%20Importer.pkg.zip > > The installer installs the mdimporter to /Library/Spotlight/ and > then calls mdimport -r to force Spotlight to reindex all Pyt

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread Jonathan Wight
OK. The first version is online at: http://toxicsoftware.com/_private/Python%20Metadata%20Importer.pkg.zip The installer installs the mdimporter to /Library/Spotlight/ and then calls mdimport -r to force Spotlight to reindex all Python files. You _may_ need Xcode installed to have this work su

[Pythonmac-SIG] spotlight and Python files

2005-05-10 Thread Dave Reed
I noticed Spotlight doesn't index Python files. I'm not certain how useful it would be but I was thinking about trying to get spotlight to index the name of classes and functions/methods (i.e., you could enter a class name and spotlight would find the Python file containing the class). I d

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread Larry Meyn
How about using pydoc as a starting point? It parses code and generates API documentation in XML or HTML. Larry On May 10, 2005, at 7:25 PM, Jonathan Wight wrote: > I looked at parser but discounted it too soon. After a bit of playing > I managed to get

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread Jonathan Wight
I looked at parser but discounted it too soon. After a bit of playing I managed to get the following code to provide lists of class names and function names. Thanks Bob! Jon. #!/usr/bin/python import parser import symbol def find(inTuple, inSymbol): theClasses = [] if inTupl

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread Bill Janssen
If you look at the parser module documentation, there's a section labelled "Information Discovery", which details the process. Bill > Are there any modules out there for extracting > information from Python script files? ___ Pythonmac-SIG maillist -

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread Bob Ippolito
On May 10, 2005, at 9:55 PM, David Reed wrote: > > On May 10, 2005, at 8:52 PM, Jonathan Wight wrote: > > >> I've made a first pass at it and have a Spotlight importer that >> calls a built-in Python function to import a file's metadata. >> >> I started to look at module inspect to find out how t

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread David Reed
On May 10, 2005, at 8:52 PM, Jonathan Wight wrote: > I've made a first pass at it and have a Spotlight importer that > calls a built-in Python function to import a file's metadata. > > I started to look at module inspect to find out how to extract > information from a Python module but then r

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread Bob Ippolito
On May 10, 2005, at 8:52 PM, Jonathan Wight wrote: > I've made a first pass at it and have a Spotlight importer that calls > a built-in Python function to import a file's metadata. > > I started to look at module inspect to find out how to extract > information from a Python module but then reali

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread Jonathan Wight
I've made a first pass at it and have a Spotlight importer that calls a built-in Python function to import a file's metadata. I started to look at module inspect to find out how to extract information from a Python module but then realised that I'd need to import the file the importer is ana

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread Robert Kern
Jacob Kaplan-Moss wrote: > On May 10, 2005, at 2:00 PM, Jonathan Wight wrote: > > >>I'm not sure how useful it is to index function & class names though. >> > > > Oh, I disagree -- I've got over 100K lines of code, and I would > *kill* to be able to find everywhere a particular symbol is used

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread Jonathan Wight
I'll have a play with it later today. I don't think it should be too difficult at all. Jon. On May 10, 2005, at 16:22, David Reed wrote: > I don't think I'd want all variables/symbols to be indexed, but I > think function and class names might be nice and adding the > documentation strin

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread David Reed
On May 10, 2005, at 3:57 PM, Jacob Kaplan-Moss wrote: > On May 10, 2005, at 2:00 PM, Jonathan Wight wrote: > > >> I'm not sure how useful it is to index function & class names though. >> >> > > Oh, I disagree -- I've got over 100K lines of code, and I would > *kill* to be able to find everywhere

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread Bob Ippolito
On May 10, 2005, at 3:57 PM, Jacob Kaplan-Moss wrote: > On May 10, 2005, at 2:00 PM, Jonathan Wight wrote: > > >> I'm not sure how useful it is to index function & class names though. >> >> > > Oh, I disagree -- I've got over 100K lines of code, and I would > *kill* to be able to find everywhere

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread Jacob Kaplan-Moss
On May 10, 2005, at 2:00 PM, Jonathan Wight wrote: > I'm not sure how useful it is to index function & class names though. > Oh, I disagree -- I've got over 100K lines of code, and I would *kill* to be able to find everywhere a particular symbol is used. And yes, I know grep -r will do it fo

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread Jonathan Wight
On May 10, 2005, at 14:49, David Reed wrote: > I've looked at the example at: > > http://developer.apple.com/documentation/Carbon/Conceptual/ > MDImporters/Concepts/WritingAnImp.html#//apple_ref/doc/uid/ > TP40001275-CJBEJBHH > > I don't yet understand what NSDictionary tempDict contains after i

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread David Reed
On May 10, 2005, at 12:01 PM, Jonathan Wight wrote: > It's certainly a good idea. > > Writing a Spotlight plug-in is extremely straight forward - just > fire up Xcode 2 and create a new "Metadata Importer" project. You > just have one function that you need to provide: > > Boolean GetMetadata

Re: [Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread Jonathan Wight
It's certainly a good idea. Writing a Spotlight plug-in is extremely straight forward - just fire up Xcode 2 and create a new "Metadata Importer" project. You just have one function that you need to provide: Boolean GetMetadataForFile(void* thisInterface, CFMutableDictionaryRe

[Pythonmac-SIG] Spotlight and Python

2005-05-10 Thread David Reed
I noticed Spotlight doesn't index Python files. I'm not certain how useful it would be but I was thinking about trying to get spotlight to index the name of classes and functions/methods (i.e., you could enter a class name and spotlight would find the Python file containing the class). I do