diff --git a/.gitignore b/.gitignore index d7f3744..5872528 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /azure-mgmt-cdn-11.0.0.zip /azure-mgmt-cdn-12.0.0.zip +/azure-mgmt-cdn-12.0.0.tgz diff --git a/generate-source.sh b/generate-source.sh new file mode 100755 index 0000000..da577aa --- /dev/null +++ b/generate-source.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -euxo pipefail + +export VERSION=12.0.0 +export PACKAGE_NAME=azure-mgmt-cdn +WORKING_DIR=$(pwd) + +# Download the release and unpack it. +curl -LO https://github.com/Azure/azure-sdk-for-python/archive/refs/tags/${PACKAGE_NAME}_${VERSION}.tar.gz +tar xzf ${PACKAGE_NAME}_${VERSION}.tar.gz + +# Find the package directory in the SDK release and the parent directory. +PACKAGE_DIR=$(find azure-sdk-for-python-${PACKAGE_NAME}_${VERSION} -type d -name $PACKAGE_NAME) +PARENT_DIR=$(dirname $PACKAGE_DIR) + +# Build a tarball with a prefix directory that contains the package name and +# version. Store that in the directory where the script is running. +pushd $PARENT_DIR + tar --transform "s/^${PACKAGE_NAME}/${PACKAGE_NAME}-${VERSION}/" -cz \ + -f ${WORKING_DIR}/${PACKAGE_NAME}-${VERSION}.tgz $PACKAGE_NAME +popd \ No newline at end of file diff --git a/python-azure-mgmt-cdn.spec b/python-azure-mgmt-cdn.spec index 94250f4..260dcf7 100644 --- a/python-azure-mgmt-cdn.spec +++ b/python-azure-mgmt-cdn.spec @@ -9,17 +9,19 @@ Release: %autorelease Summary: Microsoft Azure CDN Client Library for Python License: MIT URL: https://pypi.org/project/%{srcname}/ -Source0: %{pypi_source %{srcname} %{version} zip} +# This source comes from making a git archive of the main azure-sdk-for-python +# repository. To reproduce the source code, run the generate-source.sh script. +Source0: %{srcname}-%{version}.tgz BuildArch: noarch BuildRequires: python3-devel %if %{with tests} -BuildRequires: python3-azure-sdk-tools BuildRequires: python3dist(azure-devtools) BuildRequires: python3dist(azure-mgmt-keyvault) BuildRequires: python3dist(azure-mgmt-resource) +BuildRequires: python3dist(azure-sdk-tools) BuildRequires: python3dist(pytest) BuildRequires: python3dist(python-dotenv) %endif @@ -40,15 +42,17 @@ Summary: %{summary} %generate_buildrequires -%pyproject_buildrequires -r +%pyproject_buildrequires %build %pyproject_wheel -%if %{with tests} %check +%pyproject_check_import + +%if %{with tests} %pytest %endif diff --git a/sources b/sources index 60487e3..8f21a53 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (azure-mgmt-cdn-12.0.0.zip) = 820a97f94bdff877b81a7825b5f85b7114fd1063a02cd6c9718850c35b9f0432029961a0d934c3e18985f6815aad65332f249db7c86b09ed35ad8a08eb5ad856 +SHA512 (azure-mgmt-cdn-12.0.0.tgz) = 5554c39ecc8ed2fc097c9b597b67cf6088e81e088ea579773da1cfacc0da41f71286b7dada0459fdaa1be3d52fbfd9a8fc903bec56e11635c6c71eee9efc7fb9