facebook / pyre-check

Performant type-checking for python.

Home Page:https://pyre-check.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pysa check always fail when build Pyre(and Pysa)

WangGithubUser opened this issue · comments

commented

I found that, pysa check was always fail since ea90f02
If you read the message after pysa fail, you will find that it always fails at a same problem.
It always log thatopam: --assume-depexts was added in version 2.1 of the opam CLI, but version 2.0 has been requested, which is older.(Usually at line 36, but I'm not sure)
However, we can bump the version of opam CLI to 2.1 to fix this issue.

Hi @WangGithubUser, thanks for reaching out.

Could you try changing opam-version: "2.0" into opam-version: "2.1" in source/hack_parallel.opam and see if you still get the same error?

However, we can bump the version of opam CLI to 2.1 to fix this issue.

How could we do that? From what I know, we don't enforce a specific version (except the file I mentioned above but it shouldn't be read by opam IMO).

We are supposedly using opam 2.1.5 in Github actions but we still get the error: https://github.com/facebook/pyre-check/actions/runs/5525528670/jobs/10079234670#step:5:807
There must be a weird option that makes it roll back to 2.0 internally

commented

@arthaud Yes, I still get same error.

Could you try changing opam-version: "2.0" into opam-version: "2.1" in source/hack_parallel.opam and see if you still get the same error?

However, I found the core problem.
The check ran the following commands(in scripts/setup.py, line 153)

def opam_environment_variables(self) -> Dict[str, str]:
    LOG.info("Activating opam")
    opam_env_result = self.run(
        [
            "opam",
            "env",
            "--yes",
            "--switch",
            self.switch_name(),
            "--root",
            self.opam_root.as_posix(),
            "--set-root",
            "--set-switch",
        ]
    )
    ...

It means, it ran opam env -some_args.
If you see the help doc of opam env(opam env --help), you will get this:

       --cli=MAJOR.MINOR (absent=2.1)
           Use the command-line interface syntax and semantics of MAJOR.MINOR.
           Intended for any persistent use of opam (scripts, blog posts,
           etc.), any version of opam in the same MAJOR series will behave as
           for the specified MINOR release. The flag was not available in opam
           2.0, so to select the 2.0 CLI, set the OPAMCLI environment variable
           to 2.0 instead of using this parameter.

It means, once you ran opam env -some_args, the OPAMCLI will set as 2.0 by default.
I try to solve this problem at #753

commented

This issue has resolved in b9386eb, I will close this issue