Closed normalex closed 8 years ago
Sorry about the late response here. Since you appear to have dug into this, can you explain (for posterity?) why this change is necessary?
Just my 2 cents,
$ python setup.py --version
is a pretty basic and supposedly supported command. So it working would be great (vs not working). I personally sometimes use this, and packagers might use it, so having a known standard command working would be great.
@harlowja I'm definitely not opposed to this fix; I just want to understand it. There was a reason I had to put the version in both places, but I don't remember what it was.
@habnabit @harlowja Hi guys I got exactly the same issue. Can I help to fix it ?
@habnabit I checked in distutils.dist
module and it seems there's no attribute version
in the Distribution
class but there's one in DistributionMetadata
. So that's why calling self.version
on Distribution
object fails.
Unfortunately, I don't know how I can link to the source code :(
@habnabit Do you want I submit a pull request to fix this issue ?
@harlowja @habnabit Hey guys how can we move forward with this issue ?
Hey @habnabit could you answer my questions ?
I'm not sure where you're looking, maybe your distutils is different, but Distribution
definitely does have such an attribute.
⊙ python -c 'from distutils.dist import Distribution; print Distribution().version' julian@yoga
0
@Julian: the Distribution will get that attribute later in the execution, however in the context of where the vcversioner is plugged, the proper place is DistributionMetadata which is a wrapper over setup.py kwargs metadata.
@normalex sounds good to me, are you advising @habnabit to apply the OP's suggested change then?
Distribution().version
and DistributionMetadata().version
are different things.
Distribution().version
is 0
if the --version
flag was not used and is 1
if the --version
flag was used. It's a boolean value that indicates the options that this is being executed with.
You just want to assign to DistributionMetadata().version
. Then Distribution().get_version()
should return the correct version as well.
The issue is the current last line in vcversioner.py
dist.version = dist.metadata.version = find_version(**value).version
it should just bedist.metadata.version = find_version(**value).version
Tested using python2.6 and 2.7