Site Contents
Wikispaces topics
Wikispaces topics
- Principles for Addons
- Documentation for Addons
- Addon components on this site
- Utility functions
- SiteTOC
- Remove Addon BRs
- Customizations & Fixes
- Notes about Wikispaces
- Tests
- WS features Test
- CSS
- Javascript
- Misc
- Collaboration/CMSs
- Notes on features
- Drupal investigations
- Drupal docs study
- Software development
- Fonts
- Java
- JavaScript/CSS
- Trees and TreeGrids
- JavaScript frameworks
- PHP
- Python
- Organization for common modules
- Packaging and deployment examined
- Packaging and deployment notes
- Distutils, setuptools, pip sleuthing
- Environment and Launcher
- Python features and libraries
- Miscellaneous
- Arduino and AVR
- Delphi
- Matlab
- ANTLR
- Process management
- Microsoft Access
- Linux
- Visio
- Economics
- "Making"
- Laser cutter notes
- Motor notes
- DIY Bio
- Includes
- For pages
- zhtml_pageinfo
- util_authordate (deprec)
- Test
- For pages
- Admin
- Addon Components, V.old
- Left-overs
Table of Contents
Revised by: gwideman, Oct 23, 2013 8:37 pm (19 revisions)
Overview
In an effort to discover the true behavior of Windows Python Launcher, this page examines the main source code for py.exe, launcher.c, at bitbucket.org/vinay.sajip/pylauncher.The source code interacts with the following items, which affects its decisions:
launcher.c source code steps
launcher.c source code version: a6c53b8shebang-line
Run (invoke1) python with args: ""
-X.Y [script]
If yes, locate_python("X.Y"), run (invoke1) python with Args: rest-CL
If not X.Y format, fall through...
--help
Show py help. Run (invoke1) python with same arguments (so it shows help).
-arg(s) script [args]
maybe_handle_shebang(scriptpath, all-of-py's args)
continue...
Run python (invoke2) with all-of-py's args.
maybe_handle_shebang
If no python on PATH, fall through...
Proceeds as for other /builtin-virtual-paths/python cases. Ie: Uses locate_python(suffix), (not find_on_path()). Run python (invoke5).
- in PATH
- in custom commands defined in py.ini [commands] section
If found, run command (invoke3). Args: ???locate_python algorithm
document herepy.ini configuration file format
Notes:
Hard-coded Lists
Potential surprises
To be verified:When there is no py configuration (ie: no py.ini [default] sections and no corresponding environment variables) and no shebang-line, issuing command-line 'py script' or just plain 'script' will use locate_python's algorithm, which defaults to selecting version=2. In particular, this scenario uses locate_python instead of using PATH, in contrast to 'python script', which does use PATH.
Issues in handling of shebang line
Code clarifications
command, cmdline
- User's command line which invoked py
- Launcher Virtual command: One of several unix-appropriate paths to python which py.exe understands as an instruction to use its locate_python algorithm. The list of these Virtual Command paths is hard-coded into py.exe
- Custom command: A command defined by the user in one of the py.ini files. To be invoked in a script's shebang line
- The command parsed from a script's shebang line
- The command being assembled by py.exe to execute python
Because of this overloading of the word "command", all instances of 'command' or 'cmd' could be made more distinct