Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
# $NetBSD: application.mk,v 1.10 2010/07/24 18:12:11 gdt Exp $
#
# Replace the #! interpreter for Python scripts.
#
# This mk fragment should be included in all python packages that
# install python scripts, or at least those that don't use setuptools
# or some other mechanism to set the real path. Specifically, it is
# reasonable to include both egg.mk and application.mk.
#
# Package-settable variables:
#
# REPLACE_PYTHON
# A list of Python scripts to be installed, relative to ${WRKSRC}.
#
# PYTHON_PATCH_SCRIPTS
# The same as REPLACE_PYTHON.
#
# Keywords: python
#
.include "../../lang/python/pyversion.mk"
.if defined(PYTHON_PATCH_SCRIPTS) || defined(REPLACE_PYTHON)
REPLACE_INTERPRETER+= python
REPLACE.python.old= .*python[^ ]*
REPLACE.python.new= ${PYTHONBIN}
REPLACE_FILES.python= ${PYTHON_PATCH_SCRIPTS} ${REPLACE_PYTHON}
.endif

32
lang/python/distutils.mk Normal file
View File

@@ -0,0 +1,32 @@
# $NetBSD: distutils.mk,v 1.6 2012/04/23 13:02:06 obache 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.
# Set the egg file basename.
EGG_NAME?= ${DISTNAME}
# Python distutils will create an eggfile.
PY_NO_EGG?= no
# Egg files have the version encoded, so generalize in PLIST.
PLIST_SUBST+= EGG_FILE=${EGG_NAME}-py${PYVERSSUFFIX}.egg-info
PRINT_PLIST_AWK+= { gsub("${EGG_NAME}-py${PYVERSSUFFIX}.egg-info", \
"$${EGG_FILE}") }
.include "../../lang/python/extension.mk"

47
lang/python/egg.mk Normal file
View File

@@ -0,0 +1,47 @@
# $NetBSD: egg.mk,v 1.15 2012/12/10 03:15:48 tsarna Exp $
#
# Common logic to handle Python Eggs
#
.include "../../mk/bsd.fast.prefs.mk"
.include "../../lang/python/pyversion.mk"
# This file should be included to package python "distributions" which
# use setuptools to create an egg. Some distributions use distutils,
# which creates an egg-info file; those should use distutils.mk
EGG_NAME?= ${DISTNAME}
PYDISTUTILSPKG= yes
PY_PATCHPLIST= yes
# 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.
# XXX The PLIST substitution of EGG_NAME does not appear to be
# necessary. Either it should be removed or a comment added
# explaining why it is necessary.
PLIST_SUBST+= EGG_NAME=${EGG_NAME}-py${PYVERSSUFFIX}
PLIST_SUBST+= EGG_INFODIR=${EGG_NAME}-py${PYVERSSUFFIX}.egg-info
PRINT_PLIST_AWK+= { gsub(/${EGG_NAME}-py${PYVERSSUFFIX}.egg-info/, \
"$${EGG_INFODIR}") }
PRINT_PLIST_AWK+= { gsub(/${EGG_NAME}-py${PYVERSSUFFIX}-nspkg.pth/, \
"$${EGG_NAME}-nspkg.pth") }
_PYSETUPTOOLSINSTALLARGS= --single-version-externally-managed
.if ${_USE_DESTDIR} == "no"
_PYSETUPTOOLSINSTALLARGS+= --root=/
.endif
.if ${_PYTHON_VERSION} == "31" || ${_PYTHON_VERSION} == "32" || ${_PYTHON_VERSION} == "33"
DEPENDS+= ${PYPKGPREFIX}-distribute-[0-9]*:../../devel/py-distribute
.else
DEPENDS+= ${PYPKGPREFIX}-setuptools>=0.6c9:../../devel/py-setuptools
.endif
INSTALLATION_DIRS+= ${PYSITELIB}
.include "../../lang/python/extension.mk"

59
lang/python/extension.mk Normal file
View File

