0
0
Fork 0
haikuports/dev-python/cryptography/cryptography-2.8.recipe

149 lines
3.8 KiB
Bash

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 The cryptography developers"
LICENSE="Apache v2
BSD (3-clause)"
REVISION="2"
SOURCE_URI="https://pypi.io/packages/source/c/cryptography/cryptography-$portVersion.tar.gz"
CHECKSUM_SHA256="3cda1f0ed8747339bbdf71b9f38ca74c7b592f24f65cdb3ab3765e4b02871651"
ARCHITECTURES="all !x86_gcc2"
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.7)
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()
{
myLicensesDir=$dataDir/licenses/packages/c/cryptography
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 "$myLicensesDir"
install -m 644 -t "$myLicensesDir" LICENSE*
rm "$myLicensesDir"/LICENSE.APACHE
ln -s "`finddir B_SYSTEM_DATA_DIRECTORY`/licenses/Apache v2" \
"$myLicensesDir"/LICENSE.APACHE
packageEntries $pythonPackage \
"$dataDir" \
"$prefix"/lib/$python
done
install -m 755 -d "$myLicensesDir" "$docDir"
install -m 644 -t "$myLicensesDir" LICENSE*
rm "$myLicensesDir"/LICENSE.APACHE
ln -s "`finddir B_SYSTEM_DATA_DIRECTORY`/licenses/Apache v2" \
"$myLicensesDir"/LICENSE.APACHE
install -m 644 -t "$docDir" README.rst
}