[pygobject/py3k: 7/7] Merge branch master into py3k



commit d570e692a648daab52297f0f9b331a75d231c89f
Merge: 2e2fd14 695ac7b
Author: John Ehresman <jpe wingware com>
Date:   Fri Apr 16 16:07:02 2010 -0400

    Merge branch master into py3k
    
    Conflicts:
    	dsextras.py
    	gio/giomodule.c
    	gobject/constants.py
    	gobject/gobjectmodule.c
    	setup.py

 Makefile.am              |    1 +
 README.win32             |   24 +++++++++++++++++
 dsextras.py              |    6 ++++
 gio/giomodule.c          |    3 ++
 glib/pygiochannel.c      |    1 +
 gobject/Makefile.am      |    3 +-
 gobject/gobjectmodule.c  |   63 ++++++++++++++++++++++++----------------------
 pygobject_postinstall.py |   43 +++++++++++++++++++------------
 setup.py                 |   24 +++++++++++------
 tests/runtests.py        |    3 +-
 10 files changed, 111 insertions(+), 60 deletions(-)
---
diff --cc dsextras.py
index d3e0d2e,10973e2..f5d4a86
--- a/dsextras.py
+++ b/dsextras.py
@@@ -315,9 -312,9 +315,15 @@@ class PkgConfigExtension(Extension)
                  self.can_build_ok = 1
                  return 1
              else:
++<<<<<<< HEAD:dsextras.py
 +                print ("Warning: Too old version of %s" % self.pkc_name)
 +                print ("         Need %s, but %s is installed" % \
 +                       (version, orig_version))
++=======
+                 print "Warning: Too old version of %s" % self.pkc_name
+                 print "         Need %s, but %s is installed" % \
+                       (version, orig_version)
++>>>>>>> 695ac7bc5c60371a32538d690c7a15509f3c9637:dsextras.py
                  self.can_build_ok = 0
                  return 0
  
