Skip to content

Commit 184eb82

Browse files
committed
massively simplify the call of hte classifier verification
1 parent 10b4077 commit 184eb82

4 files changed

Lines changed: 27 additions & 106 deletions

File tree

doc/eng_sys_checks.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ This is the most useful skip, but the following skip variables are also supporte
116116
- Omit checking that a package's keywords are correctly formulated before releasing.
117117
- `Skip.Black`
118118
- Omit checking `black` in the `analyze` job.
119-
- `Skip.VerifyPackageClassifiers`
120-
- Omit checking that the development classifiers align with the package version being shipped.
121119

122120
## The pyproject.toml
123121

eng/pipelines/templates/steps/analyze.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ steps:
1414
parameters:
1515
ScanPath: $(Build.SourcesDirectory)/sdk/${{ parameters.ServiceDirectory }}
1616

17-
- task: PythonScript@0
18-
displayName: 'Check classification'
19-
condition: and(succeededOrFailed(), ne(variables['Skip.VerifyPackageClassifiers'], 'true'))
20-
inputs:
21-
scriptPath: 'eng/scripts/verify_package_classifiers.py'
22-
arguments: >-
23-
"$(Build.ArtifactStagingDirectory)/PackageInfo"
24-
2517
- template: /eng/common/pipelines/templates/steps/set-test-pipeline-version.yml
2618
parameters:
2719
PackageName: "azure-template"

eng/scripts/verify_package_classifiers.py

Lines changed: 0 additions & 88 deletions
This file was deleted.

eng/tox/verify_sdist.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,16 @@
2020
from typing import List, Mapping, Any
2121

2222
from ci_tools.parsing import ParsedSetup
23+
from ci_tools.functions import verify_package_classifiers
2324

2425
logging.getLogger().setLevel(logging.INFO)
2526

2627
ALLOWED_ROOT_DIRECTORIES = ["azure", "tests", "samples", "examples"]
2728

2829
EXCLUDED_PYTYPE_PACKAGES = ["azure-keyvault", "azure", "azure-common"]
2930

31+
EXCLUDED_CLASSIFICATION_PACKAGES = []
32+
3033

3134
def get_root_directories_in_source(package_dir: str) -> List[str]:
3235
"""
@@ -138,18 +141,34 @@ def verify_sdist_pytyped(
138141
pkg_dir = os.path.abspath(args.target_package)
139142
pkg_details = ParsedSetup.from_path(pkg_dir)
140143

144+
error_occurred = False
145+
141146
if should_verify_package(pkg_details.name):
142-
logging.info("Verifying sdist for package [%s]", pkg_details.name)
147+
logging.info(f"Verifying sdist for package {pkg_details.name}")
143148
if verify_sdist(pkg_dir, args.dist_dir, pkg_details.version):
144-
logging.info("Verified sdist for package [%s]", pkg_details.name)
149+
logging.info(f"Verified sdist for package {pkg_details.name}")
145150
else:
146-
logging.info("Failed to verify sdist for package [%s]", pkg_details.name)
147-
exit(1)
151+
logging.error(f"Failed to verify sdist for package {pkg_details.name}")
152+
error_occurred = True
148153

149154
if pkg_details.name not in EXCLUDED_PYTYPE_PACKAGES and "-nspkg" not in pkg_details.name and "-mgmt" not in pkg_details.name:
150-
logging.info("Verifying presence of py.typed: [%s]", pkg_details.name)
155+
logging.info(f"Verifying presence of py.typed: {pkg_details.name}")
151156
if verify_sdist_pytyped(pkg_dir, pkg_details.namespace, pkg_details.package_data, pkg_details.include_package_data):
152-
logging.info("Py.typed setup.py kwargs are set properly: [%s]", pkg_details.name)
157+
logging.info(f"Py.typed setup.py kwargs are set properly: {pkg_details.name}")
158+
else:
159+
logging.error(f"Verified py.typed {pkg_details.name}. Check messages above.")
160+
error_occurred = True
161+
162+
if pkg_details.name in EXCLUDED_CLASSIFICATION_PACKAGES and "-nspkg" not in pkg_details.name:
163+
logging.info(f"Verifying package classifiers: {pkg_details.name}")
164+
165+
status, message = verify_package_classifiers(pkg_details.name, pkg_details.version, pkg_details.classifiers)
166+
if status:
167+
logging.info(f"Package classifiers are set properly: {pkg_details.name}")
153168
else:
154-
logging.info("Verified py.typed [%s]. Check messages above.", pkg_details.name)
155-
exit(1)
169+
logging.error(f"{message}")
170+
error_occurred = True
171+
172+
if error_occurred:
173+
logging.error(f"{pkg_details.name} failed sdist verification. Check outputs above.")
174+
exit(1)

0 commit comments

Comments
 (0)