@@ -0,0 +1,59 @@
# $NetBSD: extension.mk,v 1.31 2012/10/03 22:03:41 wiz Exp $
.include "../../lang/python/pyversion.mk"
# Packages that are a non-egg distutils extension should set
# PYDISTUTILSPKG=YES and include this mk file.
# This mk fragment is included to handle packages that create
# extensions to python, which by definition are those that place files
# in ${PYSITELIB}. Extensions can be implemented via setuptools as
# eggs (see egg.mk), via distutils (confusing, with an egg-info file,
# even though they are not eggs), or via more ad hocs methods.
.if defined(PYDISTUTILSPKG)
.include "../../mk/bsd.prefs.mk"
PYSETUP?= setup.py
PYSETUPBUILDTARGET?= build
PYSETUPBUILDARGS?= #empty
PYSETUPARGS?= #empty
PYSETUPINSTALLARGS?= #empty
PYSETUPOPTARGS?= -c -O1
_PYSETUPINSTALLARGS= ${PYSETUPINSTALLARGS} ${PYSETUPOPTARGS} ${_PYSETUPTOOLSINSTALLARGS}
.if ${_USE_DESTDIR} != "no"
_PYSETUPINSTALLARGS+= --root=${DESTDIR:Q}
.endif
PY_PATCHPLIST?= yes
PYSETUPSUBDIR?= #empty
do-build:
(cd ${WRKSRC}/${PYSETUPSUBDIR} && ${SETENV} ${MAKE_ENV} ${PYTHONBIN} \
${PYSETUP} ${PYSETUPARGS} ${PYSETUPBUILDTARGET} ${PYSETUPBUILDARGS})
do-install:
(cd ${WRKSRC}/${PYSETUPSUBDIR} && ${SETENV} ${INSTALL_ENV} ${MAKE_ENV} \
${PYTHONBIN} ${PYSETUP} ${PYSETUPARGS} "install" ${_PYSETUPINSTALLARGS})
.endif
# PY_NO_EGG suppress the installation of the egg info file (and
# therefore its inclusion in the package). Python practice is be to
# use these files to let 'require' verify that python distributions
# are present, and therefore the default value of PY_NO_EGG=yes causes
# pkgsrc not to conform to python norms. The reason for this behavior
# appears to be that creating egg info files was new in Python 2.5.
PY_NO_EGG?= yes
.if !empty(PY_NO_EGG:M[yY][eE][sS])
# see python26/patches/patch-av
INSTALL_ENV+= PKGSRC_PYTHON_NO_EGG=defined
.endif
.if defined(PY_PATCHPLIST)
PLIST_SUBST+= PYINC=${PYINC} PYLIB=${PYLIB} PYSITELIB=${PYSITELIB}
.endif
# prepare Python>=32 bytecode file location change
.if empty(_PYTHON_VERSION:M2?) && ${_PYTHON_VERSION} != "31"
PLIST_AWK+= -f ${PKGSRCDIR}/lang/python/plist-python.awk
PLIST_AWK_ENV+= PYTHON_SOABI="cpython-${_PYTHON_VERSION}"
.endif

View File

@@ -0,0 +1,50 @@
# $NetBSD: plist-python.awk,v 1.1 2012/05/13 12:54:54 obache Exp $
#
# Copyright (c) 2012 The NetBSD Foundation, Inc.
# All rights reserved.
#
# This code is derived from software contributed to The NetBSD Foundation
# by OBATA Akio.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
### This awk script handles python bytcode file entries in PLISTs. This script
### requires the following scripts to be included:
###
### plist-functions.awk (print_entry)
###
### Certain environment variables must be set prior to running this script:
###
### PY_SOABI is the python SO ABI.
###
BEGIN {
PYTHON_SOABI = getenv_or_die("PYTHON_SOABI")
}
###
### For each python bytecode file entry, convert directory and file name
### using cache sub directory and SOABI.
###
/^[^@]/ && /[^\/]+\.py[co]$/ {
sub(/[^\/]+\.py[co]$/, "__pycache__/&")
sub(/\.py[co]$/, "." PYTHON_SOABI "&")
}

