[Distutils] setuptools develop command garbles binary files specified as scripts setup() parameter on windows

David Genest david.genest at ubisoft.com
Thu Jul 17 18:04:07 CEST 2014


Hi, 

In our environment, we are using the scripts parameter to package external binary files, which is really a practical use case:

1) it allows for bundling of executables in our package python distribution (with pertaining dlls etc)
2) the binary is available in an activated virtualenv

For the install case, everything is ok, the binaries are correctly installed.

But for the develop command, setuptools garbles the binary by copying the
binary file opened in text mode and writing it in binary mode. This is because
of the line ending translation.

I implemented a naive fix, only to be surprised by the python3 unicode
management, and caused a regression. (see
https://bitbucket.org/pypa/setuptools/issue/210/on-windows-binary-files-specified-as)

The less naive approach to the problem was implemented in
https://bitbucket.org/pypa/setuptools/pull-request/60/fix-regression-in-issue-218/diff
but the pull request was rejected.

But the problem still stands. How can I use the develop command and not have
my binaries specified as scripts be garbled.

Jason R. Coombs argued that this change would add undocumented special casing,
but I am inclined to disagree because the use case works:

* on *nix platforms (because the open function does not translate line endings
(the "b" mode has no effect on this platform))
* it already works when we go through the install flow (on every platform)
* there is a discrepancy between install and develop semantics, for the scripts parameter

I would like to know what is the take in the community on this.

Note that this is the first time I contribute a change, so I may not be up to
speed with all the dos and don'ts.

Thanks.

David.


More information about the Distutils-SIG mailing list