diff --git a/eng/apiview_reqs.txt b/eng/apiview_reqs.txt index 90bcd47a1c4a..8293fc0662f8 100644 --- a/eng/apiview_reqs.txt +++ b/eng/apiview_reqs.txt @@ -14,4 +14,5 @@ tomli==2.2.1 tomlkit==0.13.2 typing_extensions==4.15.0 wrapt==1.17.2 -apiview-stub-generator==0.3.25 \ No newline at end of file +apiview-stub-generator==0.3.25 +pip \ No newline at end of file diff --git a/eng/pipelines/templates/steps/run_apistub.yml b/eng/pipelines/templates/steps/run_apistub.yml index ea84514f3ba0..8076c55fc4be 100644 --- a/eng/pipelines/templates/steps/run_apistub.yml +++ b/eng/pipelines/templates/steps/run_apistub.yml @@ -31,14 +31,13 @@ steps: condition: and(succeededOrFailed(), ne(variables['Skip.ApiStubGen'],'true')) displayName: 'Generate API stub files' inputs: - scriptPath: 'scripts/devops_tasks/dispatch_tox.py' + scriptPath: 'eng/scripts/dispatch_checks.py' arguments: >- "$(TargetingString)" ${{ parameters.AdditionalTestArgs }} -d "$(Build.ArtifactStagingDirectory)" --mark_arg="${{ parameters.TestMarkArgument }}" --service="${{ parameters.ServiceDirectory }}" - --toxenv="apistub" + --checks="apistub" --disablecov --filter-type="Omit_management" - ${{ parameters.AdditionalTestArgs }} \ No newline at end of file diff --git a/eng/tools/azure-sdk-tools/azpysdk/apistub.py b/eng/tools/azure-sdk-tools/azpysdk/apistub.py index 183f76aee7ae..5d1bd30e0a53 100644 --- a/eng/tools/azure-sdk-tools/azpysdk/apistub.py +++ b/eng/tools/azure-sdk-tools/azpysdk/apistub.py @@ -16,13 +16,12 @@ MAX_PYTHON_VERSION = (3, 11) -def get_package_wheel_path(pkg_root: str, out_path: Optional[str]) -> tuple[str, Optional[str]]: +def get_package_wheel_path(pkg_root: str) -> str: # parse setup.py to get package name and version pkg_details = ParsedSetup.from_path(pkg_root) # Check if wheel is already built and available for current package prebuilt_dir = os.getenv("PREBUILT_WHEEL_DIR") - out_token_path = None if prebuilt_dir: found_whl = find_whl(prebuilt_dir, pkg_details.name, pkg_details.version) pkg_path = os.path.join(prebuilt_dir, found_whl) if found_whl else None @@ -32,16 +31,10 @@ def get_package_wheel_path(pkg_root: str, out_path: Optional[str]) -> tuple[str, pkg_details.name, pkg_details.version, prebuilt_dir ) ) - # If the package is a wheel and out_path is given, the token file output path should be the parent directory of the wheel - if out_path: - out_token_path = os.path.join(out_path, os.path.basename(os.path.dirname(pkg_path))) - return pkg_path, out_token_path - + return pkg_path # Otherwise, use wheel created in staging directory, or fall back on source directory pkg_path = find_whl(pkg_root, pkg_details.name, pkg_details.version) or pkg_root - out_token_path = out_path - - return pkg_path, out_token_path + return pkg_path def get_cross_language_mapping_path(pkg_root): @@ -117,9 +110,15 @@ def run(self, args: argparse.Namespace) -> int: self.pip_freeze(executable) - pkg_path, out_token_path = get_package_wheel_path(package_dir, staging_directory) + pkg_path = get_package_wheel_path(package_dir) + pkg_path = os.path.abspath(pkg_path) + + out_token_path = os.path.abspath(staging_directory) cross_language_mapping_path = get_cross_language_mapping_path(package_dir) + if cross_language_mapping_path: + cross_language_mapping_path = os.path.abspath(cross_language_mapping_path) + cmds = ["-m", "apistub", "--pkg-path", pkg_path] if out_token_path: @@ -130,7 +129,7 @@ def run(self, args: argparse.Namespace) -> int: logger.info("Running apistub {}.".format(cmds)) try: - self.run_venv_command(executable, cmds, cwd=package_dir, check=True, immediately_dump=True) + self.run_venv_command(executable, cmds, cwd=staging_directory, check=True, immediately_dump=True) except CalledProcessError as e: logger.error(f"{package_name} exited with error {e.returncode}") results.append(e.returncode)