Quality boost for deb_pkg_tools.control module (#20)
Quality boost for deb_pkg_tools.control module (#20)

The following two things were handled rather inconsistently up till now:

- String literals being byte strings on Python 2 versus Unicode strings
  on Python 3. Despite the funky coercion rules in Python 2 this can
  and does bite. I'm pretty sure the deb_pkg_tools.control module in
  deb-pkg-tools < 8.0 can be made to raise UnicodeError exceptions for
  calls that should have been handled gracefully...

- Case insensitivity was previously an implicit feature because
  the python-debian package provides it. I was half aware of this
  but minimized deb-pkg-tools depending on this behavior. Given
  that I've now implemented case insensitivity natively I felt
  this was the right time to make things more consistent.

The intention of this commit is to get rid of these inconsistencies.

Only tangentially related to the above I also implemented a minor
performance optimization: Previously normalize_control_field_name()
constructed a dictionary on each call, but the contents of the
dictionary was static, so this "wastefulness" amounted to nothing more
than laziness on my part 😇. I've now promoted this dictionary to a
module level variable (in the assumption that looking up a module
variable is cheaper than constructing a dictionary).

xolox/python-deb-pkg-tools,xolox/python-deb-pkg-tools