17702965 GObject bindings for Python3
authorAlan Coopersmith <Alan.Coopersmith@Oracle.COM>
Sun, 18 Sep 2016 10:50:41 -0700
changeset 6957 ff86c93b1c69
parent 6956 35dd98776277
child 6958 864721a3146f
17702965 GObject bindings for Python3
components/gnome/pygobject3/Makefile
components/gnome/pygobject3/depend.mk
components/gnome/pygobject3/pygobject-3-GENFRAG.p5m
components/gnome/pygobject3/pygobject-3-PYVER.p5m
--- a/components/gnome/pygobject3/Makefile	Wed Sep 21 19:51:41 2016 -0700
+++ b/components/gnome/pygobject3/Makefile	Sun Sep 18 10:50:41 2016 -0700
@@ -26,7 +26,7 @@
 # gobject-introspection bindings are only built correctly for gtk when building
 # with gcc, this would otherwise build with Studio.
 COMPILER =		gcc
-BUILD_BITS =		32_and_64
+BUILD_BITS =		64_and_32
 include ../../../make-rules/shared-macros.mk
 
 COMPONENT_NAME=		pygobject
@@ -34,7 +34,7 @@
 COMPONENT_PROJECT_URL=	https://wiki.gnome.org/Projects/PyGObject
 COMPONENT_ARCHIVE_HASH= \
 	sha256:2a3cad1517916b74e131e6002c3824361aee0671ffb0d55ded119477fc1c2c5f
-COMPONENT_BUGDB=       gnome/libraries
+COMPONENT_BUGDB=	gnome/libraries
 
 TPNO=			25832
 
@@ -45,9 +45,23 @@
 PUBLISH_STAMP=
 endif
 
-# Only build for 2.7 for now as we need 32-bit and 64-bit support; all of the
-# GNOME and desktop components must be built for Python 2.7 for now.
-PYTHON_VERSIONS= 2.7
+# replicated from $(WS_MAKE_RULES)/setup.py.mk since this uses configure.mk
+CONFIGURE_64 += $(PYTHON3_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.configured)
+$(BUILD_DIR)/%-3.4/.configured:		PYTHON_VERSION=3.4
+$(BUILD_DIR)/%-3.4/.configured:		PYTHON_VENDOR_PACKAGES=$(PYTHON_VENDOR_PACKAGES.32)
+$(BUILD_DIR)/%-3.5/.configured:		PYTHON_VERSION=3.5
+$(BUILD_DIR)/%-3.5/.configured:		PYTHON_VENDOR_PACKAGES=$(PYTHON_VENDOR_PACKAGES.32)
+$(BUILD_DIR)/$(MACH64)-%/.configured:	BITS=64
+
+BUILD_64 += $(PYTHON3_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.built)
+$(BUILD_DIR)/%-3.4/.built:		PYTHON_VERSION=3.4
+$(BUILD_DIR)/%-3.5/.built:		PYTHON_VERSION=3.5
+$(BUILD_DIR)/$(MACH64)-%/.built:	BITS=64
+
+INSTALL_64 += $(PYTHON3_VERSIONS:%=$(BUILD_DIR)/$(MACH64)-%/.installed)
+$(BUILD_DIR)/%-3.4/.installed:		PYTHON_VERSION=3.4
+$(BUILD_DIR)/%-3.5/.installed:		PYTHON_VERSION=3.5
+$(BUILD_DIR)/$(MACH64)-%/.installed:	BITS=64
 
 # Tests do not yet work with Userland framework - 23712631
 TEST_TARGET= $(SKIP_TEST)
@@ -70,6 +84,24 @@
 CONFIGURE_ENV += am_cv_python_pythondir=$(PYTHON_VENDOR_PACKAGES)
 CONFIGURE_ENV += am_cv_python_pyexecdir=$(PYTHON_VENDOR_PACKAGES)
 
