Home | History | Annotate | Download | only in tlslite
      1 
      2 #When run on (my) windows box, this builds and cleans everything in
      3 #preparation for a release.
      4 
      5 import os
      6 import sys
      7 
      8 #Replace version strings
      9 if len(sys.argv)>1:
     10     oldVersion = sys.argv[1]
     11     newVersion = sys.argv[2]
     12     query = raw_input("Replace %s with %s?: " % (oldVersion, newVersion))
     13     if query == "y":
     14         #First, scan through and make sure the replacement is possible
     15         for filename in ("setup.py", "tlslite\\__init__.py", "scripts\\tls.py", "scripts\\tlsdb.py"):
     16             s = open(filename, "rU").read()
     17             x = s.count(oldVersion)
     18             if filename.endswith("__init__.py"):
     19                 if x != 2:
     20                     print "Error, old version appears in %s %s times" % (filename, x)
     21                     sys.exit()
     22             else:
     23                 if x != 1:
     24                     print "Error, old version appears in %s %s times" % (filename, x)
     25                     sys.exit()
     26 
     27         #Then perform it
     28         for filename in ("setup.py", "tlslite\\__init__.py", "scripts\\tls.py", "scripts\\tlsdb.py"):
     29             os.system("copy %s .." % filename) #save a backup copy in case something goes awry
     30             s = open(filename, "r").read()
     31             f = open(filename, "w")
     32             f.write(s.replace(oldVersion, newVersion))
     33             f.close()
     34 
     35 
     36 #Make windows installers
     37 os.system("del installers\*.exe")
     38 
     39 #Python 2.3
     40 os.system("rmdir build /s /q")
     41 os.system("python23 setup.py bdist_wininst -o")
     42 os.system("copy dist\* installers")
     43 
     44 #Python 2.4
     45 os.system("rmdir build /s /q")
     46 os.system("python24 setup.py bdist_wininst -o")
     47 os.system("copy dist\* installers")
     48 
     49 
     50 #Make documentation
     51 os.system("python23 c:\\devtools\\python23\\scripts\\epydoc.py --html -o docs tlslite")
     52 
     53 #Delete excess files
     54 os.system("del tlslite\\*.pyc")
     55 os.system("del tlslite\\utils\\*.pyc")
     56 os.system("del tlslite\\integration\\*.pyc")
     57 os.system("rmdir build /s /q")
     58 os.system("rmdir dist /s /q")
     59 
     60 
     61 
     62