def _install_packages(self, dependent_pkg_path, pkg_to_exclude):
        python_executable = self.context.venv.python_executable
        working_dir = self.context.package_root_path
        temp_dir = self.context.temp_path

        list_to_exclude = [pkg_to_exclude, 'azure-sdk-tools', 'azure-devtools']
        installed_pkgs = [
            p.split('==')[0]
            for p in get_installed_packages(self.context.venv.lib_paths)
            if p.startswith('azure-')
        ]
        logging.info("Installed azure sdk packages:{}".format(installed_pkgs))

        # Do not exclude list of packages in tools directory and so these tools packages will be reinstalled from repo branch we are testing
        root_path = os.path.abspath(
            os.path.join(dependent_pkg_path, "..", "..", ".."))
        tools_packages = find_tools_packages(root_path)
        installed_pkgs = [
            req for req in installed_pkgs if req not in tools_packages
        ]

        list_to_exclude.extend(installed_pkgs)
        # install dev requirement but skip already installed package which is being tested or present in dev requirement
        filtered_dev_req_path = filter_dev_requirements(
            dependent_pkg_path, list_to_exclude, dependent_pkg_path)

        # early versions of azure-sdk-tools had an unpinned version of azure-mgmt packages.
        # that unpinned version hits an a code path in azure-sdk-tools that hits this error.
        if filtered_dev_req_path and self.context.is_latest_depend_test == False:
            logging.info("Extending dev requirements with {}".format(
                OLDEST_EXTENSION_PKGS))
            extend_dev_requirements(filtered_dev_req_path,
                                    OLDEST_EXTENSION_PKGS)
        else:
            logging.info("Not extending dev requirements {} {}".format(
                filtered_dev_req_path, self.context.is_latest_depend_test))

        if filtered_dev_req_path:
            logging.info(
                "Extending dev requirement to include azure-sdk-tools")
            extend_dev_requirements(filtered_dev_req_path, [
                "../../../tools/azure-sdk-tools",
                "../../../tools/azure-devtools"
            ])
            logging.info("Installing filtered dev requirements from {}".format(
                filtered_dev_req_path))
            run_check_call(
                [
                    python_executable, "-m", "pip", "install", "-r",
                    filtered_dev_req_path
                ],
                dependent_pkg_path,
            )
        else:
            logging.info("dev requirements is not found to install")

        # install dependent package which is being verified
        run_check_call(
            [python_executable, "-m", "pip", "install", dependent_pkg_path],
            temp_dir)
Ejemplo n.º 2
0
    def _install_packages(self, dependent_pkg_path, pkg_to_exclude):
        python_executable = self.context.venv.python_executable
        working_dir = self.context.package_root_path
        temp_dir = self.context.temp_path

        # install dev requirement but skip already installed package which is being tested
        filtered_dev_req_path = filter_dev_requirements(
            dependent_pkg_path, [
                pkg_to_exclude,
            ], dependent_pkg_path)

        if filtered_dev_req_path:
            logging.info("Installing filtered dev requirements from {}".format(
                filtered_dev_req_path))
            run_check_call(
                [
                    python_executable, "-m", "pip", "install", "-r",
                    filtered_dev_req_path
                ],
                dependent_pkg_path,
            )
        else:
            logging.info("dev requirements is not found to install")

        # install dependent package which is being verified
        run_check_call(
            [python_executable, "-m", "pip", "install", dependent_pkg_path],
            temp_dir)
    def _install_packages(self, dependent_pkg_path, pkg_to_exclude):
        python_executable = self.context.venv.python_executable
        working_dir = self.context.package_root_path
        temp_dir = self.context.temp_path

        list_to_exclude = [pkg_to_exclude,]
        installed_pkgs = [p.split('==')[0] for p in list(freeze.freeze(paths=self.context.venv.lib_paths)) if p.startswith('azure-')]
        logging.info("Installed azure sdk packages:{}".format(installed_pkgs))

        # Do not exclude list of packages in tools directory and so these tools packages will be reinstalled from repo branch we are testing
        root_path = os.path.abspath(os.path.join(dependent_pkg_path, "..", "..", ".."))
        tools_packages = find_tools_packages(root_path)
        installed_pkgs = [req for req in installed_pkgs if req not in tools_packages]

        list_to_exclude.extend(installed_pkgs)
        # install dev requirement but skip already installed package which is being tested or present in dev requirement
        filtered_dev_req_path = filter_dev_requirements(
            dependent_pkg_path, list_to_exclude, dependent_pkg_path
        )

        if filtered_dev_req_path:
            logging.info(
                "Installing filtered dev requirements from {}".format(filtered_dev_req_path)
            )
            run_check_call(
                [python_executable, "-m", "pip", "install", "-r", filtered_dev_req_path],
                dependent_pkg_path,
            )
        else:
            logging.info("dev requirements is not found to install")

        # install dependent package which is being verified
        run_check_call(
            [python_executable, "-m", "pip", "install", dependent_pkg_path], temp_dir
        )
Ejemplo n.º 4
0
    def _install_packages(self, dependent_pkg_path, pkg_to_exclude):
        python_executable = self.context.venv.python_executable
        working_dir = self.context.package_root_path
        temp_dir = self.context.temp_path

        list_to_exclude = [
            pkg_to_exclude,
        ]
        installed_pkgs = [
            p.split('==')[0]
            for p in list(freeze.freeze(paths=self.context.venv.lib_paths))
            if p.startswith('azure-')
        ]
        logging.info("Installed azure sdk packages:{}".format(installed_pkgs))
        list_to_exclude.extend(installed_pkgs)
        # install dev requirement but skip already installed package which is being tested or present in dev requirement
        filtered_dev_req_path = filter_dev_requirements(
            dependent_pkg_path, list_to_exclude, dependent_pkg_path)

        if filtered_dev_req_path:
            logging.info("Installing filtered dev requirements from {}".format(
                filtered_dev_req_path))
            run_check_call(
                [
                    python_executable, "-m", "pip", "install", "-r",
                    filtered_dev_req_path
                ],
                dependent_pkg_path,
            )
        else:
            logging.info("dev requirements is not found to install")

        # install dependent package which is being verified
        run_check_call(
            [python_executable, "-m", "pip", "install", dependent_pkg_path],
            temp_dir)