stk-code_catmod/tools/nightbuilder/package.py
samuncle 0efdf0744a Add the new version of the nightbuilder client
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11954 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2012-11-16 00:34:10 +00:00

81 lines
2.5 KiB
Python

#!/bin/python
# From Supertuxkart SVN revision $Revision$
# Copyright (C) 2012 Jean-manuel clemencon (samuncle)
# Class used to package the project
################################################################################
from subprocess import check_output
from utils import *
class Package:
"""
Interface for the builder
"""
__revision = 0
__listFile = []
#-------------------------------------------------------------------------------
def __init__ (self, revision, compressDir, os,platform):
"""
Constructor of the builder class
"""
self.__os = os
self.__revision = str(revision)
self.__platform = platform
self.__compressDir = compressDir
#-------------------------------------------------------------------------------
def addFile(self, inFile, outFile, workingDir):
"""
Packing a file
"""
# filename
name = outFile \
+ "_" + self.__os \
+ self.__platform \
+ "_" + self.__revision \
+ ".zip"
self.__listFile.append(name)
# prepare the command
command = "zip " \
+ self.__compressDir \
+ "/" + name \
+ " " + inFile
# execute the command to pack the binary
changeDir = Cdir(workingDir)
check_output([command], shell=True)
del changeDir
#-------------------------------------------------------------------------------
def addDir(self, inFile, outFile, workingDir, exclude):
"""
Packing a directory
"""
# filename
name = outFile \
+ "_" + self.__os \
+ "_" + self.__revision \
+ ".zip"
self.__listFile.append(name)
# prepare the command
command = "zip -r --exclude=" \
+ exclude \
+ " " +self.__compressDir \
+ "/" + name \
+ " " + inFile
# execute the command to pack the binary
changeDir = Cdir(workingDir)
check_output([command], shell=True)
del changeDir
#-------------------------------------------------------------------------------
def getFiles(self):
"""
Return the list of file/directory added
"""
return self.__listFile