dev-python/cryptography: new recipe.

This commit is contained in:
fbrosson
2018-10-31 10:22:10 +00:00
parent 486389e05b
commit 1f5b4eff70

View File

@@ -0,0 +1,147 @@
SUMMARY="A Python module providing cryptographic recipes and primitives"
DESCRIPTION="cryptography is a module designed to expose cryptographic \
primitives and recipes to Python developers. \
It includes both high level recipes and low level interfaces to common \
cryptographic algorithms such as symmetric ciphers, message digests, and key \
derivation functions."
HOMEPAGE="https://cryptography.io/"
COPYRIGHT="2013-2018 Alex Gaynor, Paul Kehrer and others"
LICENSE="Apache v2
BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://github.com/pyca/cryptography/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="ff45a7f377d7f0fc79bdd4254b39f17c317ef0e6dc996da6795d5d3fd1718269"
SOURCE_FILENAME="cryptography-$portVersion.tar.gz"
ARCHITECTURES="!x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
cryptography$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libcrypto$secondaryArchSuffix
devel:libssl$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:pkg_config$secondaryArchSuffix
"
PYTHON_PACKAGES=()
PYTHON_VERSIONS=()
PYTHON_LIBSUFFIXES=()
# We don't have python2 for secondaryArch
if [ -z "$secondaryArchSuffix" ]; then
PYTHON_PACKAGES+=(python)
PYTHON_VERSIONS+=(2.7)
PYTHON_LIBSUFFIXES+=("")
BUILD_REQUIRES+="
setuptools_python
asn1crypto_python
cffi_python
idna_python
pyasn1_python
six_python
"
BUILD_PREREQUIRES+="
cmd:python2
"
fi
# gcc2 does not support the flags passed by python3
if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
PYTHON_PACKAGES+=(python3)
PYTHON_VERSIONS+=(3.6)
PYTHON_LIBSUFFIXES+=(m)
BUILD_REQUIRES+="
setuptools_python3
asn1crypto_python3
cffi${secondaryArchSuffix}_python3
idna_python3
pyasn1_python3
six_python3
"
BUILD_PREREQUIRES+="
cmd:python3
"
fi
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
pythonLibSuffix=${PYTHON_LIBSUFFIXES[$i]}
eval "PROVIDES_$pythonPackage=\"
${portName}_$pythonPackage = $portVersion
\""
eval "REQUIRES_$pythonPackage=\"
haiku$secondaryArchSuffix
asn1crypto_$pythonPackage
cffi_$pythonPackage
idna_$pythonPackage
pyasn1_$pythonPackage
six_$pythonPackage
lib:libcrypto$secondaryArchSuffix
lib:libpython$pythonVersion$pythonLibSuffix$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
\""
done
if [ "$targetArchitecture" = x86_gcc2 -a -n "$secondaryArchSuffix" ]; then
PROVIDES_python3+="
cryptography_python3 = $portVersion
"
fi
BUILD()
{
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
rm -rf "$sourceDir"-$pythonPackage
cp -a "$sourceDir" "$sourceDir"-$pythonPackage
cd "$sourceDir"-$pythonPackage
python=python$pythonVersion
$python setup.py build
done
}
INSTALL()
{
for i in "${!PYTHON_PACKAGES[@]}"; do
pythonPackage=${PYTHON_PACKAGES[i]}
pythonVersion=${PYTHON_VERSIONS[$i]}
cd "$sourceDir"-$pythonPackage
python=python$pythonVersion
installLocation=$prefix/lib/$python/vendor-packages/
export PYTHONPATH=$installLocation
mkdir -p "$installLocation"
$python setup.py install \
--optimize=1 \
--root=/ --prefix="$prefix"
install -m 755 -d "$dataDir"/licenses/packages/cryptography
install -m 644 -t "$dataDir"/licenses/packages/cryptography LICENSE*
rm "$dataDir"/licenses/packages/cryptography/LICENSE.APACHE
ln -s "`finddir B_SYSTEM_DATA_DIRECTORY`/licenses/Apache v2" \
"$dataDir"/licenses/packages/cryptography/LICENSE.APACHE
packageEntries $pythonPackage \
"$dataDir" \
"$prefix"/lib/$python
done
install -m 755 -d "$dataDir"/licenses/packages/cryptography "$docDir"
install -m 644 -t "$dataDir"/licenses/packages/cryptography LICENSE*
rm "$dataDir"/licenses/packages/cryptography/LICENSE.APACHE
ln -s "`finddir B_SYSTEM_DATA_DIRECTORY`/licenses/Apache v2" \
"$dataDir"/licenses/packages/cryptography/LICENSE.APACHE
install -m 644 -t "$docDir" README.rst
}