Annotation of pkgsrc/lang/python/extension.mk, revision 1.44
1.44 ! wiz 1: # $NetBSD: extension.mk,v 1.43 2016/05/07 03:12:08 richard Exp $
1.1 jlam 2:
3: .include "../../lang/python/pyversion.mk"
4:
1.27 gdt 5: # Packages that are a non-egg distutils extension should set
6: # PYDISTUTILSPKG=YES and include this mk file.
7:
8: # This mk fragment is included to handle packages that create
9: # extensions to python, which by definition are those that place files
10: # in ${PYSITELIB}. Extensions can be implemented via setuptools as
11: # eggs (see egg.mk), via distutils (confusing, with an egg-info file,
12: # even though they are not eggs), or via more ad hocs methods.
13:
1.1 jlam 14: .if defined(PYDISTUTILSPKG)
1.15 joerg 15: .include "../../mk/bsd.prefs.mk"
16:
1.1 jlam 17: PYSETUP?= setup.py
1.25 wiz 18: PYSETUPBUILDTARGET?= build
1.1 jlam 19: PYSETUPBUILDARGS?= #empty
1.26 wiz 20: PYSETUPARGS?= #empty
1.1 jlam 21: PYSETUPINSTALLARGS?= #empty
1.5 recht 22: PYSETUPOPTARGS?= -c -O1
1.16 joerg 23: _PYSETUPINSTALLARGS= ${PYSETUPINSTALLARGS} ${PYSETUPOPTARGS} ${_PYSETUPTOOLSINSTALLARGS}
1.15 joerg 24: _PYSETUPINSTALLARGS+= --root=${DESTDIR:Q}
1.33 wiz 25: PY_PATCHPLIST?= yes
1.32 tron 26: PYSETUPINSTALLARGS?= #empty
27: PYSETUPTESTTARGET?= test
28: PYSETUPTESTARGS?= #empty
1.3 jdolecek 29: PYSETUPSUBDIR?= #empty
1.1 jlam 30:
1.43 richard 31: pre-patch: fixup-python-writeable-source
32: .PHONY: fixup-python-writeable-source
33: fixup-python-writeable-source:
1.44 ! wiz 34: ${FIND} ${WRKSRC} -type f -exec ${CHMOD} go-w {} \;
1.43 richard 35:
1.1 jlam 36: do-build:
1.3 jdolecek 37: (cd ${WRKSRC}/${PYSETUPSUBDIR} && ${SETENV} ${MAKE_ENV} ${PYTHONBIN} \
1.26 wiz 38: ${PYSETUP} ${PYSETUPARGS} ${PYSETUPBUILDTARGET} ${PYSETUPBUILDARGS})
1.1 jlam 39:
40: do-install:
1.18 tnn 41: (cd ${WRKSRC}/${PYSETUPSUBDIR} && ${SETENV} ${INSTALL_ENV} ${MAKE_ENV} \
1.26 wiz 42: ${PYTHONBIN} ${PYSETUP} ${PYSETUPARGS} "install" ${_PYSETUPINSTALLARGS})
1.34 obache 43: .if !target(do-test) && !(defined(TEST_TARGET) && !empty(TEST_TARGET))
1.32 tron 44: do-test:
45: (cd ${WRKSRC}/${PYSETUPSUBDIR} && ${SETENV} ${MAKE_ENV} ${PYTHONBIN} \
46: ${PYSETUP} ${PYSETUPARGS} ${PYSETUPTESTTARGET} ${PYSETUPTESTARGS})
1.34 obache 47: .endif
1.32 tron 48:
1.1 jlam 49: .endif
50:
1.28 gdt 51: # PY_NO_EGG suppress the installation of the egg info file (and
1.27 gdt 52: # therefore its inclusion in the package). Python practice is be to
53: # use these files to let 'require' verify that python distributions
1.28 gdt 54: # are present, and therefore the default value of PY_NO_EGG=yes causes
55: # pkgsrc not to conform to python norms. The reason for this behavior
56: # appears to be that creating egg info files was new in Python 2.5.
1.19 abs 57: PY_NO_EGG?= yes
58: .if !empty(PY_NO_EGG:M[yY][eE][sS])
1.39 wiz 59: # see python*/patches/patch-av
1.19 abs 60: INSTALL_ENV+= PKGSRC_PYTHON_NO_EGG=defined
61: .endif
62:
1.1 jlam 63: .if defined(PY_PATCHPLIST)
1.29 obache 64: PLIST_SUBST+= PYINC=${PYINC} PYLIB=${PYLIB} PYSITELIB=${PYSITELIB}
1.1 jlam 65: .endif
1.30 obache 66:
1.36 wiz 67: # prepare Python>=3.2 bytecode file location change
1.35 obache 68: # http://www.python.org/dev/peps/pep-3147/
1.36 wiz 69: .if empty(_PYTHON_VERSION:M2?)
1.35 obache 70: PY_PEP3147?= yes
71: .endif
72: .if defined(PY_PEP3147) && !empty(PY_PEP3147:M[yY][eE][sS])
1.30 obache 73: PLIST_AWK+= -f ${PKGSRCDIR}/lang/python/plist-python.awk
1.40 adam 74: PLIST_AWK_ENV+= PYVERS="${PYVERSSUFFIX:S/.//}"
1.37 obache 75: PRINT_PLIST_AWK+= /^[^@]/ && /[^\/]+\.py[co]$$/ {
76: PRINT_PLIST_AWK+= gsub(/__pycache__\//, "")
1.41 wiz 77: PRINT_PLIST_AWK+= gsub(/opt-1\.pyc$$/, "pyo")
1.37 obache 78: PRINT_PLIST_AWK+= gsub(/\.cpython-${_PYTHON_VERSION}/, "")}
1.30 obache 79: .endif
CVSweb <webmaster@jp.NetBSD.org>