239
lang/python/pyversion.mk Normal file
View File

@@ -0,0 +1,239 @@
# $NetBSD: pyversion.mk,v 1.109 2013/05/12 00:19:55 riastradh Exp $
# This file determines which Python version is used as a dependency for
# a package.
#
# === User-settable variables ===
#
# PYTHON_VERSION_DEFAULT
# The preferred Python version to use.
#
# Possible values: 26 27 32 33
# Default: 27
#
# === Infrastructure variables ===
#
# PYTHON_VERSION_REQD
# Python version to use. This variable should not be set in
# packages. Normally it is used by bulk build tools.
#
# Possible: ${PYTHON_VERSIONS_ACCEPTED}
# Default: ${PYTHON_VERSION_DEFAULT}
#
# === Package-settable variables ===
#
# PYTHON_VERSIONS_ACCEPTED
# The Python versions that are acceptable for the package. The
# order of the entries matters, since earlier entries are
# preferred over later ones.
#
# Possible values: 33 32 27 26
# Default: (33 32) 27 26
#
# PYTHON_VERSIONS_INCLUDE_3X
# Wether the default PYTHON_VERSIONS_ACCEPTED should include
# 3.x versions for for this package or not.
# This variable must be set before including bsd.prefs.mk.
#
# Possible values: yes no
# Default: no
#
# PYTHON_VERSIONS_INCOMPATIBLE
# The Python versions that are NOT acceptable for the package.
#
# Possible values: 26 27 32 33
# Default: (depends on the platform)
#
# PYTHON_FOR_BUILD_ONLY
# Whether Python is needed only at build time or at run time.
#
# Possible values: yes no tool
# Default: no
#
# PYTHON_SELF_CONFLICT
# If set to "yes", additional CONFLICTS entries are added for
# registering a conflict between pyNN-<modulename> packages.
#
# Possible values: yes no
# Default: no
#
# === Defined variables ===
#
# PYPKGPREFIX
# The prefix to use in PKGNAME for extensions which are meant
# to be installed for multiple Python versions.
#
# Example: py27
#
# PYVERSSUFFIX
# The suffix to executables and in the library path, equal to
# sys.version[0:3].
#
# Example: 2.7
#
# Keywords: python
#
.if !defined(PYTHON_PYVERSION_MK)
PYTHON_PYVERSION_MK= defined
# derive a python version from the package name if possible
# optionally handled quoted package names
.if defined(PKGNAME_REQD) && !empty(PKGNAME_REQD:Mpy[0-9][0-9]-*) || \
defined(PKGNAME_REQD) && !empty(PKGNAME_REQD:M*-py[0-9][0-9]-*)
PYTHON_VERSION_REQD?= ${PKGNAME_REQD:C/(^.*-|^)py([0-9][0-9])-.*/\2/}
.elif defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:Mpy[0-9][0-9]-*) || \
defined(PKGNAME_OLD) && !empty(PKGNAME_OLD:M*-py[0-9][0-9]-*)
PYTHON_VERSION_REQD?= ${PKGNAME_OLD:C/(^.*-|^)py([0-9][0-9])-.*/\2/}
.endif
.include "../../mk/bsd.prefs.mk"
BUILD_DEFS+= PYTHON_VERSION_DEFAULT
BUILD_DEFS_EFFECTS+= PYPACKAGE
PYTHON_VERSION_DEFAULT?= 27
.if ${PYTHON_VERSIONS_INCLUDE_3X:U:tl} == "yes"
PYTHON_VERSIONS_ACCEPTED?= 33 32 27 26
.else
PYTHON_VERSIONS_ACCEPTED?= 27 26
.endif
PYTHON_VERSIONS_INCOMPATIBLE?= # empty by default
BUILDLINK_API_DEPENDS.python26?= python26>=2.6
BUILDLINK_API_DEPENDS.python27?= python27>=2.7
BUILDLINK_API_DEPENDS.python32?= python32>=3.2
BUILDLINK_API_DEPENDS.python33?= python33>=3.3
# transform the list into individual variables
.for pv in ${PYTHON_VERSIONS_ACCEPTED}
.if empty(PYTHON_VERSIONS_INCOMPATIBLE:M${pv})
_PYTHON_VERSION_${pv}_OK= yes
_PYTHON_VERSIONS_ACCEPTED+= ${pv}
.endif
.endfor
#
# choose a python version where to add,
# try to be intelligent
#
# if a version is explicitely required, take it
.if defined(PYTHON_VERSION_REQD)
# but check if it is acceptable first, error out otherwise
. if defined(_PYTHON_VERSION_${PYTHON_VERSION_REQD}_OK)
_PYTHON_VERSION= ${PYTHON_VERSION_REQD}
. endif
.else
# if the default is accepted, it is first choice
. if !defined(_PYTHON_VERSION)
. if defined(_PYTHON_VERSION_${PYTHON_VERSION_DEFAULT}_OK)
_PYTHON_VERSION= ${PYTHON_VERSION_DEFAULT}
. endif
. endif
# prefer an already installed version, in order of "accepted"
. if !defined(_PYTHON_VERSION)
. for pv in ${PYTHON_VERSIONS_ACCEPTED}
. if defined(_PYTHON_VERSION_${pv}_OK)
_PYTHON_VERSION?= ${pv}
. endif
. endfor
. endif
.endif
#
# Variable assignment for multi-python packages
MULTI+= PYTHON_VERSION_REQD=${_PYTHON_VERSION}
# No supported version found, annotate to simplify statements below.
.if !defined(_PYTHON_VERSION)
_PYTHON_VERSION= none
.endif
# Additional CONFLICTS
.if ${PYTHON_SELF_CONFLICT:U:tl} == "yes"
.for i in ${PYTHON_VERSIONS_ACCEPTED:N${_PYTHON_VERSION}}
CONFLICTS += ${PKGNAME:S/py${_PYTHON_VERSION}/py${i}/:C/-[0-9].*$/-[0-9]*/}
.endfor
.endif # PYCONFLICTS
#
PLIST_VARS+= py2x py3x
.if ${_PYTHON_VERSION} == "33"
PYPKGSRCDIR= ../../lang/python33
PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python33}:${PYPKGSRCDIR}
PYPACKAGE= python33
PYVERSSUFFIX= 3.3
PYPKGPREFIX= py33
PLIST.py3x= yes
.elif ${_PYTHON_VERSION} == "32"
PYPKGSRCDIR= ../../lang/python32
PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python32}:${PYPKGSRCDIR}
PYPACKAGE= python32
PYVERSSUFFIX= 3.2
PYPKGPREFIX= py32
PLIST.py3x= yes
.elif ${_PYTHON_VERSION} == "27"
PYPKGSRCDIR= ../../lang/python27
PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python27}:${PYPKGSRCDIR}
PYPACKAGE= python27
PYVERSSUFFIX= 2.7
PYPKGPREFIX= py27
PLIST.py2x= yes
.elif ${_PYTHON_VERSION} == "26"
PYPKGSRCDIR= ../../lang/python26
PYDEPENDENCY= ${BUILDLINK_API_DEPENDS.python26}:${PYPKGSRCDIR}
PYPACKAGE= python26
PYVERSSUFFIX= 2.6
PYPKGPREFIX= py26
PLIST.py2x= yes
.else
PKG_FAIL_REASON+= "No valid Python version"
PYPKGPREFIX=
.endif
PTHREAD_OPTS+= require
.include "../../mk/pthread.buildlink3.mk"
PYTHON_FOR_BUILD_ONLY?= no
.if defined(PYPKGSRCDIR)
. if !empty(PYTHON_FOR_BUILD_ONLY:M[tT][oO][oO][lL])
TOOL_DEPENDS+= ${PYDEPENDENCY}
. else
. if !empty(PYTHON_FOR_BUILD_ONLY:M[yY][eE][sS])
BUILDLINK_DEPMETHOD.python?= build
. endif
. include "${PYPKGSRCDIR}/buildlink3.mk"
. endif
.endif
PYTHONBIN= ${LOCALBASE}/bin/python${PYVERSSUFFIX}
PYTHONCONFIG= ${LOCALBASE}/bin/python${PYVERSSUFFIX}-config
PY_COMPILE_ALL= \
${PYTHONBIN} ${PREFIX}/lib/python${PYVERSSUFFIX}/compileall.py -q
PY_COMPILE_O_ALL= \
${PYTHONBIN} -O ${PREFIX}/lib/python${PYVERSSUFFIX}/compileall.py -q
.if exists(${PYTHONBIN})
PYINC!= ${PYTHONBIN} -c "import distutils.sysconfig; \
print (distutils.sysconfig.get_python_inc(0, \"\"))" || ${ECHO} ""
PYLIB!= ${PYTHONBIN} -c "import distutils.sysconfig; \
print (distutils.sysconfig.get_python_lib(0, 1, \"\"))" || ${ECHO} ""
PYSITELIB!= ${PYTHONBIN} -c "import distutils.sysconfig; \
print (distutils.sysconfig.get_python_lib(0, 0, \"\"))" || ${ECHO} ""
PRINT_PLIST_AWK+= /^${PYINC:S|/|\\/|g}/ \
{ gsub(/${PYINC:S|/|\\/|g}/, "$${PYINC}") }
PRINT_PLIST_AWK+= /^${PYSITELIB:S|/|\\/|g}/ \
{ gsub(/${PYSITELIB:S|/|\\/|g}/, "$${PYSITELIB}") }
PRINT_PLIST_AWK+= /^${PYLIB:S|/|\\/|g}/ \
{ gsub(/${PYLIB:S|/|\\/|g}/, "$${PYLIB}") }
.endif
ALL_ENV+= PYTHON=${PYTHONBIN}
.if defined(USE_CMAKE)
# used by FindPythonInterp.cmake and FindPythonLibs.cmake
CMAKE_ARGS+= -DPYVERSSUFFIX:STRING=${PYVERSSUFFIX}
.endif
.endif # PYTHON_PYVERSION_MK

