Use entry_points:console_scripts to generate protoc-gen-mypy #102
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes an issue where the shebang line fails of the executable fails to work when the path to the python interpreter exceeds 127 characters on linux and 512 on darwin.
We ran into the problem on the Apache Beam project: apache/beam#10734
@udim chased down some info on this issue: pypa/virtualenv#596 (comment)
Along with a solution, as implemented in
distutils
: https://bitbucket.org/pypa/distlib/src/6818e71809c2779e5ad82e6017ea570eb590186f/distlib/scripts.py?at=master#lines-124Below are the results of my own investigation into how to ensure that the
distutils
fix is applied. I cloned mypy-protobuf and created a virtualenv with a path that exceeded the 512 character limit on darwin.I tried installing the scripts in several ways:
pip install python/
cd python/ && python setup.py install
pip install python/
cd python/ && python setup.py install
pip wheel -w . python/ && pip install mypy_protobuf-1.17-py2-none-any.whl
This confirms that you need to use pip to install and entry_points in the project's setup.py file in order the fix to be applied to the installed script.
All tests were performed with the following:
IMHO, this change has the positive side effect of introducing a
mypy_protobuf
python library.