https://pantsbuild.org/ logo
r

refined-addition-53644

06/23/2022, 10:02 AM
Hi, is it possible to override the default
pex
version. I am on pants
2.11.1rc2
which has pinned its pex version to 2.1.90. I am trying to use pex v2.1.93 by adding it to
pants.toml
Copy code
[pex-cli]
version = "v2.1.93"
But I get this error when trying to update the lockfiles
Copy code
pants generate-lockfiles
12:01:59.08 [ERROR] 1 Exception encountered:

  UnknownVersion: No known version of pex v2.1.93 for macos_x86_64 found in ('v2.1.90|macos_arm64|2781255baf77c2a8fdc85c5e830f7191a6048fd91d2e20b5c7a20e5a0b7beb66|3755345', 'v2.1.90|macos_x86_64|2781255baf77c2a8fdc85c5e830f7191a6048fd91d2e20b5c7a20e5a0b7beb66|3755345', 'v2.1.90|linux_x86_64|2781255baf77c2a8fdc85c5e830f7191a6048fd91d2e20b5c7a20e5a0b7beb66|3755345')
2
Here is the doc link https://www.pantsbuild.org/docs/reference-pex-cli I think it fails because of
known_versions
which is checking for 2.1.90.
c

curved-television-6568

06/23/2022, 10:26 AM
Yes, you need to override the known versions as well.
r

refined-addition-53644

06/23/2022, 12:34 PM
@curved-television-6568 Do you know what's the purpose of
use_unsupported_version
? I thought setting it to warning would allow me to avoid overriding
known_versions
But it still throws an error
c

curved-television-6568

06/23/2022, 12:38 PM
Yeah (backstory https://github.com/pantsbuild/pants/pull/12332 ) There’s a constraint in Pants for which version of pex to use. If you go outside this constraint, we want to flag that things may break. So it is only for making sure that you know what you do, and if things break, there would be the first place to look. So you still need to provide known versions to actually use another version of pex.
r

refined-addition-53644

06/23/2022, 12:39 PM
ah ok! I tried to generate the known version format but the size I calculate using
wc -c
on macos doesn't match what pants is calculating
👀 1
c

curved-television-6568

06/23/2022, 12:40 PM
oh..
r

refined-addition-53644

06/23/2022, 12:40 PM
Copy code
known_versions = [
  "v2.1.93|macos_arm64|e20143efdab8591a271def3f35909036c313968a267e57c94f582b911bbaf315|2732075",
  "v2.1.93|macos_x86_64|e20143efdab8591a271def3f35909036c313968a267e57c94f582b911bbaf315|2732075",
  "v2.1.93|linux_x86_64|e20143efdab8591a271def3f35909036c313968a267e57c94f582b911bbaf315|2732075"
]
c

curved-television-6568

06/23/2022, 12:43 PM
try with
80fc6b94f5db253a71061974cb8d8ce520932aef44d989e9057917cc33a30fd6
and
3802280
r

refined-addition-53644

06/23/2022, 12:44 PM
I am running
wc -c
on downloaded wheel
Copy code
wc -c pex-2.1.93-py2.py3-none-any.whl
 2732075 pex-2.1.93-py2.py3-none-any.whl
Seems to be working. So what/how you generated that?
c

curved-television-6568

06/23/2022, 12:45 PM
you must use the same url as the url template https://github.com/pantsbuild/pex/releases/download/{version}/pex
Copy code
--pex-cli-url-template=<str>
  PANTS_PEX_CLI_URL_TEMPLATE
  url_template
      default: <https://github.com/pantsbuild/pex/releases/download/{version}/pex>
      current value: <https://github.com/pantsbuild/pex/releases/download/{version}/pex>
      URL to download the tool, either as a single binary file or a compressed file (e.g. zip file). You can change this to point to your own hosted file, e.g. to work with proxies or for access via the filesystem through a
      `file:$abspath` URL (e.g. `file:/this/is/absolute`, possibly by [templating the buildroot in a config file](<https://www.pantsbuild.org/v2.13/docs/options#config-file-entries))>.
      
      Use `{version}` to have the value from --version substituted, and `{platform}` to have a value from --url-platform-mapping substituted in, depending on the current platform. For example,
      <https://github.com/.../protoc-{version}-{platform}.zip>.
1
I used
Copy code
$ curl -s -L <https://github.com/pantsbuild/pex/releases/download/v2.1.93/pex> | tee >(wc -c) >(shasum -a 256) >/dev/null
🙌 2
r

refined-addition-53644

06/23/2022, 12:46 PM
Thank you very much!
c

curved-television-6568

06/23/2022, 12:46 PM
most welcome 🙂
r

refined-addition-53644

06/23/2022, 12:50 PM
Shouldn't that be also part of docs?
c

curved-television-6568

06/23/2022, 12:50 PM
hehe… just crossed my mind too
🙏 1