2019-07-17 20:34:16 +02:00
|
|
|
# $NetBSD: egg.mk,v 1.28 2019/07/17 18:34:16 rillig Exp $
|
2007-08-09 15:24:12 +02:00
|
|
|
#
|
|
|
|
# Common logic to handle Python Eggs
|
|
|
|
#
|
2009-02-17 18:32:38 +01:00
|
|
|
.include "../../mk/bsd.fast.prefs.mk"
|
2012-07-25 21:07:49 +02:00
|
|
|
.include "../../lang/python/pyversion.mk"
|
2007-08-09 15:24:12 +02:00
|
|
|
|
2010-07-24 00:44:46 +02:00
|
|
|
# This file should be included to package python "distributions" which
|
2011-12-16 13:57:17 +01:00
|
|
|
# use setuptools to create an egg. Some distributions use distutils,
|
|
|
|
# which creates an egg-info file; those should use distutils.mk
|
2010-07-24 00:44:46 +02:00
|
|
|
|
2014-12-31 14:57:25 +01:00
|
|
|
EGG_NAME?= ${DISTNAME:C/-([^0-9])/_\1/g}
|
2014-12-06 16:17:08 +01:00
|
|
|
EGG_INFODIR?= ${EGG_NAME}-py${PYVERSSUFFIX}.egg-info
|
2008-09-12 07:32:37 +02:00
|
|
|
|
2007-08-09 15:24:12 +02:00
|
|
|
PYDISTUTILSPKG= yes
|
|
|
|
PY_PATCHPLIST= yes
|
|
|
|
|
2011-12-16 13:57:17 +01:00
|
|
|
# True eggs always have an egg-info directory, and thus there is no
|
|
|
|
# PLIST conditional (as in distutils.mk for old versions of python).
|
|
|
|
# Note that we substitute EGG_INFODIR rather than EGG_FILE, because
|
|
|
|
# the egg information in an egg comprises multiple files in an
|
|
|
|
# egg-info directory.
|
|
|
|
|
2014-12-06 16:17:08 +01:00
|
|
|
# The PLIST substitution of EGG_NAME is not necessary. However, it
|
|
|
|
# is convenient. See lang/ruby/gem.mk and PLIST files for ruby gem
|
|
|
|
# packages to understand other examples of this feature in non-python
|
|
|
|
# packages.
|
2011-12-16 13:57:17 +01:00
|
|
|
|
2007-08-09 15:25:31 +02:00
|
|
|
PLIST_SUBST+= EGG_NAME=${EGG_NAME}-py${PYVERSSUFFIX}
|
2014-12-06 16:17:08 +01:00
|
|
|
PLIST_SUBST+= EGG_INFODIR=${EGG_INFODIR}
|
2019-07-17 20:34:16 +02:00
|
|
|
PRINT_PLIST_AWK+= { gsub(/${EGG_NAME}-py${PYVERSSUFFIX:S,.,\.,g}.egg-info/, \
|
2008-09-10 18:33:38 +02:00
|
|
|
"$${EGG_INFODIR}") }
|
2019-07-17 20:34:16 +02:00
|
|
|
PRINT_PLIST_AWK+= { gsub(/${EGG_NAME}-py${PYVERSSUFFIX:S,.,\.,g}-nspkg.pth/, \
|
2008-09-10 18:33:38 +02:00
|
|
|
"$${EGG_NAME}-nspkg.pth") }
|
2019-07-17 20:34:16 +02:00
|
|
|
PRINT_PLIST_AWK+= { gsub(/${PYVERSSUFFIX:S,.,\.,g}/, \
|
2016-08-28 11:40:35 +02:00
|
|
|
"$${PYVERSSUFFIX}") }
|
2007-08-09 15:24:12 +02:00
|
|
|
|
|
|
|
_PYSETUPTOOLSINSTALLARGS= --single-version-externally-managed
|
|
|
|
|
2017-02-08 13:09:30 +01:00
|
|
|
# py-setuptools depends on a couple py-* packages that need to be installed
|
|
|
|
# beforehand. Of course, those can not be built and installed using py-setuptools
|
|
|
|
# itself; so use the setuptools version included with python itself for installing
|
|
|
|
# them.
|
|
|
|
BOOTSTRAP_SETUPTOOLS?= no
|
|
|
|
.if ${BOOTSTRAP_SETUPTOOLS} == "yes"
|
|
|
|
BUILD_DEPENDS+= ${PYPKGPREFIX}-expat-[0-9]*:../../textproc/py-expat
|
|
|
|
do-build: ensurepip
|
|
|
|
.PHONY: ensurepip
|
|
|
|
|
|
|
|
ensurepip:
|
|
|
|
${SETENV} ${MAKE_ENV} ${PYTHONBIN} -m ensurepip --user
|
|
|
|
.else
|
2014-12-17 08:23:04 +01:00
|
|
|
DEPENDS+= ${PYPKGPREFIX}-setuptools>=0.8:../../devel/py-setuptools
|
2017-02-08 13:09:30 +01:00
|
|
|
.endif
|
2007-08-09 15:24:12 +02:00
|
|
|
|
|
|
|
INSTALLATION_DIRS+= ${PYSITELIB}
|
|
|
|
|
2016-05-28 13:23:46 +02:00
|
|
|
privileged-install-hook: fixup-egg-info
|
|
|
|
.PHONY: fixup-egg-info
|
|
|
|
fixup-egg-info: # ensure egg-info directory contents are always 644
|
2016-06-01 11:44:52 +02:00
|
|
|
if ${TEST} -d "${DESTDIR}${PREFIX}/${PYSITELIB}/${EGG_INFODIR}"; then \
|
2016-05-28 13:23:46 +02:00
|
|
|
${FIND} ${DESTDIR}${PREFIX}/${PYSITELIB}/${EGG_INFODIR} -type f \
|
2017-02-04 22:39:05 +01:00
|
|
|
-exec ${CHMOD} ${SHAREMODE} '{}' +; \
|
2016-06-01 11:44:52 +02:00
|
|
|
fi
|
2016-05-28 13:23:46 +02:00
|
|
|
|
2007-08-09 15:24:12 +02:00
|
|
|
.include "../../lang/python/extension.mk"
|