fuzzycode/pytvdbapi — pull request #7 by toroettg (2013-09-22 13:34:45+00:00)
Title: Freeze compatibility

Freeze tools, like cx_Freeze and py2app, are currently not able to handle method calls of resource_filename from pkg_resources. Therefore, I propose a switch to get_data, which is part of the python standard library, to load resource data from package files.

The approach changes the functionality of the 'force-lang' parameter: It would no longer be possible to write new language data to the original package file, directly. However, on operating systems with restrictive permission management, e.g., Linux or OS X, this functionality is also broken in its current implementation, since root permissions are likely to be needed needed at run time in order to modify package files. Further modifications would be necessary to guarantee a proper functionality of this feature, e.g. storing new data files to user accessible directories (cache). Assuming that the language file rarely needs to be updated, I conclude doing so would be overkill and that reading the data without persistently storing it would suffice to bridge the period until a new package version is released.

The proposed change also removes the need to differentiate between parsing data directly and reading it from a path in the generate_tree method. The latter seems to be the cause of raised ValueErrors if the length of the given xml_data exceeds the limit of a path length on Microsoft Windows.