Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix path to whl for APIView #40095

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions eng/tox/run_apistubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ def get_package_wheel_path(pkg_root):
# Check if wheel is already built and available for current package
prebuilt_dir = os.getenv("PREBUILT_WHEEL_DIR")
if prebuilt_dir:
prebuilt_package_path = find_whl(prebuilt_dir, pkg_details.name, pkg_details.version)
else:
return None
return os.path.join(prebuilt_dir, find_whl(prebuilt_dir, pkg_details.name, pkg_details.version))
return None


if __name__ == "__main__":
Expand Down Expand Up @@ -55,7 +54,7 @@ def get_package_wheel_path(pkg_root):
dest="out_path",
help="Output directory to generate json token file"
)

args = parser.parse_args()

# Check if a wheel is already built for current package and install from wheel when available
Expand All @@ -65,8 +64,13 @@ def get_package_wheel_path(pkg_root):
pkg_path = args.target_package

cmds = ["apistubgen", "--pkg-path", pkg_path]
if args.out_path:
cmds.extend(["--out-path", os.path.join(args.out_path, os.path.basename(pkg_path))])
if args.out_path:
if not os.path.isdir(pkg_path):
# If the package is a wheel, the out_path should be the parent directory of the wheel
out_path = os.path.join(args.out_path, os.path.basename(os.path.dirname(pkg_path)))
else:
out_path = os.path.join(args.out_path, os.path.basename(pkg_path))
cmds.extend(["--out-path", out_path])

logging.info("Running apistubgen {}.".format(cmds))
check_call(cmds, cwd=args.work_dir)
Loading