[Bio] / FigKernelPackages / FIG.py Repository:
ViewVC logotype

Diff of /FigKernelPackages/FIG.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10, Tue May 4 16:37:53 2004 UTC revision 1.11, Fri Apr 15 19:55:44 2005 UTC
# Line 10  Line 10 
10    
11  import Clearinghouse  import Clearinghouse
12    
13    class NoSubsystemException(Exception):
14        pass
15    
16  def get_clearinghouse(url = None):  def get_clearinghouse(url = None):
17      return Clearinghouse.Clearinghouse(url)      return Clearinghouse.Clearinghouse(url)
18    
19    def get_ss_hierarchy(url = None):
20        return Clearinghouse.SSHierarchy(url)
21    
22    #
23    # Subsystem helper code.
24    #
25    
26    def get_subsystem(name):
27        try:
28            sub = Subsystem(name)
29        except NoSubsystemException:
30            sub = None
31    
32        return sub
33    
34    
35  def get_local_hostname():  def get_local_hostname():
36      #      #
37      # See if there is a FIGdisk/config/hostname file. If there      # See if there is a FIGdisk/config/hostname file. If there
# Line 363  Line 382 
382      def __call__(self, *args):      def __call__(self, *args):
383          return self.fig.call_xmlrpc(self.name, args)          return self.fig.call_xmlrpc(self.name, args)
384    
385    class Subsystem:
386        def __init__(self, name):
387            self.dir = os.path.join(FIG_Config.data, "Subsystems", name.replace(" ","_"))
388    
389            if not os.path.isdir(self.dir):
390                raise NoSubsystemException("Subsystem %s not found" % (name))
391    
392        def get_version(self):
393            try:
394                fh = open(os.path.join(self.dir, "VERSION"))
395                version = fh.readline().strip()
396                try:
397                    local_version = int(version)
398                except TypeError:
399                    local_version = -1
400                fh.close()
401            except:
402                local_version = -1
403    
404            return local_version;
405    
406        def get_curator(self):
407            curator = None
408            try:
409                fh = open(os.path.join(self.dir, "curation.log"))
410                l = fh.readline().strip()
411                fh.close()
412                m = re.match(r"^\d+\t(\S+)\s+started", l)
413                if m:
414                    curator = m.group(1)
415            except:
416                pass
417    
418            return curator
419    
420  if __name__ == "__main__":  if __name__ == "__main__":
421    
422      print get_local_hostname()      print get_local_hostname()

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3