pbr does not walk up the tree to find a .git
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
PBR |
Invalid
|
Undecided
|
Unassigned |
Bug Description
pbr seems to assume that the .git directory will be in the same directory as the base of the python package, however in the increasingly common case of a meta-repo containing generated code for multiple languages the python package may actually be a subdirectory, i.e.:
protobufproj/.git
protobufproj/go
protobufproj/java
protobufproj/python <-- building from here
protobufproj/
protobufproj/
Ideally the solution would have the same semantics as `git rev-parse --show-toplevel`
The exception shown when this occurs is:
```Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.
this actually may be something of a red-herring, digging into the code it looks like `git rev-parse --git-dir` _is_ being used https:/ /git.openstack. org/cgit/ openstack- dev/pbr/ tree/pbr/ git.py# n70
This error occurs probably when git is not installed, HOWEVER, by moving the .git directory into the protobufproj/python dir the problem is fixed because LocalEggInfo ( https:/ /git.openstack. org/cgit/ openstack- dev/pbr/ tree/pbr/ packaging. py#n510 ) has a specific callout for a .git which appears to short circuit some code that otherwise would call get_version.
I'm not exactly sure how that ends up happening, but that line in LocalEggInfo is the only place that seems to reference .git