Exemplo n.º 1
0
Arquivo: nsis.py Projeto: flupke/pyflu
 def run(self):
     script_file = open(self.script_output, "w")
     template_file = open(self.nsis_template, "r")
     data = { 
             "version": self.version,
         }
     # Build input files list
     files = []
     for etype, input, output in self.input:
         if etype == "d":
             self.append_tree(input, output, files)
         elif etype == "f":
             print os.path.basename(input), output
             files.append((os.path.join(output, os.path.basename(input)), 
                     input))
     data["install_files"] = "\n".join([
         'SetOutPath "$INSTDIR\%s"\nFile "%s"' %
         (os.path.dirname(e[0]), e[1]) for e in files])
     data["uninstall_files"] = "\n".join(
             ['Delete "$INSTDIR\%s"' % e[0] for e in files])
     # Render template
     script_file.write(template_file.read() % data)
     script_file.close()
     # Compile
     run_script("%s %s" % (self.nsis_compiler, self.script_output))
Exemplo n.º 2
0
 def run(self):
     work_dir = tempfile.mkdtemp()
     try:
         # Extract code
         print "retrieving code from %s..." % self.src_url
         dst_dir = join(work_dir, self.name)
         output = run_script("%s export %s %s" % (self.svn_executable, 
             self.src_url, dst_dir), pipe_output=True)
         if self.svn:
             # Get revision number
             last_line = output[0][0].split("\n")[-2]
             rev = re.search("(\d+)", last_line).group(0)
             version = "r%s" % rev
             print "extracted svn revision %s" % rev
         elif self.release:
             version = self.version
         # Write version
         self.write_version(dst_dir, version)
         # Create archive
         try:
             os.mkdir("dist")
         except OSError:
             pass
         tar_path = join("dist", "%s-%s.tar.gz" % (self.name, version))
         tar = tarfile.open(tar_path, "w:gz")
         tar.add(dst_dir, "%s-%s" % (self.name, version))
         tar.close()
         print "created archive %s" % tar_path
         # Upload            
         if self.copy_to is not None:
             print "Copying to %s..." % self.copy_to
             run_script("scp %s %s" % (tar_path, self.copy_to))
     finally:
         shutil.rmtree(work_dir)
Exemplo n.º 3
0
 def build(self, dir, version):
     run_script("python setup.py %s" % self.freeze_command(), echo=True, 
             cwd=dir, null_output=not self.verbose_freeze)
     self.post_build(dir, version)