Skip to content

get_release_info() function assumes that custom python interpreter URL has release date in it #3285

@ybaturina

Description

@ybaturina

🐞 bug report

Affected Rule

The issue is caused by the function:

get_release_info

Is this a regression?

Yes, the previous version in which this bug was not present was: 0.39.0

Description

The issue is caused by this line:

release_id = int(u.split("/")[-2])

If the URL doesn't follow a specific format, this code will fail.

🔥 Exception or Error

Example:

For the URL file:///__w/jax/jax/python-tsan.tgz the error below is thrown:

ERROR: Traceback (most recent call last):
    File "/__w/jax/jax/jax/WORKSPACE", line 76, column 23, in <toplevel>
        python_init_toolchains()
    File "/__w/.cache/bazel/bazel/_bazel_root/a40625930fdef4f0a3483cd60aa1bb86/external/xla/third_party/py/python_init_toolchains.bzl", line 52, column 35, in python_init_toolchains
        python_register_toolchains(
    File "/__w/.cache/bazel/bazel/_bazel_root/a40625930fdef4f0a3483cd60aa1bb86/external/rules_python/python/private/python_register_toolchains.bzl", line 127, column 88, in python_register_toolchains
        (release_filename, urls, strip_prefix, patches, patch_strip) = get_release_info(platform, python_version, base_url, tool_versions)
    File "/__w/.cache/bazel/bazel/_bazel_root/a40625930fdef4f0a3483cd60aa1bb86/external/rules_python/python/versions.bzl", line 1048, column 25, in get_release_info
        release_id = int(u.split("/")[-2])
Error in int: invalid base-10 literal: "jax"

🌍 Your Environment

Operating System:

  
Linux x86
  

Output of bazel version:

  
7.4.1
  

Rules_python version:

  
1.6.0
  

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions