On 5/5/2014 5:32 PM, Anthony Tuininga wrote: > Hi, > > I am the author of cx_Freeze which creates "frozen" executables from > Python scripts. To this point I have been using frozen modules (compiled > C) but this has the side effect of bundling parts of Python with a > cx_Freeze release -- and this has bitten me on a number of occasions > when newer versions of Python use slightly incompatible modules. :-) > > By scanning the code I discovered that Python automatically searches on > startup > > <PYTHONHOME>/lib/pythonNN.zip > > where NN is replaced by the major and minor version that is being > executed. Using this would allow me to ensure that bootstrap modules are > not bundled with cx_Freeze but acquired from the distribution that is > actually using it -- thereby eliminating the hassle noted above. > > I have tested this approach and found it works flawlessly. There is, > however, no documentation that I can find for the contents of sys.path > -- the documentation simply says that it is an installation default and > doesn't specify what that default is. > > So my question is: can I safely make use of this "feature"? It has > remained in place since at least Python 2.6 but I don't want to assume > anything. Please advise! Thanks. I would say yes. AFAIK /lib has always by used for the stdlib on Windows and /lib/pythonxy on *nix. Both are mentioned in the 4th paragraph of the site module doc. We do not lightly change directory structure. PEP 273 then says "The zip archive must be treated exactly as a subdirectory tree,". I take this to mean that lib/pythonxy.zip should work the same as lib/pythonxy/ does. You can depend on the feature working as long as it works. Your bigger worry is accidental regression. I suggest testing release candidates (there is one for 3.4.1 now, I believe) and also an early alpha and beta for new release. The candidate may have a zip patch affecting central directory reading. If not, there is an issue on the tracker. You could monitor patches by filtering the new-issue announcements for 'zip'. -- Terry Jan Reedy
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4