19
lang/python/srcdist.mk Normal file
View File

@@ -0,0 +1,19 @@
# $NetBSD: srcdist.mk,v 1.34 2010/09/17 07:11:41 obache Exp $
.include "../../lang/python/pyversion.mk"
.sinclude "${.CURDIR}/${PYPKGSRCDIR}/dist.mk"
PYSUBDIR= ${DISTNAME}
WRKSRC= ${WRKDIR}/${PYSUBDIR}
.if defined(PYDISTUTILSPKG)
# This is used for standard modules shipped with Python but build as
# separate packages.
python-std-patchsetup:
${SED} ${PY_SETUP_SUBST:S/=/@!/:S/$/!g/:S/^/ -e s!@/} \
<${FILESDIR}/setup.py >${WRKSRC}/setup.py
post-extract: python-std-patchsetup
.endif

29
lang/python/tool.mk Normal file
View File

@@ -0,0 +1,29 @@
# $NetBSD: tool.mk,v 1.1 2011/10/14 08:55:54 obache Exp $
#
# Create `python' interpreter wrapper for applicable Python bin.
#
# This mk fragment can be included in all packages that uses `python'
# as a tool without version suffix.
#
# Keywords: python
#
.if !defined(PYTHON_TOOL_MK)
PYTHON_TOOL_MK= defined
.if !defined(PYTHON_PYVERSION_MK)
.include "../../lang/python/pyversion.mk"
.endif
BUILDLINK_TARGETS+= buildlink-bin-python
.PHONY: buildlink-bin-python
buildlink-bin-python:
${RUN} \
f="${PYTHONBIN}"; \
t="${BUILDLINK_DIR}/bin/python"; \
if ${TEST} -f $$f -a ! -f $$t ; then \
${LN} -sf $$f $$t; \
fi
.endif # PYTHON_TOOL_MK