예제 #1
0
    def get_venv_metadata_for_package(self, package: str) -> PipxVenvMetadata:

        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]

        return PipxVenvMetadata(**data)
예제 #2
0
    def get_venv_metadata_for_package(self, package: str) -> VenvMetadata:
        data = json.loads(
            get_script_output(self.python_path, VENV_METADATA_INSPECTOR,
                              package, self.bin_path))
        data["app_paths"] = [Path(p) for p in data["app_paths"]]
        for dep in data["app_paths_of_dependencies"]:
            data["app_paths_of_dependencies"][dep] = [
                Path(p) for p in data["app_paths_of_dependencies"][dep]
            ]

        return VenvMetadata(**data)