danielgtaylor / danielgtaylor/python-betterproto

Paths are not normalized to posix format on Windows

Open
#578 0 comments 2 reactions 0 assignees View on GitHub
bug investigation needed
Dominant language
Python
Stars
1.8k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

### Summary

Paths are not normalized to posix format on Windows

### Reproduction Steps

Call `protoc` with the betterpython out options with multiple files that depend on one another.

Also happen when run through buf: (`buf.gen.yaml`)
```yaml
version: v2
plugins:
- local: protoc-gen-python_betterproto
out: output/pythonbetter/src
strategy: all
inputs:
- directory: .
paths:
- protos
```

`strategy: all` causes this behaviour since it doesn't call protoc once per proto file but once with all. (Which is what you want)

### Expected Results

Neatly generated code and no output

### Actual Results

Hundreds of these:
```
path "protocols\\test\\__init__.py" is not equal to "protocols/test/__init__.py", and therefore does not conform to the Protobuf generation specification. The path must be non-empty, relative, use "/" instead of "\" as the path separator, and not use "." or ".." as part of the path. Generation will continue without error here, but please raise an issue with the maintainer of the plugin and reference https://github.com/protocolbuffers/protobuf/blob/95e6c5b4746dd7474d540ce4fb375e3f79a086f8/src/google/protobuf/compiler/plugin.proto#L122
```

### System Information

```
libprotoc 3.21.12
Python 3.10.12
Name: betterproto
Version: 2.0.0b6
Summary: A better Protobuf / gRPC generator & library
Home-page: https://github.com/danielgtaylor/python-betterproto
Author: Daniel G. Taylor
Author-email: danielgtaylor@gmail.com
License: MIT
Location: c:\users\erwindehaan\mambaforge\lib\site-packages
Requires: grpclib, python-dateutil
Required-by:
```

On Windows 11 x64, running in Powershell

### Checklist

- [X] I have searched the issues for duplicates.
- [X] I have shown the entire traceback, if possible.
- [X] I have verified this issue occurs on the latest prelease of betterproto which can be installed using `pip install -U --pre betterproto`, if possible.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.