summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2017-07-03 18:14:40 +0000
committerjoerg <joerg@pkgsrc.org>2017-07-03 18:14:40 +0000
commit187cc67fe3f136679dd1f569519d6a1ca58a365b (patch)
tree472752e7f81dd3e053662bf0fbeaabaf2c5d346a /lang
parent417a5859761c743b2e62dd08a6af637e5f95be63 (diff)
downloadpkgsrc-187cc67fe3f136679dd1f569519d6a1ca58a365b.tar.gz
Add DISTUTILS_BUILDDIR_IN_TEST_ENV as flag to get the build directory
into PYTHONPATH for testing.
Diffstat (limited to 'lang')
-rw-r--r--lang/python/distutils-builddir.py7
-rw-r--r--lang/python/extension.mk9
2 files changed, 15 insertions, 1 deletions
diff --git a/lang/python/distutils-builddir.py b/lang/python/distutils-builddir.py
new file mode 100644
index 00000000000..87a7700223b
--- /dev/null
+++ b/lang/python/distutils-builddir.py
@@ -0,0 +1,7 @@
+from os import getcwd
+from os.path import join
+from distutils.dist import Distribution
+from distutils.command.build import build
+b = build(Distribution())
+b.finalize_options()
+print(join(getcwd(), b.build_platlib))
diff --git a/lang/python/extension.mk b/lang/python/extension.mk
index 15d4d0ff4cd..6d612dc41f4 100644
--- a/lang/python/extension.mk
+++ b/lang/python/extension.mk
@@ -1,4 +1,4 @@
-# $NetBSD: extension.mk,v 1.50 2017/05/17 11:17:04 wiz Exp $
+# $NetBSD: extension.mk,v 1.51 2017/07/03 18:14:40 joerg Exp $
.include "../../lang/python/pyversion.mk"
@@ -76,3 +76,10 @@ PRINT_PLIST_AWK+= gsub(/__pycache__\//, "")
PRINT_PLIST_AWK+= gsub(/opt-1\.pyc$$/, "pyo")
PRINT_PLIST_AWK+= gsub(/\.cpython-${_PYTHON_VERSION}/, "")}
.endif
+
+DISTUTILS_BUILDDIR_IN_TEST_ENV?= no
+
+.if ${DISTUTILS_BUILDDIR_IN_TEST_ENV} == "yes"
+DISTUTILS_BUILDDIR_CMD= cd ${WRKSRC} && ${PYTHONBIN} ${.CURDIR}/../../lang/python/distutils-builddir.py
+TEST_ENV+= PYTHONPATH=${DISTUTILS_BUILDDIR_CMD:sh}
+.endif