mirror of https://github.com/buildinspace/peru.git
use entry_points instead of a pre-written script
Summary: This was the recommendation of https://packaging.python.org/en/latest/distributing.html, but I unwisely ignored it back when I wrote our setup.py. It turns out that getting a launcher script to work properly on Windows is tricky. The `entry_points` field generates a platform-appropriate launcher script at install time, so we get Windows for free. Previously our launcher script checked the version of Python and printed a helpful error if it was too low. Because our main.py has `yield from` syntax in it, printing such an error message isn't possible; we'll crash with a syntax error first. We could create another file within the modile (or maybe an __init__.py) to support this, but for now I'm just dropping the feature. Test Plan: Manually played with peru.sh to make sure it still works. Ran `pip install .` to check that the generated script works. Also tested that on my Windows VM, and it works great. (It generates an exe file, in fact.) Reviewers: sean Differential Revision: https://phabricator.buildinspace.com/D135
This commit is contained in:
parent
1c6d7c1a55
commit
d3d06a0b71
11
bin/peru
11
bin/peru
|
@ -1,11 +0,0 @@
|
|||
#! /usr/bin/env python3
|
||||
|
||||
import sys
|
||||
|
||||
if sys.version_info.major < 3 or sys.version_info.minor < 3:
|
||||
print("Peru requires Python 3.3 or newer.")
|
||||
sys.exit(1)
|
||||
|
||||
from peru import main
|
||||
|
||||
main.main()
|
2
peru.sh
2
peru.sh
|
@ -27,4 +27,4 @@ repo_root=$(dirname $(realpath $BASH_SOURCE))
|
|||
|
||||
source "$repo_root/scripts/env.sh"
|
||||
|
||||
"$repo_root/bin/peru" "$@"
|
||||
python3 -c "import peru.main; peru.main.main()" "$@"
|
||||
|
|
Loading…
Reference in New Issue