Changeset 3840 for exist/trunk


Ignore:
Timestamp:
01/05/08 14:20:37 (11 years ago)
Author:
cbyrom
Message:

Adjust ndgutils setup to allow the inclusion of the xquery lib files
+ adjust the ndgXqueries script to allow the easy retrieval of
these files.

Location:
exist/trunk/python
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/python/ndgUtils/ndgDirectory.py

    r3180 r3840  
    2121        #get the right namespace 
    2222        self.ns={'DIF':'http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/','MOLES':'http://ndg.nerc.ac.uk/moles','MDIP':'http://www.oceannet.org/mdip/xml'}[docType] 
    23         #select the query 
     23        #load all queries 
    2424        queries=ndgXqueries.ndgXqueries() 
     25        #select the right query according to the docType 
    2526        xqName={'DIF':'DIFList','MOLES':'molesList', 'MDIP':'MDIPList', 'moles':'molesList'}[docType] 
    2627        self.docType=docType 
    2728        xq=queries[xqName] 
     29        # set the query up with the correct target collection 
    2830        self.xq=xq.replace('TargetCollection',self.targetCollection) 
    2931        
  • exist/trunk/python/ndgUtils/ndgXqueries.py

    r3125 r3840  
    1414        #remember that .rstrip doesn't quite do what you think it does :-) 
    1515        self.xq=dict([(re.sub('.xq\Z','',f),pkg_resources.resource_string('ndgUtils','%s/%s'%(directory,f))) for f in xq]) 
     16         
     17        # add the various xquery libraries, too 
     18        self.xqlib=dict() 
     19        dirs = ['xqueryLib/Vocabs', 'xqueryLib/Utilities', 'xqueryLib/StubB'] 
     20        for dir in dirs: 
     21            files = pkg_resources.resource_listdir('ndgUtils', dir) 
     22            for f in files: 
     23                if f.find('.xquery') == -1:  
     24                    continue 
     25 
     26                #re.sub('.xquery\Z','',f)] = \ 
     27                self.xqlib[f] = pkg_resources.resource_string('ndgUtils','%s/%s'%(dir,f)) 
     28             
    1629    def __setitem__(self,key,value): 
    1730        ''' Add a new xquery to the xquery database dynamically''' 
  • exist/trunk/python/setup.py

    r3186 r3840  
    99        packages=find_packages(), 
    1010        test_suite='nose.collector', 
    11         package_data = {'ndgUtils':['xquery/*.xq']}, 
     11        package_data = {'ndgUtils':['xquery/*.xq','xqueryLib/*/*.xquery']}, 
    1212        author = 'Bryan Lawrence', 
    1313        license = 'LGPL', 
Note: See TracChangeset for help on using the changeset viewer.