RFC: centralise registries

Brian de Alwis bsd at cs.ubc.ca
Tue Apr 14 22:58:01 BST 2009


On 14-Apr-2009, at 1:08 PM, Alexander Belchenko wrote:
> Oh, no! Please, let it run without XML!
>
> If you need to reinvent the wheel, why not using setuptools aprroach
> for registering plugins metadata?

I took a quick look for "setuptools" and found the PEAK stuff, but  
wasn't able to find anything specific about plugin metadata formats.

Please don't take me as an XML-everywhere zealot; I only mentioned it  
as it has been used very successfully for similar purposes elsewhere.   
XML's primary advantage in this type of situation is that it provides  
a flexible but structured format.  Ideally every registry, such as the  
content-filters, would be expressed in the metadata format.  Ini-style  
files seem to require some major hacks to get it.

So how might I envision the hooks looking like?  You could express the  
content filters and eol filters as something like (assuming 'hooks' is  
a desired name to keep around, instead of the Eclipse-style 'extension- 
point'/'extension'):

bzrlib/filters/__hooks__.xml

<hook-point id="content-filters" />
<!-- hook id made fully qualified by prefixing module location -->
<!-- ideally would have a schema defining the expectations of hooks -->

The eol filters might look like:

bzrlib/filters/eol/__hooks__.xml:

<hooks point="bzrlib.filters.content-filters">	
	<filter-combo name="eol" value="exact" />	<!-- do nothing -->
	<filter-combo name="eol" value ="native">
		<read-filter function="bzrlib.filters.eol._to_lf_converter" />
		<write-filter function="bzrlib.filters.eol._native_output" />
	<filter-combo/>
	<filter-combo name="eol" value ="lf">
		<read-filter function="bzrlib.filters.eol._to_lf_converter" />
		<write-filter function="bzrlib.filters.eol._to_lf_converter" />
	<filter-combo/>
	<filter-combo name="eol" value ="crlf">
		<read-filter function="bzrlib.filters.eol._to_lf_converter" />
		<write-filter function="bzrlib.filters.eol._to_crlf_converter" />
	<filter-combo/>
	<!-- etc -->
</hooks>

Brian.

-- 
"Amusement to an observing mind is study." - Benjamin Disraeli




More information about the bazaar mailing list