[Python-checkins] python/nondist/sandbox/msi msi.py, 1.1.1.1, 1.2 msilib.py, 1.1.1.1, 1.2

loewis at users.sourceforge.net loewis at users.sourceforge.net
Tue Dec 30 10:02:45 EST 2003


Update of /cvsroot/python/python/nondist/sandbox/msi
In directory sc8-pr-cvs1:/tmp/cvs-serv15532

Modified Files:
	msi.py msilib.py 
Log Message:
Include msvcr71.dll. 
Include current date as sub-micro version for alpha releases.

Index: msi.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/msi/msi.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** msi.py	29 Dec 2003 14:04:35 -0000	1.1.1.1
--- msi.py	30 Dec 2003 15:02:42 -0000	1.2
***************
*** 1,5 ****
  # Python MSI Generator
  # (C) 2003 Martin v. Loewis
! import msilib, schema, sequence, os, sets, glob
  from msilib import Feature, CAB, Directory, Dialog, Binary, add_data
  import uisample
--- 1,5 ----
  # Python MSI Generator
  # (C) 2003 Martin v. Loewis
! import msilib, schema, sequence, os, glob, time
  from msilib import Feature, CAB, Directory, Dialog, Binary, add_data
  import uisample
***************
*** 8,12 ****
  msilib.Win64 = 0
  current_version = "2.4.0"
! testpackage=0
  
  srcdir = r'e:\pyinst\python'
--- 8,13 ----
  msilib.Win64 = 0
  current_version = "2.4.0"
! alpha = 1
! testpackage = 0
  
  srcdir = r'e:\pyinst\python'
***************
*** 24,27 ****
--- 25,29 ----
      '2.4.0': "{93792a5a-5bb0-43b1-904f-ba10c4f08ec8}",
  }
+ product_code = product_codes[current_version]
  
  extensions = [
***************
*** 49,53 ****
      'parser.pyd',    
      ])
!     
  
  if testpackage:
--- 51,58 ----
      'parser.pyd',    
      ])
! 
! if alpha:
!     release = int(time.time()/3600/24)
!     current_version += ".%d" % release
  
  if testpackage:
***************
*** 58,67 ****
      testprefix = ''
  
! msilib.reset()    
  
  def build_database():
      db = msilib.init_database("python%s.msi" % current_version,schema,
                            ProductName="Python "+current_version,
!                   ProductCode=product_codes[current_version],
                    ProductVersion=current_version,
                    Manufacturer=u"Martin v. L\xf6wis")
--- 63,72 ----
      testprefix = ''
  
! msilib.reset()
  
  def build_database():
      db = msilib.init_database("python%s.msi" % current_version,schema,
                            ProductName="Python "+current_version,
!                   ProductCode=product_code,
                    ProductVersion=current_version,
                    Manufacturer=u"Martin v. L\xf6wis")
***************
*** 426,431 ****
--- 431,458 ----
                          "Python test suite (Lib/test/)", 9)
  
+ def extract_msvcr71():
+     import _winreg, win32api
+     # Find the location of the merge modules
+     k = _winreg.OpenKey(
+         _winreg.HKEY_LOCAL_MACHINE,
+         r"Software\Microsoft\VisualStudio\7.1\Setup\VS")
+     dir = _winreg.QueryValueEx(k, "MSMDir")[0]
+     _winreg.CloseKey(k)
+     files = glob.glob1(dir, "*CRT71*")
+     assert len(files) == 1
+     file = os.path.join(dir, files[0])
+     # Extract msvcr71.dll
+     m = msilib.MakeMerge2()
+     m.OpenModule(file, 0)
+     m.ExtractFiles(".")
+     m.CloseModule()
+     # Find the version/language of msvcr71.dll
+     installer = msilib.MakeInstaller()
+     return installer.FileVersion("msvcr71.dll", 0), \
+            installer.FileVersion("msvcr71.dll", 1)
+ 
  def add_files(db):
      cab = CAB("python")
+     tmpfiles = []
      root = Directory(db, cab, None, srcdir, "TARGETDIR", "SourceDir")
      # Create separate components for python.exe and pythonw.exe so we can
***************
*** 439,443 ****
--- 466,477 ----
      root.start_component("TARGETDIR", default_feature)
      root.add_file("PCBuild/w9xpopen.exe") # XXX: separate component to only install on W9x
+ 
      root.add_file("PCBuild/python%s%s.dll" % (major, minor)) # XXX separate component for system32
+     # XXX determine dependencies
+     version, lang = extract_msvcr71()
+     root.add_file("msvcr71.dll", src=os.path.abspath("msvcr71.dll"),
+                   version=version, language=lang)
+     tmpfiles.append("msvcr71.dll")
+     
      root.add_file("README.txt", src="README")
      root.add_file("NEWS.txt", src="Misc/NEWS")
***************
*** 543,547 ****
      lib.add_file("Python%s%s.chm" % (major, minor))
  
!     cab.commit(db)    
  
  def add_registry(db):
--- 577,584 ----
      lib.add_file("Python%s%s.chm" % (major, minor))
  
!     cab.commit(db)
! 
!     for f in tmpfiles:
!         os.unlink(f)
  
  def add_registry(db):
***************
*** 639,643 ****
                # XXX: System64Folder on Win64
                ("Uninstall", "MENUDIR", "UNINST|Uninstall Python", "REGISTRY",
!                "[SystemFolder]msiexec",  "/x%s" % product_codes[current_version],
                 None, None, None, None, None, None),
                ])
--- 676,680 ----
                # XXX: System64Folder on Win64
                ("Uninstall", "MENUDIR", "UNINST|Uninstall Python", "REGISTRY",
!                "[SystemFolder]msiexec",  "/x%s" % product_code,
                 None, None, None, None, None, None),
                ])

Index: msilib.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/msi/msilib.py,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** msilib.py	29 Dec 2003 14:04:36 -0000	1.1.1.1
--- msilib.py	30 Dec 2003 15:02:42 -0000	1.2
***************
*** 51,55 ****
  
  def EnsureMSI():
!     win32com.client.gencache.EnsureModule('{000C1092-0000-0000-C000-000000000046}',0x409,1,0)
  
  _Installer=None
--- 51,58 ----
  
  def EnsureMSI():
!     win32com.client.gencache.EnsureModule('{000C1092-0000-0000-C000-000000000046}', 0, 1, 0)
! 
! def EnsureMSM():
!     win32com.client.gencache.EnsureModule('{0ADDA82F-2C26-11D2-AD65-00A0C9AF11A6}', 0, 1, 0)
  
  _Installer=None
***************
*** 62,65 ****
--- 65,76 ----
      return _Installer
  
+ _Merge=None
+ def MakeMerge2():
+     global _Merge
+     if _Merge is None:
+         EnsureMSM()
+         _Merge = win32com.client.Dispatch("Msm.Merge2.1")
+     return _Merge
+ 
  class Table:
      def __init__(self, name):
***************
*** 440,444 ****
          return file
  
!     def add_file(self, file, src=None):
          if not self.component:
              self.start_component(self.logical, current_feature)
--- 451,455 ----
          return file
  
!     def add_file(self, file, src=None, version=None, language=None):
          if not self.component:
              self.start_component(self.logical, current_feature)
***************
*** 459,464 ****
          full = "%s|%s" % (short, file)
          filesize = os.stat(absolute).st_size
-         version = None
-         language = None
          # constants.msidbFileAttributesVital
          # Compressed omitted, since it is the database default
--- 470,473 ----





More information about the Python-checkins mailing list