home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_2573 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  2.7 KB  |  73 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import win32api
  5. import os
  6. import string
  7. import sys
  8. import vssutil
  9. import bulkstamp
  10.  
  11. def BrandProject(vssProjectName, descFile, stampPath, filesToSubstitute, buildDesc = None, auto = 0, bRebrand = 0):
  12.     path = win32api.GetFullPathName(stampPath)
  13.     build = vssutil.MakeNewBuildNo(vssProjectName, buildDesc, auto, bRebrand)
  14.     if build is None:
  15.         print 'Cancelled'
  16.         return None
  17.     bulkstamp.scan(build, stampPath, descFile)
  18.     for infile, outfile in filesToSubstitute:
  19.         SubstituteVSSInFile(vssProjectName, infile, outfile)
  20.     
  21.     return 1
  22.  
  23.  
  24. def usage(msg):
  25.     print msg
  26.     print '%s Usage:\n%s [options] vssProject descFile stampPath\n\nAutomatically brand a VSS project with an automatically incremented\nbuild number, and stamp DLL/EXE files with the build number.\n\nChecks that no files are checked out in the project, and finds the last\nbuild number, and suggests the next number.\n\nOptions:\n-a     - Auto increment the build number, and brand (otherwise prompt\n         for the build number after looking for the previous)\n-r     - Restamp the files with the existing build number.\n-d     - A description for the VSS Label.\n-f infile=outfile - Substitute special VSS labels in the specified text\n                    file with the text extracted from VSS.\n' % (os.path.basename(sys.argv[0]), os.path.basename(sys.argv[0]))
  27.     sys.exit(1)
  28.  
  29. if __name__ == '__main__':
  30.     
  31.     try:
  32.         import getopt
  33.         (opts, args) = getopt.getopt(sys.argv[1:], 'af:d:r')
  34.     except getopts.error:
  35.         msg = None
  36.         usage(msg)
  37.  
  38.     bAuto = bRebrand = 0
  39.     stampFiles = []
  40.     desc = None
  41.     for opt, val in opts:
  42.         if opt == '-a':
  43.             bAuto = 1
  44.         
  45.         if opt == '-f':
  46.             (infile, outfile) = string.split(val, '=', 2)
  47.             stampFiles.append((infile, outfile))
  48.         
  49.         if opt == '-d':
  50.             desc = val
  51.         
  52.         if opt == '-r':
  53.             bRebrand = 1
  54.             continue
  55.     
  56.     if len(args) < 3:
  57.         usage('You must specify the required arguments')
  58.     
  59.     vssProjectName = '$\\' + args[0]
  60.     descFile = args[1]
  61.     path = args[2]
  62.     
  63.     try:
  64.         os.stat(descFile)
  65.     except IOError:
  66.         usage("The description file '%s' can not be found" % descFile)
  67.  
  68.     if not os.path.isdir(path):
  69.         usage("The path to the files to stamp '%s' does not exist" % path)
  70.     
  71.     BrandProject(vssProjectName, descFile, path, stampFiles, desc, bAuto, bRebrand)
  72.  
  73.