diff --git a/README.txt b/README.txt index bdd0b56..5c9b155 100644 --- a/README.txt +++ b/README.txt @@ -1,7 +1,7 @@ -Installer version 5 beta 5 +PyInstaller version 1.0 -Use: - see doc/begin.html +Use: + see doc/Tutorial.txt Installation in brief: @@ -13,10 +13,12 @@ Non-Windows users should: Everyone should: python Configure.py -Now you're ready to use it! - see Makespec in doc/begin.html + python Makespec.py /path/to/yourscript.py /path/for/specfile.spec + + python Build.py /path/for/specfile.spec + + .done. Major changes in this release: - --onefile always creates a temporary directory (see doc/begin.html) - - can use UPX if you have it installed - - many bug fixes. + * __write_changes_here__ + * many bug fixes. diff --git a/doc/LICENSE b/doc/LICENSE new file mode 100644 index 0000000..41a4e80 --- /dev/null +++ b/doc/LICENSE @@ -0,0 +1,40 @@ +# +# + +A NOTE ON PYINSTALLER LICENSE + +The original base code of this software was licensed under the MIT license +by McMillan Enterprises as presented at LICENSE.MCMILLAN. The current code +is distributed under GPL as agreed by McMillan. NOW, THERE IS AN EXCEPTION +that specifically apply to the bootloader and some runtime libraries the +exception is as follows: + + +======================================================================= +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +In addition to the permissions in the GNU General Public License, the +Copyright holders gives you unlimited permission to link the *compiled* +version of this file into combinations with other programs, +and to distribute *those combinations* without any restriction coming +from the use of this file. (The General Public License restrictions +*do apply* in other respects; for example, they cover modification of +the file, and distribution when not linked into a combine executable.) + +This code is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file LICENSE.GPL. +======================================================================= + + +The rest of the code is GPL. For more information look at each file header. + +# +# diff --git a/doc/LICENSE.GPL b/doc/LICENSE.GPL new file mode 100644 index 0000000..a66eb90 --- /dev/null +++ b/doc/LICENSE.GPL @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS diff --git a/doc/archives.html b/doc/archives.html deleted file mode 100644 index fd004c7..0000000 --- a/doc/archives.html +++ /dev/null @@ -1,36 +0,0 @@ - -
-SitemapGetting StartedUtilities Spec Files When Things Go Wrong Standalone Executables Python Archives Analyzing Python Modules An Import Framework Bug Tracker |
- Archives-You know what an archive is: a .tar file, a .jar file, a .zip file. Two kinds of archives are used here. One is equivalent to a Java .jar file - it allows Python modules to be stored efficiently and, (with some import hooks) imported directly. This is a ZlibArchive. The other (a CArchive) is equivalent to a .zip file - a general way of packing up (and optionally compressing) arbitrary blobs of data. It gets its name from the fact that it can be manipulated easily from C, as well as from Python. Both of these derive from a common base class, making it fairly easy to create new kinds of archives. -ZlibArchive-A ZlibArchive contains compressed .pyc (or .pyo) files. The Table of Contents is a marshalled dictionary, with the key (the module's name as given in an "import" statement) associated with a seek position and length. Because it is all marshaled Python, ZlibArchives are completely cross-platform. -A ZlibArchive hooks in with iu.py so that, with a little setup, the archived modules can be imported transparently. Even with compression at level 9, this works out to being faster than the normal import. Instead of searching sys.path, there's a lookup in the dictionary. There's no stat-ing of the .py and .pyc and no file opens (the file is already open). There's just a seek, a read and a decompress. A traceback will point to the source file the archive entry was created from (the __file__ attribute from the time the .pyc was compiled). On a user's box with no source installed, this is not terribly useful, but if they send you the traceback, at least you can make sense of it.
- CArchive-
A CArchive contains whatever you want to stuff into it. It's very much like a .zip file. They are easy to create in Python and unpack from C code. CArchives can be appended to other files (like ELF and COFF executables, for example). To allow this, they are opened from the end, so the TOC for a CArchive is at the back, followed only by a cookie that tells you where the TOC starts and where the archive itself starts. -CArchives can also be embedded within other CArchives. The inner archive can be opened in place (without extraction). -Each TOC entry is variable length. The first field in the entry tells you the length of the entry. The last field is the name of the corresponding packed file. The name is null terminated. Compression is optional by member. -There is also a type code associated with each entry. If you're using a CArchive as a .zip file, you don't need to worry about this. The type codes are used by the self-extracting executables. - - |
-
| copyright 1999-2002 McMillan Enterprises, Inc. |
- |
SitemapGetting StartedUtilities Spec Files When Things Go Wrong Standalone Executables Python Archives Analyzing Python Modules An Import Framework Bug Tracker |
- Getting Started-Contents:
Installing Installer-First, unpack the archive wherever you want to. Installer is not a Python package, so it doesn't need to go in You will need a separate copy for each Python version you wish to work with (or you'll need to rerun
-
Windows users can skip this step, because all of Python is contained in pythonXX.dll, and Installer will use your pythonXX.dll. -On non-Windows platforms, the first thing to do is build the runtime executables. -Change to the
- The Windows distributions come with four executables in the Note that the
In the root directory, run
[For Windows COM server support, see below.] -The root directory has a script
Python -O), see below.]
- For simple projects, the generated spec file will probably be sufficient. For more complex projects, it should be regarded as a template. The spec file is actually Python code, and modifying it should be much easier than working with the config files used in earlier Installer releases. See Spec Files for details. - -
In most cases, this will be all you have to do. If not, see When things go wrong and be sure to read the introduction to Spec Files. - -
- will generate a new script drivescript.py and a spec file for the script.
- [For Win32all builds before 151, use These options are allowed: -
Now run If you have the Warnings: the inprocess COM server support will not work when the client process already has Python loaded. It would be rather tricky to non-obtrusively hook into an already running Python, but the show-stopper is that the Python/C API won't let me find out which interpreter instance I should hook into. (If this is important to you, you might experiment with using apartment threading, which seems the best possibility to get this to work).
- To use a "frozen" COM server from a Python process, you'll have to load it as an exe:
- MakeCOMServer also assumes that your top level code (registration etc.) is "normal". If it's not, you will have to edit the generated script. - -There are two facets to running optimized: gathering The See Spec Files for details. - -On both Windows and Linux, UPX can give truly startling compression - the days of fitting something useful on a diskette are not gone forever! Installer has been tested with UPX 1.24 without problems. Just get it and install it on your PATH, then rerun configure. For Windows, that's all you need to know. -For Linux, a bit more discussion is in order. First, UPX is only useful on executables, not shared libs. Installer accounts for that, but to get the full benefit, you might rebuild Python with more things statically linked. -More importantly, when run finds that it's sys.argv[0] does not contain a path, it will use A This has a number of implications. -
While I am not a security expert, I believe the scheme is reasonably safe. If for some reason, the Please show your appreciation and help fund continued development of Installer by - making a contribution. To date, the contributions I have received amount to a tiny bit more than I pay for the hosting of this site for one month. If Installer is contributing - to your commercial success, please let your conscience be your guide. I really do not want to go to a dual-licensed model. - -This code is licensed under the MIT license. Please see license.txt. Note that I do - not consider that Installer includes significant portions of itself in the executables it produces, so I make no restrictions on their licensing. - -Report bugs (or feature requests, or send patches) here. Please make sure you set Product to Subscribe to the Installer Mailing List to discuss Installer related issues. Having been discovered by the SPAM monsters, you now need to join before you can post (it is a low volume list). - - |
-
| copyright 1999-2002 McMillan Enterprises, Inc. |
- |
SitemapGetting StartedUtilities Spec Files When Things Go Wrong Standalone Executables Python Archives Analyzing Python Modules An Import Framework Bug Tracker |
- When Things Go Wrong-Contents-
When an Analysis step runs, it produces a warnings file (named - W: no module named dos (conditional import by os) - W: no module named ce (conditional import by os) - W: no module named os2 (conditional import by os) -- Note that the analysis has detected that the import is within a conditional block (an if statement). The analysis also detects if an import within a function or class, (delayed) or at the top level. A top-level, non-conditional import failure is really a hard error. There's at least a reasonable chance that conditional and / or delayed import will be handled gracefully at runtime.
- Ignorable warnings may also be produced when a class or function is declared in a package (an Warnings are also produced when an Any problem detected here can be handled by hooking the analysis of the module. See Listing Hidden Imports below for how to do it. - -Setting You can also pass a -v (verbose imports) flag to the embedded Python. This can be extremely useful. I usually try it even on apparently working apps, just to make sure that I'm always getting my copies of the modules and no import has leaked out to the installed Python. -You set this (like the other runtime options) by feeding a phone TOC entry to the EXE. The easiest way to do this is to change the EXE from: - - These messages will always go to stdout, so you won't see them on Windows if When the analysis phase cannot find needed modules, it may be that the code is manipulating You can do the same when running - Makespec.py --paths=path/to/thisdir;path/to/thatdir ... -- (on *nix, use : as the path separator).
-
- Hidden imports are fairly common. These can occur when the code is using Hidden imports are handled by hooking the module (the one doing the hidden imports) at Analysis time. Do this by creating a file named If you successfully hook a publicly distributed module in this way, please send me the hook so I can make it available to others. - Python allows a package to extend the search path used to find modules and sub-packages through the Because the Note that manipulations of Once in awhile, that's not enough. - -More bizarre situations can be accomodated with runtime hooks. These are small scripts that manipulate the environment before your main script runs, effectively providing additional top-level code to your script. -At the tail end of an analysis, the module list is examined for matches in So putting an entry:
- Hooks done in this way, while they need to be careful of what they import, are free to do almost anything. One provided hook sets things up so that In most sophisticated apps, it becomes necessary to figure out (at runtime) whether you're running "live" or "frozen". For example, you might have a configuration file that (running "live") you locate based on a module's The For really advanced users, you can access the In a In a If you add them as Report bugs (or feature requests) here. Please make sure you set Product to Pmw comes with a script named If you're using |
-
| copyright 1999-2002 McMillan Enterprises, Inc. |
- |
SitemapGetting StartedUtilities Spec Files When Things Go Wrong Standalone Executables Python Archives Analyzing Python Modules An Import Framework Bug Tracker |
- An imputil replacement-[This is part of Installer release 5. It can also be downloaded separately.] -Module
There is an ImportManager which provides the replacement for builtin ImportManager-
ImportDirectors-An To see how this works, we need to examine the PathImportDirector-The Owners-An As with So structurally, we have a tree, rooted at the The rest of the import namespace is covered by treelets, each rooted in a package module (an Packages-To make this work, When a module within the package is imported, the request is routed (by the Possibilities-Let's say we want to import from .zip files. So, we subclass Once the new Compatibility-This code has been tested with the PyXML, mxBase and Win32 packages, covering over a dozen import hacks from manipulations of Performance-In most cases, Limitations-This module makes no attempt to facilitate policy import hacks. It is easy to implement certain kinds of policies within a particular domain, but fundamentally Quite simply, I think cross-domain import hacks are a very bad idea. As author of Installer, I have been dealing with import hacks for three years now. Many of them are highly fragile; they often rely on undocumented (maybe even accidental) features of implementation. A cross-domain import hack is not likely to work with PyXML, for example. -That rant aside, you can modify Usage-Here's a simple example of using - >>> import iu - >>> iu.ImportManager().install() - >>> - >>> import DateTime - >>> DateTime.__importsub__ - <method PathImportDirector.getmod - of PathImportDirector instance at 825900> - >>> -- - |
-
| copyright 1999-2002 McMillan Enterprises, Inc. |
- |
SitemapGetting StartedUtilities Spec Files When Things Go Wrong Standalone Executables Python Archives Analyzing Python Modules An Import Framework Bug Tracker |
- A modulefinder Replacement-[This is part of Installer release 5. It can also be downloaded separately.] -Module It also uses Instead of an ImportTracker-
analyze_one()-When a name is imported, there are structural and dynamic effects. The dynamic effects are due to the execution of the top-level code in the module (or modules) that get imported. The structural effects have to do with whether the import is relative or absolute, and whether the name is a dotted name (if there are N dots in the name, then N+1 modules will be imported even without any code running). -The Module Classes-There are The highly astute will notice that there is a hole in code scanning-Like The code scanning also keeps track (as well as it can) of the context of an import. It recognizes when imports are found at the top-level, and when they are found inside definitions (deferred imports). Within that, it also tracks whether the import is inside a condition (conditional imports). -Hooks-In
The first hook ( The second hook ( The callable hook exists for things like dynamic modification of a package's [Download an example hooks package (as a zip or tar.gz file) - Installer 5 already contains these files.] -Warnings-
Note that by using a hook module, you can silence some particularly tiresome warnings, but not all of them. -Cross Reference-Once a full analysis (that is, an Usage-A simple example follows: -
- >>> import mf
- >>> a = mf.ImportTracker()
- >>> a.analyze_r("os")
- ['os', 'sys', 'posixpath', 'nt', 'stat', 'string', 'strop',
- 're', 'pcre', 'ntpath', 'dospath', 'macpath', 'win32api',
- 'UserDict', 'copy', 'types', 'repr', 'tempfile']
- >>> a.analyze_one("os")
- ['os']
- >>> a.modules['string'].imports
- [('strop', 0, 0), ('strop.*', 0, 0), ('re', 1, 1)]
- >>>
-
- The tuples in the - >>> for w in a.modules['string'].warnings: print w - ... - W: delayed eval hack detected at line 359 - W: delayed eval hack detected at line 389 - W: delayed eval hack detected at line 418 - >>> for w in a.getwarnings(): print w - ... - W: no module named pwd (delayed, conditional import by posixpath) - W: no module named dos (conditional import by os) - W: no module named os2 (conditional import by os) - W: no module named posix (conditional import by os) - W: no module named mac (conditional import by os) - W: no module named MACFS (delayed, conditional import by tempfile) - W: no module named macfs (delayed, conditional import by tempfile) - W: top-level conditional exec statment detected at line 47 - - os (C:\Program Files\Python\Lib\os.py) - W: delayed eval hack detected at line 359 - - string (C:\Program Files\Python\Lib\string.py) - W: delayed eval hack detected at line 389 - - string (C:\Program Files\Python\Lib\string.py) - W: delayed eval hack detected at line 418 - - string (C:\Program Files\Python\Lib\string.py) - >>> -- (The historically minded will note the antiquity of the Python used to demonstrate this.) - - |
-
| copyright 1999-2002 McMillan Enterprises, Inc. |
- |
SitemapGetting StartedUtilities Spec Files When Things Go Wrong Standalone Executables Python Archives Analyzing Python Modules An Import Framework Bug Tracker |
- Spec Files-Contents: - - -Spec files are in Python syntax. They are evaluated by This creates a single file deployment with all binaries (extension modules and their dependencies) packed into the executable. -A simplistic single directory deployment might look like this:
- Note that neither of these examples are realistic. Use All of the classes you see above are subclasses of The high level view is that an Analysis takes a list of scripts as input, and generates three "outputs", held in attributes named Before you can do much with a spec file, you need to understand the A Besides the normal list methods and operations, To add files to a
You can force the include of any file in much the same way you do excludes.
- There's not much reason to use this technique for This technique is most useful for data files (see the
Advanced users should note that by using set differences and intersections, it becomes possible to factor out common modules, and deploy a project containing multiple executables with minimal redundancy. You'll need some top level code in each executable to mount the common
TOCs accessed as attributes of the Analysis.
-
Generally, you will not need to create your own
There are actually two On Windows, this provides support for doing in-process COM servers. It is not generalized. However, embedders can follow the same model to build a special purpose DLL so the Python support in their app is hidden. You will need to write your own dll, but thanks to Allan Green for refactoring the C code and making that a managable task. - -
Since a |
- ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| copyright 1999-2002 McMillan Enterprises, Inc. |
- |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SitemapGetting StartedUtilities Spec Files When Things Go Wrong Standalone Executables Python Archives Analyzing Python Modules An Import Framework Bug Tracker |
- Self-extracting executables-The ELF executable format (Windows, Linux and some others) allows arbitrary data to be concatenated to the end of the executable without disturbing it's functionality. - For this reason, a CArchive's Table of Contents is at the end of the archive. - The executable can open itself as a binary file name, seek to the end and 'open' the CArchive (see figure 3). -On other platforms, the archive and the executable are separate, but the archive is named executable.pkg, and expected to be in the same directory. Other than that, the process is the same. -One Pass Execution-In a single directory deployment (
Two Pass Execution-There are a couple situations which require two passes: -
The first pass: -
The child process executes as in One Pass Execution above (the magic environment variable is what tells it that this is pass two). -
There are, of course, quite a few differences between the Windows and Unix/Linux versions. The major one is that because all of Python on Windows is in pythonXX.dll, and dynamic loading is so simple-minded, I can use one binary with any version of Python. There's much in common, though, and that C code can be found in The Unix/Linux build process (which you need to run just once for any version of Python) makes use of the config information in your install (if you installed from RPM, you need the Python-development RPM). It also overrides In both cases, while one Installer download can be used with any Python version, you need to have separate installations for each Python version. - |
-
| copyright 1999-2002 McMillan Enterprises, Inc. |
- |
SitemapGetting StartedUtilities Spec Files When Things Go Wrong Standalone Executables Python Archives Analyzing Python Modules An Import Framework Bug Tracker |
- The Utilities
ArchiveViewer lets you examine the contents of any Installer-built archive or executable (PYZ, PKG or exe). Invoke it with the target as the first arg (I have it set up as a Send-To so it shows on my context menu in Explorer). You can navigate through the archive with these commands: -
GrabVersion outputs text which can be eval'ed by versionInfo to reproduce a version resource. Invoke it with the full path name of a Windows executable (with a version resource) as the first argument. If you cut & paste (or redirect to a file), you can then edit the version information. The edited text file can be used in a I did it this way because version resources are rather strange beasts, and fully understanding them is probably impossible. Some elements are optional, others required, but you could spend unbounded amounts of time figuring this out, because it's not well documented. When you view the version tab on a properties dialog, there's no straightforward relationship between how the data is displayed and the structure of the resource itself. So the easiest thing to do is find an executable that displays the kind of information you want, grab it's resource and edit it. Certainly easier than the Version resource wizard in VC++. - -Analyzing Dependencies-You can interactively track down dependencies, including getting cross-references by using mf.py, documented here. - -- |
-
| copyright 1999-2002 McMillan Enterprises, Inc. |
- |