Commits

Jan Borsodi committed 14e27b8

Download mfc71.dll and add_path.exe from the web if missing, also check if msvcr71.dll can be found your system folder.

Comments (0)

Files changed (1)

         build_path = join('build', 'hg-cutehg')
         dist_path = join(build_path, 'dist')
 
+        # Donwload some required dll/exe files
+        # TODO: This should be performed as callbacks when the file is not found locally
+        # TODO: Find a good url for downloading msvcr71.dll from the web, maybe put it on bitbucket? 
+        installer_file = 'mfc71.dll'
+        if not exists(installer_file):
+            wget('http://starship.python.net/crew/mhammond/downloads/mfc71.dll', installer_file)
+
+        installer_file = 'add_path.exe'
+        if not exists(installer_file):
+            if not exists('add_path.zip'):
+                wget('http://www.barisione.org/files/add_path.zip', 'add_path.zip')
+            from zipfile import ZipFile
+            f = ZipFile('add_path.zip')
+            f.extract(installer_file)
+
         # Copy some files required by the installer
         log.info('copying dlls/exes required by installer')
         for installer_file in ('mfc71.dll', 'msvcr71.dll', 'add_path.exe'):
-            if exists(installer_file):
-                copy_file(installer_file, join(dist_path, installer_file))
-            else:
+            found = False
+            for path in ('', '%SystemRoot%/system32/', ):
+                if exists(expandvars(join(path, installer_file))):
+                    copy_file(expandvars(join(path, installer_file)), join(dist_path, installer_file))
+                    found = True
+                    break
+            if not found:
                 raise distutils.errors.DistutilsExecError('Could not find ' + installer_file)
 
         # Creating the .iss file