This is a refactor in spirit similar to nodejs-packaging#12. Since the Requires generator is more complex, the refactor is also bigger.
As before, I will gladly explain and amend any confusing piece of code pointed to me ☺.
Goals
Compatibility with both Python 2 (because EPEL) and Python 3 (because future).
Backward compatibility: The previous behavior were kept as much as possible (down to typos in warning message), and I would treat any found diversion as a bug at this point. The test suite passes without any changes necessary.
Readability and separation of concerns: The ad-hoc parsing routines were replaced with smaller, dedicated, and documented methods/functions.
Better test coverage: Functions that implement the semver parsing (and few extras) have examples specified in the form of doctests, and the test suite now runs them to make sure they behave as expected.
This is a refactor in spirit similar to nodejs-packaging#12. Since the Requires generator is more complex, the refactor is also bigger.
As before, I will gladly explain and amend any confusing piece of code pointed to me ☺.
Goals
Compatibility with both Python 2 (because EPEL) and Python 3 (because future).
Backward compatibility: The previous behavior were kept as much as possible (down to typos in warning message), and I would treat any found diversion as a bug at this point. The test suite passes without any changes necessary.
Readability and separation of concerns: The ad-hoc parsing routines were replaced with smaller, dedicated, and documented methods/functions.
Better test coverage: Functions that implement the semver parsing (and few extras) have examples specified in the form of doctests, and the test suite now runs them to make sure they behave as expected.