Ejemplo n.º 1
0
    def from_exe(cls,
                 exe,
                 app_data=None,
                 raise_on_error=True,
                 ignore_cache=False,
                 resolve_to_host=True,
                 env=None):
        """Given a path to an executable get the python information"""
        # this method is not used by itself, so here and called functions can import stuff locally
        from virtualenv.discovery.cached_py_info import from_exe

        env = os.environ if env is None else env
        proposed = from_exe(cls,
                            app_data,
                            exe,
                            env=env,
                            raise_on_error=raise_on_error,
                            ignore_cache=ignore_cache)
        # noinspection PyProtectedMember
        if isinstance(proposed, PythonInfo) and resolve_to_host:
            try:
                proposed = proposed._resolve_to_system(app_data, proposed)
            except Exception as exception:
                if raise_on_error:
                    raise exception
                logging.info("ignore %s due cannot resolve system due to %r",
                             proposed.original_executable, exception)
                proposed = None
        return proposed
Ejemplo n.º 2
0
    def from_exe(cls, exe, raise_on_error=True, ignore_cache=False, resolve_to_host=True):
        """Given a path to an executable get the python information"""
        # this method is not used by itself, so here and called functions can import stuff locally
        from virtualenv.discovery.cached_py_info import from_exe

        proposed = from_exe(cls, exe, raise_on_error=raise_on_error, ignore_cache=ignore_cache)
        # noinspection PyProtectedMember
        if isinstance(proposed, PythonInfo) and resolve_to_host:
            proposed = proposed._resolve_to_system(proposed)
        return proposed