dev-python/cgkit: Add py3.5 support

* EAPI 6
* Call distutils-r1_python_prepare_all
* Fix compiling in C++14 mode with GCC 6

Bug: https://bugs.gentoo.org/show_bug.cgi?id=611774
Package-Manager: Portage-2.3.4, Repoman-2.3.2
This commit is contained in:
David Seifert
2017-03-11 01:00:45 +01:00
parent eb3c6a3726
commit c1ec4fe569
3 changed files with 158 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
PYTHON_COMPAT=( python{2_7,3_4,3_5} )
DISTUTILS_IN_SOURCE_BUILD=1
inherit distutils-r1 scons-utils toolchain-funcs
MY_P="${P/_/}"
DESCRIPTION="Python library for creating 3D images"
HOMEPAGE="http://cgkit.sourceforge.net"
SRC_URI="
$(python_gen_cond_dep mirror://sourceforge/${PN}/${PN}/${P}/${P}-py2k.tar.gz 'python2*')
$(python_gen_cond_dep mirror://sourceforge/${PN}/${PN}/${P}/${P}-py3k.tar.gz 'python3*')"
LICENSE="LGPL-2.1 MPL-1.1 GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="3ds"
RDEPEND="
>=dev-libs/boost-1.48[python,${PYTHON_USEDEP}]
$(python_gen_cond_dep 'dev-python/pyprotocols[${PYTHON_USEDEP}]' 'python2*')
dev-python/pyopengl[${PYTHON_USEDEP}]
dev-python/pygame[${PYTHON_USEDEP}]
dev-python/pillow[${PYTHON_USEDEP}]
3ds? ( ~media-libs/lib3ds-1.3.0 )"
DEPEND="${RDEPEND}"
src_unpack() {
cgkit_unpack() {
local tarball
if python_is_python3; then
tarball=${P}-py3k.tar.gz
else
tarball=${P}-py2k.tar.gz
fi
mkdir "${BUILD_DIR}" || die
tar -C "${BUILD_DIR}" -x --strip-components 1 -f "${DISTDIR}/${tarball}" || die
}
python_foreach_impl cgkit_unpack
mkdir "${S}" || die
}
python_prepare() {
eapply \
"${FILESDIR}"/${PN}-2.0.0-fix-build-system.patch \
"${FILESDIR}"/${PN}-2.0.0-fix-c++14.patch
if python_is_python3; then
eapply "${FILESDIR}"/${PN}-py3k-pillow.patch
else
eapply "${FILESDIR}"/${PN}-py2k-pillow.patch
fi
cp config_template.cfg config.cfg || die
cat >> config.cfg <<- _EOF_ || die
BOOST_LIB = 'boost_python-${EPYTHON#python}'
LIBS += ['GL', 'GLU', 'glut']
LIB3DS_AVAILABLE = $(usex 3ds True False)
_EOF_
# Remove invalid test
rm -f unittests/test_pointcloud.py || die
}
python_configure_all() {
tc-export AR CXX
}
python_compile() {
pushd supportlib >/dev/null || die
CXXFLAGS="${CXXFLAGS} -fPIC" escons
popd >/dev/null || die
distutils-r1_python_compile
}
python_test() {
pushd unittests >/dev/null || die
mkdir tmp || die
"${EPYTHON}" all.py || die "Testing failed with ${EPYTHON}"
popd >/dev/null || die
}

View File

@@ -0,0 +1,40 @@
Make scons respect user variables
--- a/setup.py
+++ b/setup.py
@@ -214,7 +214,7 @@
# The following variables are used to customize the compile process
-INC_DIRS = []
+INC_DIRS = ['/usr/include']
LIB_DIRS = []
LIBS = []
CC_ARGS = []
--- a/supportlib/SConstruct
+++ b/supportlib/SConstruct
@@ -30,19 +30,11 @@
# Add the local 'include' directory...
env.Append(CPPPATH = ["include"])
-# Do platform specific stuff...
-if sys.platform=="win32":
- env.Append(CCFLAGS = ["/GX", "/GR", "/MD", "/W3"])
- env.Append(CPPDEFINES = ["WIN32", "_LIB"])
-elif sys.platform=="darwin":
- env.Append(CCFLAGS = ["-arch", "x86_64"])
- env.Append(CCFLAGS = ["-arch", "i386"])
-# env.Append(CCFLAGS = ["-arch", "ppc"])
- env.Append(CPPPATH = ["/opt/local/include"])
- env.Append(CCFLAGS = ["-fPIC"])
-else:
- env.Append(CPPPATH = ["/opt/local/include"])
- env.Append(CCFLAGS = ["-fPIC"])
+env.Append(CPPPATH = ['/usr/include'])
+env['AR'] = os.environ.get('AR', 'ar')
+env['CXX'] = os.environ.get('CXX', 'g++')
+env['CXXFLAGS'] = os.environ.get('CXXFLAGS', '-fPIC')
+env['CPPFLAGS'] = os.environ.get('CPPFLAGS', '')
# Setup the help message
Help(vars.GenerateHelpText(env))

View File

@@ -0,0 +1,33 @@
Fix building in C++14 mode
--- a/wrappers/py_geoms1.cpp
+++ b/wrappers/py_geoms1.cpp
@@ -142,7 +142,7 @@
string name = it->first;
const PrimVarInfo& info = it->second;
it++;
- return make_tuple(name, info.storage, info.type, info.multiplicity);
+ return boost::python::make_tuple(name, info.storage, info.type, info.multiplicity);
}
}
@@ -163,7 +163,7 @@
}
else
{
- return make_tuple(name, info->storage, info->type, info->multiplicity);
+ return boost::python::make_tuple(name, info->storage, info->type, info->multiplicity);
}
}
--- a/wrappers/py_slot.h
+++ b/wrappers/py_slot.h
@@ -40,7 +40,7 @@
// .def("onValueChanged", &Slot<double>::onValueChanged, &SlotWrapper<double>::base_onValueChanged)
// This macro can be used to create a new Python array slot type
-#define ARRAYSLOT(sname,stype) class_<_ArraySlotIterator<stype> >("_"sname"_Iterator", init<ArraySlot<stype>&>()) \
+#define ARRAYSLOT(sname,stype) class_<_ArraySlotIterator<stype> >("_" sname "_Iterator", init<ArraySlot<stype>&>()) \
.def("__iter__", &_ArraySlotIterator<stype>::__iter__) \
.def("next", &_ArraySlotIterator<stype>::next) \
; \