Skip to content

[pull] main from bazel-contrib:main#311

Merged
pull[bot] merged 2 commits intogarymm:mainfrom
bazel-contrib:main
Jun 22, 2025
Merged

[pull] main from bazel-contrib:main#311
pull[bot] merged 2 commits intogarymm:mainfrom
bazel-contrib:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Jun 22, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

yushan26 and others added 2 commits June 22, 2025 02:01
…e relative to the package path (#2865)

When `# gazelle:python_generation_mode package` is enabled, relative
imports are currently not being added to the `deps` field of the
generated target.

For example, given the following Python code:
```
from .library import add as _add
from .library import divide as _divide
from .library import multiply as _multiply
from .library import subtract as _subtract
```

The expected py_library rule should include a dependency on the local
library package:
```
py_library(
    name = "py_default_library",
    srcs = ["__init__.py"],
    visibility = ["//visibility:public"],
    deps = [
        "//example/library:py_default_library",
    ],
)
```
However, the actual generated rule is missing the deps entry:

```
py_library(
    name = "py_default_library",
    srcs = ["__init__.py"],
    visibility = ["//visibility:public"],
)
```
This change updates file_parser.go to ensure that relative imports
(those starting with a .) are parsed and preserved. In `Resolve()`,
logic is added to correctly interpret relative paths:

A single dot (.) refers to the current package.

Multiple dots (.., ..., etc.) traverse up parent directories.

The relative import is resolved against the current label.Pkg path that
imports the module and converted into an path relative to the root
before dependency resolution.

As a result, dependencies for relative imports are now correctly added
to the deps field in package generation mode.

Added a directive `# gazelle:experimental_allow_relative_imports true`
to allow this feature to be opt in.

---------

Co-authored-by: yushan <yushan@uber.com>
Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com>
Co-authored-by: Douglas Thor <dougthor42@users.noreply.github.com>
…rs (#2997)

Fixes `bazel vendor` support for requirements files that contain
environment markers. During a vendored `bazel build`, when
evaluate_markers_py() is run it needs PYTHONHOME set to properly find
the home of the vendored libraries.

Resolves #2996

---------

Co-authored-by: Ignas Anikevicius <240938+aignas@users.noreply.github.com>
@pull pull Bot added the ⤵️ pull label Jun 22, 2025
@pull pull Bot merged commit f6feca1 into garymm:main Jun 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants