Check imports using GitHub source code

This commit is contained in:
Major Hayden 2022-06-28 12:39:43 -05:00
commit 085fb9f73e
No known key found for this signature in database
GPG key ID: 737051E0C1011FB1
4 changed files with 49 additions and 5 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
/azure-mgmt-batchai-2.0.0.zip
/azure-mgmt-batchai-7.0.0b1.zip
/azure-mgmt-batchai-7.0.0b1.tgz

21
generate-source.sh Executable file
View file

@ -0,0 +1,21 @@
#!/bin/bash
set -euxo pipefail
export VERSION=7.0.0b1
export PACKAGE_NAME=azure-mgmt-batchai
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

View file

@ -1,3 +1,6 @@
# No tests available from upstream yet.
%bcond_with tests
%global srcname azure-mgmt-batchai
Name: python-%{srcname}
@ -6,7 +9,9 @@ Release: %autorelease
Summary: Microsoft Azure Batch AI Management 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
@ -14,6 +19,15 @@ Epoch: 1
BuildRequires: python3-devel
%if %{with tests}
BuildRequires: python3dist(azure-devtools)
BuildRequires: python3dist(azure-mgmt-keyvault)
BuildRequires: python3dist(azure-mgmt-resource)
BuildRequires: python3dist(azure-sdk-tools)
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pytest-aiohttp)
BuildRequires: python3dist(python-dotenv)
%endif
%global _description %{expand:
Microsoft Azure Batch AI Management Client Library for Python}
@ -23,16 +37,16 @@ Microsoft Azure Batch AI Management Client Library for Python}
%package -n python3-%{srcname}
Summary: %{summary}
Obsoletes: python3-azure-sdk < 5.0.1
%description -n python3-%{srcname} %{_description}
%prep
%autosetup -p0 -n %{srcname}-%{version}
%autosetup -n %{srcname}-%{version}
%generate_buildrequires
%pyproject_buildrequires -r
%pyproject_buildrequires
%build
@ -44,6 +58,14 @@ Obsoletes: python3-azure-sdk < 5.0.1
%pyproject_save_files azure
%check
%pyproject_check_import
%if %{with tests}
%pytest
%endif
%files -n python3-%{srcname} -f %{pyproject_files}
%doc README.md CHANGELOG.md

View file

@ -1 +1 @@
SHA512 (azure-mgmt-batchai-7.0.0b1.zip) = c81be868cb87ff9d2acc82b83581844586a31ecbb8b4a3a8e2025cfcc658009030dd97ce873b6b2d0d2ab175ac4ba21ed4c1906f08f047c8c84fc4081e26be2b
SHA512 (azure-mgmt-batchai-7.0.0b1.tgz) = 0893276a24dba766a031e68a7b617d0f21c954c6238ac5d5b422376772261c659cde35f68d032020a84c3cb621565c1b71f89eec2e8fd5dd6921d0ea7bc3f6c0