Beispiel #1
0
 def create (self) :
     assert not sos.path.exists (self.db_uri), self.db_uri.name
     assert not sos.path.exists (self.x_uri), self.x_uri.name
     x_uri = self.x_uri
     with TFL.lock_file (x_uri) :
         sos.mkdir  (x_uri)
         sos.system ("chmod go= %s" % x_uri.name)
         self._create_info ()
Beispiel #2
0
 def create (self) :
     assert not sos.path.exists (self.db_uri.name), self.db_uri.name
     assert not sos.path.exists (self.x_uri.name), self.x_uri.name
     x_name = self.x_uri.name
     with TFL.lock_file (x_name) :
         sos.mkdir  (x_name)
         sos.system ("chmod go= %s" % x_name)
         self._create_info ()
Beispiel #3
0
 def load_info (self) :
     assert sos.path.exists (self.db_uri), self.db_uri.name
     x_uri = self.x_uri
     with TFL.lock_file (x_uri) :
         if not sos.path.exists (x_uri) :
             sos.mkdir (x_uri)
             sos.system ("chmod go= %s" % x_uri.name)
             with contextlib.closing \
                      (self.ZF.ZipFile (self.db_uri, "r")) as zf :
                 zf.extractall (x_uri)
         self.info = self._load_info ()
Beispiel #4
0
 def load_info (self) :
     assert sos.path.exists (self.db_uri.name), self.db_uri.name
     x_name = self.x_uri.name
     with TFL.lock_file (x_name) :
         if not sos.path.exists (x_name) :
             sos.mkdir (x_name)
             sos.system ("chmod go= %s" % x_name)
             with contextlib.closing \
                      (self.ZF.ZipFile (self.db_uri.name, "r")) as zf :
                 zf.extractall (x_name)
         self.info = self._load_info ()
Beispiel #5
0
 def system (self, key = "view", filename = "/dev/null", plist = []) :
     cmd = self.command (key, filename, plist)
     if self.needsterminal :
         cmd = "xterm -e %s" % cmd
     return sos.system (cmd)
Beispiel #6
0
 def applicable (self, filename = "/dev/null", plist = []) :
     if self.test :
         test_cmd = self.command ("test", filename, plist)
         return sos.system (test_cmd) == 0
     return True
Beispiel #7
0
 def system (self, key = "view", filename = "/dev/null", plist = []) :
     cmd = self.command (key, filename, plist)
     if self.needsterminal :
         cmd = "xterm -e %s" % cmd
     return sos.system (cmd)
Beispiel #8
0
 def applicable (self, filename = "/dev/null", plist = []) :
     if self.test :
         test_cmd = self.command ("test", filename, plist)
         return sos.system (test_cmd) == 0
     return True