summaryrefslogtreecommitdiff
path: root/lang/python/distutils.mk
blob: f0b7885a6f4235aee1e85e50fa40884005ea88e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# $NetBSD: distutils.mk,v 1.1 2010/07/24 12:32:22 gdt Exp $
#
# Common logic for python distributions that use distutils.
#
.include "../../mk/bsd.fast.prefs.mk"

.include "../../lang/python/pyversion.mk"

# This file should be included to package python "distributions" which
# use distutils.  See egg.mk for distributions that use setuptools and
# extensions.mk for ad hoc cases.

# Some day, hoist the PYDISTUTILSPKG code in extension.mk to here,
# after all distutils-using packages use this.
PYDISTUTILSPKG=	yes

# We expect distutils to create an egg-info file if Python distutils
# can do so, and provide support for a PLIST entry that represents
# this norm and will work with all python versions.  (If the package
# set PY_NO_EGG, respect that choice, but PLIST.eggfile is still set.)

# Set the egg file basename.
EGG_NAME?=	${DISTNAME}

PLIST_VARS+=	eggfile
.if !empty(PYDISTUTILS_CREATES_EGGFILES:M[yY][eE][sS])
# Python distutils will create an eggfile.
PLIST.eggfile=	yes
PY_NO_EGG?=	no
.else
# Python distutils will not create an eggfile.
# (PLIST.eggfile being set to no is equivalent to being set to yes!)
PY_NO_EGG?=	yes
.endif

# Egg files have the version encoded, so generalize in PLIST, and provide
# our conditional.
PLIST_SUBST+=	EGG_FILE=${EGG_NAME}-py${PYVERSSUFFIX}.egg-info
# Somehow, this rule seems to run after PYSITELIB is de-expanded and
# therefore not work.
PRINT_PLIST_AWK+=	{ gsub("${PYSITELIB}/${EGG_NAME}-py${PYVERSSUFFIX}.egg-info", \
				"$${PLIST.eggfile}$${PYSITELIB}/$${EGG_FILE}") }

.include "../../lang/python/extension.mk"