Exemplo n.º 1
0
 def commit(self, destdir):
     if self.checkfs(destdir):
         log.progress('directory %s up-to-date...' % path)
         return False
     else:
         path = destdir + self.path
         log.progress('creating directory %s...' % path)
         os.makedirs(os.path.dirname(path), 0o755, True)
         os.mkdir(path, self.mode, True)
         return True
Exemplo n.º 2
0
 def try_module(self, name):
     profiles = [self.profile, 'common']
     for p in [self.profile, 'common']:
         m = p + '.modules.' + name
         if m in sys.modules:
             return
         log.progress('looking for module %s in %s profile' % (name, p))
         try:
             sys.modules[m] = importlib.import_module(m)
             return True
         except ImportError as e:
             pass
     return False
Exemplo n.º 3
0
 def load_module(self, name):
     profiles = [self.profile, 'common']
     for p in [self.profile, 'common']:
         m = p + '.modules.' + name
         if m in sys.modules:
             return
         log.progress('looking for module %s in %s profile' % (name, p))
         try:
             sys.modules[m] = importlib.import_module(m)
             return
         except ImportError as e:
             pass
     raise RuntimeError('module "%s" not found in any profile' % name)
Exemplo n.º 4
0
 def commit(self, destdir):
     if self.checkfs(destdir):
         log.progress('%s already up to date...' % self.path)
         return False
     else:
         path = destdir + self.path
         log.progress('writing file %s...' % path)
         os.makedirs(os.path.dirname(path), 0o755, True)
         flags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC
         mode = self.mode
         fd = os.open(path, flags, mode)
         os.write(fd, bytearray(self.content(), 'ascii'))
         os.close(fd)
         return True
Exemplo n.º 5
0
 def commit(self, destdir):
     kind = 'symbolic ' if self.symbolic else 'hard '
     if self.checkfs(destdir):
         log.progress('%slink %s up-to-date...' % (kind, self.dst))
         return False
     else:
         path = destdir + self.dst
         log.progress('creating %slink %s -> %s...' %
                      (kind, self.src, path))
         os.makedirs(os.path.dirname(path), 0o755, True)
         if self.symbolic:
             os.symlink(self.src, path)
         else:
             os.link(self.src, path)
         return True