[csw-maintainers] Python 2.7

Maciej (Matchek) Bliziński maciej at opencsw.org
Fri Jul 19 10:04:16 CEST 2013


Here's how I propose we build modules for different Python versions:

>From d905994a8496be4c1c3daea2df53df320e100e31 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maciej=20Blizi=C5=84ski?= <m... at opencsw.org>
Date: Fri, 19 Jul 2013 08:50:45 +0100
Subject: [PATCH] Build Python modules for different versions

---
 categories/python/category.mk |  6 +++---
 gar.conf.mk                   | 28 ++++++++++++++++++++++++++++
 gar.lib.mk                    |  6 +++---
 3 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/categories/python/category.mk b/categories/python/category.mk
index 5c69f0f..daaf10d 100644
--- a/categories/python/category.mk
+++ b/categories/python/category.mk
@@ -1,5 +1,5 @@
 # Add a dependency to CSWpython
-_EXTRA_GAR_PKGS += CSWpython
+_EXTRA_GAR_PKGS += $(PYTHON_PACKAGE)

 # For the record, do not include the following line:
 # _MERGE_EXCLUDE_CATEGORY += .*\.egg-info.*
@@ -28,11 +28,11 @@ TEST_TARGET ?= test
 LICENSE ?= PKG-INFO
 SPKG_SOURCEURL ?= http://pypi.python.org/pypi/$(NAME)
 MASTER_SITES ?= $(PYPI_MIRROR)
-PACKAGES ?= CSWpy-$(DASHED_NAME)
+PACKAGES ?= $(PYTHON_MODULE_PACKAGE_PREFIX)$(DASHED_NAME)

 # for use in any references by specific recipes so it can be replaced easily
 # across the tree.  this could later be parameterized for use by multiple
 # versions of python too.
-SITE_PACKAGES = $(libdir)/python2.6/site-packages
+SITE_PACKAGES = $(PYTHON_SITE_PACKAGES)

 include gar/gar.mk
diff --git a/gar.conf.mk b/gar.conf.mk
index 433faa2..eeb0a81 100644
--- a/gar.conf.mk
+++ b/gar.conf.mk
@@ -854,6 +854,34 @@ endif

 INSTALL_SCRIPTS   ?= $(WORKSRC)/Makefile

+################################################################################
+#
+# Python configuration
+
+PYTHON_VERSION ?= 2_6
+
+PYTHON_EXECUTABLE_2_6 = /opt/csw/bin/python2.6
+PYTHON_EXECUTABLE_2_7 = /opt/csw/bin/python2.7
+PYTHON_EXECUTABLE_3_3 = /opt/csw/bin/python3.3
+PYTHON_EXECUTABLE = $(PYTHON_EXECUTABLE_$(PYTHON_VERSION))
+
+PYTHON_PACKAGE_2_6 = CSWpython
+PYTHON_PACKAGE_2_7 = CSWpython27
+PYTHON_PACKAGE_3_3 = CSWpython33
+PYTHON_PACKAGE = $(PYTHON_PACKAGE_$(PYTHON_VERSION))
+
+PYTHON_SITE_PACKAGES_2_6 = $(libdir)/python/site-packages
+PYTHON_SITE_PACKAGES_2_7 = $(libdir)/python2.7/site-packages
+PYTHON_SITE_PACKAGES_3_3 = $(libdir)/python3.3/site-packages
+PYTHON_SITE_PACKAGES = $(PYTHON_SITE_PACKAGES_$(PYTHON_VERSION))
+
+PYTHON_MODULE_PACKAGE_PREFIX_2_6 = CSWpy-
+PYTHON_MODULE_PACKAGE_PREFIX_2_7 = CSWpy27-
+PYTHON_MODULE_PACKAGE_PREFIX_3_3 = CSWpy33-
+PYTHON_MODULE_PACKAGE_PREFIX =
$(PYTHON_MODULE_PACKAGE_PREFIX_$(PYTHON_VERSION))
+
+################################################################################
+
 # Global environment
 export PATH PKG_CONFIG_PATH

diff --git a/gar.lib.mk b/gar.lib.mk
index 781bd5d..5f00970 100644
--- a/gar.lib.mk
+++ b/gar.lib.mk
@@ -905,7 +905,7 @@ build-%/waf:
 PYBUILD_CMD ?= build
 build-%/setup.py:
  @echo " ==> Running setup.py $(PYBUILD_TYPE) in $*"
- @( cd $* ; $(BUILD_ENV) python ./setup.py $(PYBUILD_CMD) $(BUILD_ARGS) )
+ @( cd $* ; $(BUILD_ENV) $(PYTHON_EXECUTABLE) ./setup.py
$(PYBUILD_CMD) $(BUILD_ARGS) )
  @$(MAKECOOKIE)

 #################### CLEAN RULES ####################
@@ -982,7 +982,7 @@ test-%/waf:

 test-%/setup.py:
  @echo " ==> Running setup.py test in $*"
- @( cd $* ; cd $(OBJDIR) ; $(TEST_ENV) python ./setup.py test $(TEST_ARGS) )
+ @( cd $* ; cd $(OBJDIR) ; $(TEST_ENV) $(PYTHON_EXECUTABLE)
./setup.py test $(TEST_ARGS) )
  @$(MAKECOOKIE)

 ################# INSTALL RULES ####################
@@ -1030,7 +1030,7 @@ install-%/waf:
 PYINSTALL_CMD ?= install
 install-%/setup.py:
  @echo " ==> Running setup.py $(PYINSTALL_CMD) in $*"
- @( cd $* ; $(INSTALL_ENV) python ./setup.py $(PYINSTALL_CMD) $(INSTALL_ARGS) )
+ @( cd $* ; $(INSTALL_ENV) $(PYTHON_EXECUTABLE) ./setup.py
$(PYINSTALL_CMD) $(INSTALL_ARGS) )
  @$(MAKECOOKIE)

 # pkg-config scripts
--
1.8.3.1


More information about the maintainers mailing list