[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] MSYS compile question



This patch to config_msys.py gets it working again if the libraries are in /usr/local .

René Dudfield wrote:
hi,

I think we can drop python2.3 + msys support on windows.  As you say
the distributed SDL binaries can be used - plus 2.3 is getting pretty
old now.

Cheers,

On 8/19/07, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
On what system was/is pygame setup.py run on MSYS. I cannot get os.popen
to work in congif_msys.py. However subprocess.Popen works. But this is
not available on Python 2.3. How important is it to allow a Python 2.3
build of pygame 1.8 using msys on Windows anyway? SDL binaries linked
against msvcrt.dll are
available.

--
Lenard Lindstrom
<len-l@xxxxxxxxx>




--
Lenard Lindstrom
<len-l@xxxxxxxxx>

3a4,5
> import subprocess
> import re
15a18,30
> 
> msys_root = re.sub('[^/]+/[^/]+', '', os.environ['SHELL'][::-1], 1)[::-1]  # Get msys root directory
> drive_pattern = re.compile('/[A-Z]/', re.I)
> 
> def msys_to_windows(path):
>     if path.startswith('/usr'):
>         return msys_root + path[4:]
>     elif re.match(drive_pattern, path) is not None:
>         return path[1] + ":" + path[3:]
>     elif path.startswith('/'):
>         return msys_root + path[1:]
>     return path
> 
26a42,45
>         drv, pth = os.path.splitdrive(command)
>         if drv:
>             command = '/' + drv[0] + pth
>         shell = os.environ['SHELL']
32,34c51,56
<             config = os.popen(command + ' --version --cflags --libs').readlines()
<             flags = string.split(string.join(config[1:], ' '))
<             self.ver = string.strip(config[0])
---
>             config = subprocess.Popen([shell, command, '--version', '--cflags', '--libs'],
>                                       stdout=subprocess.PIPE
>                                       ).communicate()[0]
>             ver, flags = config.split('\n', 1)
>             self.ver = ver.strip()
>             flags = flags.split()
75c97
<             if os.path.isfile(path):
---
>             if os.path.isfile(msys_to_windows(path)):
79c101
<                 path = os.path.join(dir, name)
---
>                 path = msys_to_windows(os.path.join(dir, name))
118a141,152
> class DependencyWin:
>     def __init__(self, name, libs):
>         self.name = name
>         self.inc_dir = None
>         self.lib_dir = None
>         self.libs = libs
>         self.found = 1
>         self.cflags = ''
>         
>     def configure(self, incdirs, libdirs):
>         pass
> 
127,129c161,163
<         Dependency('FONT', 'SDL_ttf.h', 'libSDL_ttf.so', ['SDL_ttf']),
<         Dependency('IMAGE', 'SDL_image.h', 'libSDL_image.so', ['SDL_image']),
<         Dependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer.so', ['SDL_mixer']),
---
>         Dependency('FONT', 'SDL_ttf.h', 'libSDL_ttf.a', ['SDL_ttf']),
>         Dependency('IMAGE', 'SDL_image.h', 'libSDL_image.a', ['SDL_image']),
>         Dependency('MIXER', 'SDL_mixer.h', 'libSDL_mixer.a', ['SDL_mixer']),
131c165,168
<         DependencyPython('NUMERIC', 'Numeric', 'Numeric/arrayobject.h')
---
>         Dependency('PNG', 'png.h', 'libpng.a', ['png']),
>         Dependency('JPEG', 'jpeglib.h', 'libjpeg.a', ['jpeg']),
>         DependencyPython('NUMERIC', 'Numeric', 'Numeric/arrayobject.h'),
>         DependencyWin('SCRAP', ['user32', 'gdi32']),