[pygtk] Bug 589671 - Fix setup.py for windows build



commit f0d8199252e79e5e257b0b92c2ecf3f92afc7ea1
Author: John Stowers <john stowers gmail com>
Date:   Sat May 8 10:59:22 2010 +1200

    Bug 589671 - Fix setup.py for windows build
    
    reduce the number of build combinations, by making more
    dependencies compulsory. Experienced hackers will know how to
    change this anyway.
    
    This means atk,pango,pangocairo, pycairo and gtk are
    explicitly compulsory.
    
    Only libglade and numpy support is optional now

 README.win32 |   10 ++++++----
 setup.py     |   50 ++++++++++++++++++++++++++++----------------------
 2 files changed, 34 insertions(+), 26 deletions(-)
---
diff --git a/README.win32 b/README.win32
index 548a3c8..fc67c5b 100644
--- a/README.win32
+++ b/README.win32
@@ -3,15 +3,16 @@ Windows Setuptools Build Instructions
 
   1. Install gtk+ bundle from gtk.org (to C:\GTK for example)
   2. Install Python2.6
-  3. Install MinGW and MSYS
-  4. Add C:\GTK\bin to path (from windows)
-  5. Add the following to your msys environment variables 
+  3. Install pycairo (python cairo bindings)
+  4. Install MinGW and MSYS
+  5. Add C:\GTK\bin to path (from windows)
+  6. Add the following to your msys environment variables 
      (open and append to C:\msys\1.0\etc\profile) or set for the session
 
      $ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/c/GTK/lib/pkgconfig:/c/Python26/Lib/pkgconfig
      $ export PATH=$PATH:/c/Python26:/c/Python26/bin
 
-  6. In msys shell, build with
+  7. In msys shell, build with
 
      $ python setup.py build --compiler=mingw32 --enable-threading \
        --yes-i-know-its-not-supported bdist_wininst
@@ -21,4 +22,5 @@ Tested with
   * MinGW-5.16.exe
   * MSYS-1.0.11.exe
   * python-2.6.5.exe
+  * pycairo-1.8.6.win32-py2.6.exe
 
diff --git a/setup.py b/setup.py
index 737c422..5d1d2dd 100755
--- a/setup.py
+++ b/setup.py
@@ -164,8 +164,7 @@ pango = TemplateExtension(name='pango',
 # Pangocairo
 pangocairo = TemplateExtension(name='pangocairo',
                                pkc_name=('pycairo', 'pangocairo'),
-                               pkc_version=(PYCAIRO_REQUIRED,
-                                            PANGO_REQUIRED),
+                               pkc_version=(PYCAIRO_REQUIRED, PANGO_REQUIRED),
                                sources=['pangocairo.c', 'pangocairomodule.c'],
                                register=['pango-types.defs'],
                                override='pangocairo.override',
@@ -181,9 +180,6 @@ gdk_template = Template('gtk/gdk.override', 'gtk/gdk.c',
                                   ('gtk/gdk-types.defs',gdk_defs)],
                         py_ssize_t_clean=True)
 # Gtk+
-gtk_pkc_name=('gtk+-2.0','pycairo')
-gtk_pkc_version=(GTK_REQUIRED,PYCAIRO_REQUIRED)
-
 gtk_pkc_defs=('gtk/gtk.defs',gtk_defs)
 gtk_pkc_register=['%s/gio-types.defs' % PYGOBJECT_DEFSDIR,
                   'atk-types.defs',
@@ -194,8 +190,8 @@ libglade_pkc_register=[('gtk/gdk-types.defs',['gtk/gdk-base-types.defs']),
                        ('gtk/gtk-types.defs',gtk_types_defs),
                        'gtk/libglade.defs']
 
-gtk = TemplateExtension(name='gtk', pkc_name=gtk_pkc_name,
-                        pkc_version=gtk_pkc_version,
+gtk = TemplateExtension(name='gtk', pkc_name=('gtk+-2.0','pycairo'),
+                        pkc_version=(GTK_REQUIRED, PYCAIRO_REQUIRED),
                         output='gtk._gtk',
                         sources=['gtk/gtkmodule.c',
                                  'gtk/gtkobject-support.c',
@@ -226,16 +222,6 @@ ext_modules = []
 py_modules = []
 packages = []
 
-if atk.can_build():
-    ext_modules.append(atk)
-    data_files.append((DEFS_DIR, ('atk.defs', 'atk-types.defs')))
-if pango.can_build():
-    ext_modules.append(pango)
-    data_files.append((DEFS_DIR, ('pango.defs', 'pango-types.defs')))
-    if pangocairo.can_build():
-        ext_modules.append(pangocairo)
-        data_files.append((DEFS_DIR, ('pangocairo.defs',)))
-        GLOBAL_MACROS.append(('HAVE_PYCAIRO',1))
 if gtk.can_build():
     if '--disable-numpy' in sys.argv:
         sys.argv.remove('--disable-numpy')
@@ -245,8 +231,8 @@ if gtk.can_build():
             numpy # pyflakes
             GLOBAL_MACROS.append(('HAVE_NUMPY', 1))
         except ImportError:
-            print ('* numpy module could not be found, '
-                   'will build without numpy support.')
+            print '* numpy module could not be found, will build without numpy support.'
+
     ext_modules.append(gtk)
     data_files.append((os.path.join(INCLUDE_DIR, 'pygtk'), ('gtk/pygtk.h',)))
     data_files.append((DEFS_DIR, gdk_defs))
@@ -257,9 +243,29 @@ if gtk.can_build():
     py_modules += ['gtk.compat', 'gtk.deprecation', 'gtk.keysyms',
                    'gtk._lazyutils']
 
-if libglade.can_build():
-    ext_modules.append(libglade)
-    data_files.append((DEFS_DIR, ('gtk/libglade.defs',)))
+    if atk.can_build():
+        ext_modules.append(atk)
+        data_files.append((DEFS_DIR, ('atk.defs', 'atk-types.defs')))
+    else:
+        raise SystemExit("ERROR: Nothing to do, atk could not be built and is essential.")
+
+    if pango.can_build():
+        ext_modules.append(pango)
+        data_files.append((DEFS_DIR, ('pango.defs', 'pango-types.defs')))
+        if pangocairo.can_build():
+            ext_modules.append(pangocairo)
+            data_files.append((DEFS_DIR, ('pangocairo.defs',)))
+            GLOBAL_MACROS.append(('HAVE_PYCAIRO',1))
+        else:
+            raise SystemExit("ERROR: Nothing to do, pangocairo could not be built and is essential.")
+    else:
+        raise SystemExit("ERROR: Nothing to do, pango could not be built and is essential.")
+
+    if libglade.can_build():
+        ext_modules.append(libglade)
+        data_files.append((DEFS_DIR, ('gtk/libglade.defs',)))
+else:
+    raise SystemExit("ERROR: Nothing to do, gtk could not be built and is essential.")
 
 # Threading support
 if '--disable-threading' in sys.argv:



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