Exemplo n.º 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 ()
Exemplo n.º 2
0
Arquivo: Store.py Projeto: Tapyr/tapyr
 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 ()
Exemplo n.º 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 ()
Exemplo n.º 4
0
Arquivo: Store.py Projeto: Tapyr/tapyr
 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 ()
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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