How to use the pipx.constants.WINDOWS function in pipx

To help you get started, we’ve selected a few pipx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pipxproject / pipx / src / pipx / util.py View on Github external
def rmdir(path: Path):
    logging.info(f"removing directory {path}")
    try:
        if WINDOWS:
            os.system(f'rmdir /S /Q "{str(path)}"')
        else:
            shutil.rmtree(path)
    except FileNotFoundError:
        pass
github pipxproject / pipx / pipx / SharedLibs.py View on Github external
def is_valid(self):
        return (
            self.python_path.is_file()
            and (self.bin_path / ("pip" if not WINDOWS else "pip.exe")).is_file()
        )
github pipxproject / pipx / src / pipx / venv.py View on Github external
def get_venv_metadata_for_package(self, package: str) -> VenvMetadata:
        data = json.loads(
            get_script_output(
                self.python_path, VENV_METADATA_INSPECTOR, package, str(self.bin_path)
            )
        )
        app_paths = [Path(p) for p in data["app_paths"]]
        if WINDOWS:
            windows_bin_paths = set()
            for app in app_paths:
                # windows has additional files staring with the same name that are required
                # to run the app
                for win_exec in app.parent.glob(f"{app.name}*.exe"):
                    windows_bin_paths.add(win_exec)
            data["app_paths"] = list(windows_bin_paths)
        else:
            data["app_paths"] = app_paths

        data["apps_of_dependencies"] = []
        for dep, raw_paths in data["app_paths_of_dependencies"].items():
            paths = [Path(raw_path) for raw_path in raw_paths]
            data["app_paths_of_dependencies"][dep] = paths
            data["apps_of_dependencies"] += [path.name for path in paths]