Source

pygame / config_win.py

Diff from to

File config_win.py

 from glob import glob
 from distutils.sysconfig import get_python_inc
 
+try:
+    raw_input
+except NameError:
+    raw_input = input
+
 huntpaths = ['..', '..\\..', '..\\*', '..\\..\\*']
 
 
         self.inc_dir = None
         self.lib_dir = None
         self.libs = libs
-        self.found = 0
+        self.found = False
         self.cflags = ''
                  
     def hunt(self):
 
     def choosepath(self):
         if not self.paths:
-            print 'Path for ', self.name, 'not found.'
-            if self.required: print 'Too bad that is a requirement! Hand-fix the "Setup"'
+            print ("Path for %s not found." % self.name)
+            if self.required:
+                print ('Too bad that is a requirement! Hand-fix the "Setup"')
         elif len(self.paths) == 1:
             self.path = self.paths[0]
-            print 'Path for '+self.name+':', self.path
+            print ("Path for %s:%s" % (self.name, self.path))
         else:
-            print 'Select path for '+self.name+':'
+            print ("Select path for %s:" % self.name)
             for i in range(len(self.paths)):
-                print '  ', i+1, '=', self.paths[i]
-            print '  ', 0, '= <Nothing>'
-            choice = raw_input('Select 0-'+`len(self.paths)`+' (1=default):')
+                print ("  %i=%s" % (i + 1, self.paths[i]))
+            print ("  %i = <Nothing>" % 0)
+            choice = raw_input("Select 0-%i (1=default):" % len(self.paths))
             if not choice: choice = 1
             else: choice = int(choice)
             if(choice):
         self.hunt()
         self.choosepath()
         if self.path:
-            self.found = 1
+            self.found = True
             self.inc_dir = self.findhunt(self.path, Dependency.inc_hunt)
             self.lib_dir = self.findhunt(self.path, Dependency.lib_hunt)
 
         self.inc_dir = ''
         self.libs = []
         self.cflags = ''
-        self.found = 0
+        self.found = False
         self.ver = '0'
         self.module = module
         self.header = header
  
     def configure(self):
-        self.found = 1
+        self.found = True
         if self.module:
             try:
                 self.ver = __import__(self.module).__version__
             except ImportError:
-                self.found = 0
+                self.found = False
         if self.found and self.header:
             fullpath = os.path.join(get_python_inc(0), self.header)
             if not os.path.isfile(fullpath):
             else:
                 self.inc_dir = os.path.split(fullpath)[0]
         if self.found:
-            print self.name + '        '[len(self.name):] + ': found', self.ver
+            print ("%-8.8s: found %s" % (self.name, self.ver))
         else:
-            print self.name + '        '[len(self.name):] + ': not found'
+            print ("%-8.8s: not found" % self.name)
 
 
 class DependencyDLL(Dependency):
         self.lib_name = lib
         self.test = re.compile(dll_regex, re.I).match
         self.lib_dir = '_'
-        self.found = 1
+        self.found = True
         self.link = link
 
     def configure(self):
                     if self.test(e) and os.path.isfile(os.path.join(path, e)):
                         # Found
                         self.lib_dir = os.path.join(path, e).replace('\\', '/')
-                        print "DLL for %s is %s" % (self.lib_name, self.lib_dir)
+                        print ("DLL for %s is %s" % (self.lib_name, self.lib_dir))
                         return
-        print "DLL for %s not found" % self.lib_name
+        print ("DLL for %s not found" % self.lib_name)
 
 class DependencyWin(object):
     def __init__(self, name, cflags):
         self.inc_dir = None
         self.lib_dir = None
         self.libs = []
-        self.found = 1
+        self.found = True
         self.cflags = cflags
         
     def configure(self):
 DEPS.add('PNG', 'png', ['libpng-[1-9].*'], r'(png|libpng13)\.dll$', ['z'])
 DEPS.add('JPEG', 'jpeg', ['jpeg-[6-9]*'], r'(lib){0,1}jpeg\.dll$')
 DEPS.add('PORTMIDI', 'portmidi', ['portmidi'], r'portmidi\.dll$')
+#DEPS.add('FFMPEG', 'libavformat/avformat.h', 'libavformat.a', ['avformat', 'swscale', 'SDL_mixer'], r'avformat-52\.dll')   
+dep = Dependency('FFMPEG', [r'avformat\.dll', r'swscale\.dll', r'SDL_mixer-[1-9].*'], ['avformat', 'swscale', 'SDL_mixer'], required=0)
+DEPS.dependencies.append(dep)
+DEPS.dlls.append(DependencyDLL(r'avformat\.dll', link=dep, libs=['avformat']))
+DEPS.dlls.append(DependencyDLL(r'swscale\.dll', link=dep, libs=['swscale']))
+DEPS.dlls.append(DependencyDLL(r'(lib){0,1}SDL_mixer\.dll$', link=dep, libs=['SDL', 'vorbisfile', 'smpeg']))
 #DEPS.add('PORTTIME', 'porttime', ['porttime'], r'porttime\.dll$')
 DEPS.add_dll(r'(lib){0,1}tiff\.dll$', 'tiff', ['tiff-[3-9].*'], ['jpeg', 'z'])
 DEPS.add_dll(r'(z|zlib1)\.dll$', 'z', ['zlib-[1-9].*'])
     return list(DEPS)
 
 if __name__ == '__main__':
-    print """This is the configuration subscript for Windows.
-Please run "config.py" for full configuration."""
+    print ("""This is the configuration subscript for Windows.
+Please run "config.py" for full configuration.""")