Closed mauritsvanrees closed 6 years ago
One extra comment: read_text_file() has a fallback_encoding argument. Is that necessary? Or could the function look it up itself? (I assume "it is necessary", though).
Technically, we could call config = pypi.PypiConfig(); fallback_encoding = config.encoding()
in read_text_file
. But then you instantiate the PypiConfig multiple times, which sounds wrong. It doesn't take long, so it may be okay. But I am also half wondering if utils.py
would be able to find the right setup.cfg
if we are not in the root directory. Maybe best to leave it this way.
I guess there is room for a more thorough overhaul of the package if we want to clean it up, rethinking decisions that we made in the past, and making it more clear what other packages (especially zest.releaser hooks) can depend on as api.
Ok, clear!
Fixes issue #264, see discussion there.
I fought a bit with the difference between a few possibilities to read this:
SetupConfig
object and read the encoding option directly in the calling code (if setup_config.config.has_option(...)
PypiConfig
object, which also readssetup.cfg
and use a new methodencoding
on that class.I opted for the second way. That also meant that I found an undocumented option
history_file
and changed that to use the second way. So I included that in this PR. I kept the commits separate, so you can view them separately if you want.