diff --cc gio/giomodule.c
index 292a0d9,409aeef..868e685
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@@ -39,24 -39,26 +39,27 @@@ void pygio_add_constants(PyObject *modu
  
  extern PyMethodDef pygio_functions[];
  
 -DL_EXPORT(void)
 -init_gio(void)
 +PYGLIB_INIT_FUNCTION(_gio, "gio._gio", pygio_functions)
  {
 -    PyObject *m, *d;
 +    PyObject *d;
      PyObject *tuple;
      PyObject *e;
 +    PyObject *pygobject_mod;
      /* perform any initialisation required by the library here */
  
 -    m = Py_InitModule("gio._gio", pygio_functions);
 -    d = PyModule_GetDict(m);
 +    d = PyModule_GetDict(module);
  
+     g_type_init();
+     pyglib_init();
 -
 -    init_pygobject_check(2, 15, 2);
 -
++ 
 +    pygobject_mod = pygobject_init(2, 15, 2);
 +    if (pygobject_mod == NULL)
 +        return -1;
 +    
      pygio_register_classes(d);
 -    pygio_add_constants(m, "G_IO_");
 +    pygio_add_constants(module, "G_IO_");
  
 -    PyModule_AddStringConstant(m, "ERROR", g_quark_to_string(G_IO_ERROR));
 +    PyModule_AddStringConstant(module, "ERROR", g_quark_to_string(G_IO_ERROR));
      e = pyglib_register_exception_for_domain("gio.Error", G_IO_ERROR);
      PyDict_SetItemString(d, "Error", e);
      Py_DECREF(e);
diff --cc gobject/gobjectmodule.c
index 63d2ca5,6fc7b51..30ffd7b
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@@ -2535,36 -2523,39 +2535,39 @@@ static voi
  pygobject_register_constants(PyObject *m)
  {
      /* PyFloat_ return a new ref, and add object takes the ref */
-     PyModule_AddObject(m, "G_MINFLOAT", PyFloat_FromDouble(G_MINFLOAT));
-     PyModule_AddObject(m, "G_MAXFLOAT", PyFloat_FromDouble(G_MAXFLOAT));
-     PyModule_AddObject(m, "G_MINDOUBLE", PyFloat_FromDouble(G_MINDOUBLE));
-     PyModule_AddObject(m, "G_MAXDOUBLE", PyFloat_FromDouble(G_MAXDOUBLE));
- 
-     PyModule_AddIntConstant(m, "G_MINSHORT", G_MINSHORT);
-     PyModule_AddIntConstant(m, "G_MAXSHORT", G_MAXSHORT);
-     PyModule_AddIntConstant(m, "G_MAXUSHORT", G_MAXUSHORT);
-     PyModule_AddIntConstant(m, "G_MININT", G_MININT);
-     PyModule_AddIntConstant(m, "G_MAXINT", G_MAXINT);
-     PyModule_AddIntConstant(m, "G_MAXUINT", G_MAXUINT);
-     PyModule_AddIntConstant(m, "G_MINLONG", G_MINLONG);
-     PyModule_AddIntConstant(m, "G_MAXLONG", G_MAXLONG);
-     PyModule_AddObject(m, "G_MAXULONG", PyLong_FromUnsignedLong(G_MAXULONG));
-     PyModule_AddIntConstant(m, "G_MININT8", G_MININT8);
-     PyModule_AddIntConstant(m, "G_MAXINT8", G_MAXINT8);
-     PyModule_AddIntConstant(m, "G_MAXUINT8", G_MAXUINT8);
-     PyModule_AddIntConstant(m, "G_MININT16", G_MININT16); 
-     PyModule_AddIntConstant(m, "G_MAXINT16", G_MAXINT16);
-     PyModule_AddIntConstant(m, "G_MAXUINT16", G_MAXUINT16);
-     PyModule_AddIntConstant(m, "G_MININT32", G_MININT32);
-     PyModule_AddIntConstant(m, "G_MAXINT32", G_MAXINT32);
-     PyModule_AddObject(m, "G_MAXUINT32", PyLong_FromUnsignedLong(G_MAXUINT32));
-     PyModule_AddObject(m, "G_MININT64",PyLong_FromLong( G_MININT64));
-     PyModule_AddObject(m, "G_MAXINT64", PyLong_FromLong(G_MAXINT64));
-     PyModule_AddObject(m, "G_MAXUINT64", PyLong_FromUnsignedLong(G_MAXUINT64));
-     PyModule_AddObject(m, "G_MAXSIZE", PyLong_FromUnsignedLong(G_MAXSIZE));
-     PyModule_AddObject(m, "G_MAXSSIZE", PyLong_FromUnsignedLong(G_MAXSSIZE));
-     PyModule_AddObject(m, "G_MINOFFSET", PyLong_FromLong(G_MINOFFSET));
-     PyModule_AddObject(m, "G_MAXOFFSET", PyLong_FromLong(G_MAXOFFSET));
+     PyModule_AddObject(m,       "G_MINFLOAT", PyFloat_FromDouble(G_MINFLOAT));
+     PyModule_AddObject(m,       "G_MAXFLOAT", PyFloat_FromDouble(G_MAXFLOAT));
+     PyModule_AddObject(m,       "G_MINDOUBLE", PyFloat_FromDouble(G_MINDOUBLE));
+     PyModule_AddObject(m,       "G_MAXDOUBLE", PyFloat_FromDouble(G_MAXDOUBLE));
+     PyModule_AddIntConstant(m,  "G_MINSHORT", G_MINSHORT);
+     PyModule_AddIntConstant(m,  "G_MAXSHORT", G_MAXSHORT);
+     PyModule_AddIntConstant(m,  "G_MAXUSHORT", G_MAXUSHORT);
+     PyModule_AddIntConstant(m,  "G_MININT", G_MININT);
+     PyModule_AddIntConstant(m,  "G_MAXINT", G_MAXINT);
+     PyModule_AddObject(m,       "G_MINLONG", PyLong_FromLong(G_MINLONG));
+     PyModule_AddObject(m,       "G_MAXLONG", PyLong_FromLong(G_MAXLONG));
+     PyModule_AddObject(m,       "G_MAXULONG", PyLong_FromUnsignedLong(G_MAXULONG));
+     PyModule_AddIntConstant(m,  "G_MININT8", G_MININT8);
+     PyModule_AddIntConstant(m,  "G_MAXINT8", G_MAXINT8);
+     PyModule_AddIntConstant(m,  "G_MAXUINT8", G_MAXUINT8);
+     PyModule_AddIntConstant(m,  "G_MININT16", G_MININT16);
+     PyModule_AddIntConstant(m,  "G_MAXINT16", G_MAXINT16);
+     PyModule_AddIntConstant(m,  "G_MAXUINT16", G_MAXUINT16);
+     PyModule_AddIntConstant(m,  "G_MININT32", G_MININT32);
+     PyModule_AddIntConstant(m,  "G_MAXINT32", G_MAXINT32);
+     PyModule_AddObject(m,       "G_MININT64", PyLong_FromLongLong(G_MININT64));
+     PyModule_AddObject(m,       "G_MAXINT64", PyLong_FromLongLong(G_MAXINT64));
+     PyModule_AddObject(m,       "G_MAXUINT64", PyLong_FromUnsignedLongLong(G_MAXUINT64));
 -    PyModule_AddObject(m,       "G_MAXSIZE", PyLong_FromSize_t(G_MAXSIZE));
 -    PyModule_AddObject(m,       "G_MAXSSIZE", PyLong_FromSsize_t(G_MAXSSIZE));
++    PyModule_AddObject(m,       "G_MAXSIZE", PyLong_FromUnsignedLongLong(G_MAXSIZE));
++    PyModule_AddObject(m,       "G_MAXSSIZE", PyLong_FromUnsignedLongLong(G_MAXSSIZE));
+     PyModule_AddObject(m,       "G_MINOFFSET", PyLong_FromLongLong(G_MINOFFSET));
+     PyModule_AddObject(m,       "G_MAXOFFSET", PyLong_FromLongLong(G_MAXOFFSET));
+ 
+     /* in order for test_properties to pass, G_MAXUINT must be initialized using
+        PyLong_FromUnsignedLong, despite AFAICT it is unecessary for 32bit int types.
+        In the interests of consistancy I did the same for MAXUINT32 */
+     PyModule_AddObject(m,       "G_MAXUINT32", PyLong_FromUnsignedLong(G_MAXUINT32));
+     PyModule_AddObject(m,       "G_MAXUINT", PyLong_FromUnsignedLong(G_MAXUINT));
  
      PyModule_AddIntConstant(m, "SIGNAL_RUN_FIRST", G_SIGNAL_RUN_FIRST);
      PyModule_AddIntConstant(m, "SIGNAL_RUN_LAST", G_SIGNAL_RUN_LAST);
diff --cc setup.py
index 633e19d,0999c00..295dbad
--- a/setup.py
+++ b/setup.py
@@@ -20,24 -20,19 +20,22 @@@ from dsextras import get_m4_define, get
  if '--yes-i-know-its-not-supported' in sys.argv:
      sys.argv.remove('--yes-i-know-its-not-supported')
  else:
 -    print '*'*70
 -    print 'Building PyGObject using distutils is NOT SUPPORTED.'
 -    print "It's mainly included to be able to easily build win32 installers"
 -    print "You may continue, but only if you agree to not ask any questions"
 -    print "To build PyGObject in a supported way, read the INSTALL file"
 -    print
 -    print "Build fixes are of course welcome and should be filed in bugzilla"
 -    print '*'*70
 -    input = raw_input('Not supported, ok [y/N]? ')
 +    print ('*'*70)
 +    print ('Building PyGObject using distutils is NOT SUPPORTED.')
 +    print ("It's mainly included to be able to easily build win32 installers")
 +    print ("You may continue, but only if you agree to not ask any questions")
 +    print ("To build PyGObject in a supported way, read the INSTALL file")
 +    print ("")
 +    print ("Build fixes are of course welcome and should be filed in bugzilla")
 +    print ('*'*70)
 +    if sys.version_info < (3, 0):
 +        input = raw_input('Not supported, ok [y/N]? ')
 +    else:
 +        input = input('Not supported, ok [y/N]? ')
      if not input.startswith('y'):
-         raise SystemExit
+         raise SystemExit("Aborted")
  
- if sys.version_info[:3] < (2, 3, 5):
-     raise SystemExit("Python 2.3.5 or higher is required, %d.%d.%d found"
-                      % sys.version_info[:3])
+ MIN_PYTHON_VERSION = (2, 3, 5)
  
  MAJOR_VERSION = int(get_m4_define('pygobject_major_version'))
  MINOR_VERSION = int(get_m4_define('pygobject_minor_version'))
@@@ -58,12 -53,18 +56,20 @@@ GLOBAL_MACROS += [('PYGOBJECT_MAJOR_VER
  if sys.platform == 'win32':
      GLOBAL_MACROS.append(('VERSION', '"""%s"""' % VERSION))
  else:
 -    raise SystemExit("Error: distutils build only supported on windows")
 +    GLOBAL_MACROS.append(('VERSION', '"%s"' % VERSION))
  
+ if sys.version_info[:3] < MIN_PYTHON_VERSION:
+     raise SystemExit("Python %s or higher is required, %s found" % (
+         ".".join(map(str,MIN_PYTHON_VERSION)),
+                      ".".join(map(str,sys.version_info[:3]))))
+ 
+ if not have_pkgconfig():
+     raise SystemExit("Error, could not find pkg-config")
+ 
  DEFS_DIR    = os.path.join('share', 'pygobject', PYGOBJECT_SUFFIX, 'defs')
  INCLUDE_DIR = os.path.join('include', 'pygtk-%s' % PYGOBJECT_SUFFIX)
 +XSL_DIR = os.path.join('share', 'pygobject','xsl')
 +HTML_DIR = os.path.join('share', 'gtk-doc', 'html', 'pygobject')
  
  class PyGObjectInstallLib(InstallLib):
      def run(self):
@@@ -176,10 -175,6 +180,12 @@@ ext_modules = [
  py_modules = ['dsextras']
  packages = ['codegen']
  
- if not have_pkgconfig():
-     print ("Error, could not find pkg-config")
-     raise SystemExit
++
++#Install dsextras and codegen so that the pygtk installer
++#can find them
++py_modules = ['dsextras']
++packages = ['codegen']
 +
  if glib.can_build():
      #It would have been nice to create another class, such as PkgConfigCLib to
      #encapsulate this dictionary, but it is impossible. build_clib.py does



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