File: create_dependencies_and_install.py

package info (click to toggle)
python-azure 20250603%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 851,724 kB
  • sloc: python: 7,362,925; ansic: 804; javascript: 287; makefile: 195; sh: 145; xml: 109
file content (39 lines) | stat: -rw-r--r-- 1,588 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python

# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

# This script creates wheels for dependencies of a package and installs them.

import argparse
import os
import logging
from ci_tools.variables import in_ci
from ci_tools.scenario.generation import build_and_install_dev_reqs
logging.getLogger().setLevel(logging.INFO)


if __name__ == "__main__":
    parser = argparse.ArgumentParser(
        description="Create dependencies and install. "
    )

    parser.add_argument(
        "-p",
        "--path-to-setup",
        dest="target_setup",
        help="The path to the setup.py (not including the file) for the package we want to package into a wheel/sdist and install.",
        required=True,
    )

    args = parser.parse_args()
    package_root = os.path.abspath(args.target_setup)
    dev_reqs = os.path.join(package_root, "dev_requirements.txt")
    if not in_ci():
        # when we run tox locally, we use editable installs for a package's dependencies.
        # Some static analyzers (pyright/verifytypes) don't resolve dependencies
        # like azure-core when it is installed via editable install.
        # Here we create whls for the package's dependencies locally, install, and clean up.
        build_and_install_dev_reqs(dev_reqs, package_root)