benley / bazel_rules_pex

Python PEX rules for Bazel
Apache License 2.0
39 stars 36 forks source link

Add a way to specify script attribute for pex #60

Open mouadino opened 6 years ago

mouadino commented 6 years ago

Sadly entrypoint isn't enough since not all scripts are tracked inside python packages, e.g. ansible project have useful scripts like ansible-playbook inside a folder called bin[1] that is not a python package, hence we cannot use entrypoint for it.

[1] https://github.com/ansible/ansible/tree/devel/bin

benley commented 6 years ago

This is very similar to what the main attribute does, but cleaner. How would you feel about changing the behavior of main so that acts like your new script attribute instead of its current (hacky) behavior? The way it translates filenames into python module/package names has always been a source of trouble, and it probably should have been done this way with --script all along.