2020from typing import List , Mapping , Any
2121
2222from ci_tools .parsing import ParsedSetup
23+ from ci_tools .functions import verify_package_classifiers
2324
2425logging .getLogger ().setLevel (logging .INFO )
2526
2627ALLOWED_ROOT_DIRECTORIES = ["azure" , "tests" , "samples" , "examples" ]
2728
2829EXCLUDED_PYTYPE_PACKAGES = ["azure-keyvault" , "azure" , "azure-common" ]
2930
31+ EXCLUDED_CLASSIFICATION_PACKAGES = []
32+
3033
3134def 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