+# Temporary until build machines install pycairo for python3
+PYCAIRO_BASE = $(WS_COMPONENTS)/python/pycairo/build/prototype/$(MACH)
+PKG_CONFIG_PATHS += $(PYCAIRO_BASE)$(PKG_CONFIG_DEFAULT)
+CPPFLAGS += -I $(PYCAIRO_BASE)/usr/include/pycairo
+
+# Override $(PYTHON) for configure step so that configure can find
+# $(PYTHON)-config properly
+$(BUILD_DIR)/%-3.4/.configured:	PYTHON=$(PYTHON.3.4)m
+$(BUILD_DIR)/%-3.5/.configured:	PYTHON=$(PYTHON.3.5)m
+
+# Make install path match what autopyc transforms look for
+COMPONENT_POST_INSTALL_ACTION += \
+    case "$(PYTHON_VERSION)" in \
+	2.7) $(MKDIR) $(PROTO_DIR)$(PYTHON_VENDOR_PACKAGES.32)/gi ; \
+	     $(SYMLINK) ../64/gi $(PROTO_DIR)$(PYTHON_VENDOR_PACKAGES.32)/gi/64 ;; \
+	3.4) $(SYMLINK) . $(PROTO_DIR)$(PYTHON_VENDOR_PACKAGES.32)/gi/64 ;; \
+    esac ;
+
 REQUIRED_PACKAGES += library/desktop/cairo
 REQUIRED_PACKAGES += library/desktop/gobject/gobject-introspection
 REQUIRED_PACKAGES += library/glib2
@@ -78,3 +110,5 @@
 # Pyflakes is needed for tests, but not build or install
 REQUIRED_PACKAGES += library/python/pyflakes
 REQUIRED_PACKAGES += runtime/python-27
+REQUIRED_PACKAGES += runtime/python-34
+REQUIRED_PACKAGES += runtime/python-35
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/gnome/pygobject3/depend.mk	Sun Sep 18 10:50:41 2016 -0700
@@ -0,0 +1,2 @@
+# Temporary until build machines install pycairo for python3
+gnome/pygobject3: python/pycairo
--- a/components/gnome/pygobject3/pygobject-3-GENFRAG.p5m	Wed Sep 21 19:51:41 2016 -0700
+++ b/components/gnome/pygobject3/pygobject-3-GENFRAG.p5m	Sun Sep 18 10:50:41 2016 -0700
@@ -28,6 +28,3 @@
 file path=usr/lib/$(MACH64)/pkgconfig/pygobject-3.0.pc
 file path=usr/lib/pkgconfig/pygobject-3.0.pc
 license COPYING license=LGPLv2.1
-depend type=conditional \
-    fmri=library/python/[email protected]$(IPS_COMPONENT_VERSION),$(BUILD_VERSION) \
-    predicate=runtime/python-27
--- a/components/gnome/pygobject3/pygobject-3-PYVER.p5m	Wed Sep 21 19:51:41 2016 -0700
+++ b/components/gnome/pygobject3/pygobject-3-PYVER.p5m	Sun Sep 18 10:50:41 2016 -0700
@@ -36,10 +36,8 @@
 set name=org.opensolaris.arc-caseid value=PSARC/2014/371 value=PSARC/2016/290
 set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
 #
-file usr/lib/python$(PYVER)/vendor-packages/64/gi/_gi.so \
-    path=usr/lib/python$(PYVER)/vendor-packages/gi/64/_gi.so
-file usr/lib/python$(PYVER)/vendor-packages/64/gi/_gi_cairo.so \
-    path=usr/lib/python$(PYVER)/vendor-packages/gi/64/_gi_cairo.so
+file path=usr/lib/python$(PYVER)/vendor-packages/gi/64/_gi.so
+file path=usr/lib/python$(PYVER)/vendor-packages/gi/64/_gi_cairo.so
 file path=usr/lib/python$(PYVER)/vendor-packages/gi/__init__.py
 file path=usr/lib/python$(PYVER)/vendor-packages/gi/_constants.py
 file path=usr/lib/python$(PYVER)/vendor-packages/gi/_error.py