Signed-off-by: Lukas Holecek hluk@email.cz
I don't understand how this is any different.
I believe what you want is to first separate release from the NVR, then split the release by '.'
release = subject_identifier.rsplit('-', 2)[-1] if '.' not in release: return None short_prod_version = release.split('.')[-1] return _guess_product_version(short_prod_version, koji_build=True)
rebased onto 980d4cc0078dbd06afef6abe83185ecf1934add5
Updated.
Please provide some (obfuscated) real-world examples where it would fail, if you know any.
Can we avoid to set the product_version to None? Can't we use "*" or something like that? None really seems an error/bug. Someone in the team in the past came to me asking me "why I see None in the logs? It's a bug!"
Can we avoid to set the product_version to None?
@gnaponie How about PR#453?
oh, why "_"? :( can we use a more meaningful "term"?
beside one comment, it looks good! Even though... conflicts need to be resolved.
'_' is used as a "don't care" variable name. In this case, the split should produce 3 items, and only the one is interesting. Although the line above could be identical to:
release = subject_identifier.rsplit('-', 2)[-1]
Oh I see. Didn't know that. In this case, either options are fine. @lholecek the PR looks fine. Once resolved the conflict I think is good to go.
rebased onto 2634851a2a822059f0e724d9fc004b26f0c3ccda
Resolved the conflicts. @lucarval Can you review again pls?
rebased onto a6fb855ca3ba7355a2cf915b817d93e0f32e4810
'_' is used as a "don't care" variable name. In this case, the split should produce 3 items, and only the one is interesting. Although the line above could be identical to: release = subject_identifier.rsplit('-', 2)[-1]
BTW, this is not the same as "tuple unpacking".
>>> a, b, c = 'a-b'.rsplit('-', 2) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: not enough values to unpack (expected 3, got 2)
But the following doesn't ensure that there are three components.
>>> c = 'a-b'.rsplit('-', 2)[-1] >>> c 'b'
:+1:
Pull-Request has been merged by lholecek
Signed-off-by: Lukas Holecek hluk@email.cz