From: <th...@us...> - 2014-05-08 18:40:22
|
Revision: 740 http://sourceforge.net/p/py2exe/svn/740 Author: theller Date: 2014-05-08 18:40:18 +0000 (Thu, 08 May 2014) Log Message: ----------- py2exe for Python 3. Copied from the repository at https://ctypes-stuff.googlecode.com/svn/trunk/mf where it was developed. Actually it was grown out of some modulefinder experiments with Python 3. Added Paths: ----------- trunk/py2exe-3/ trunk/py2exe-3/LICENSE.txt trunk/py2exe-3/MANIFEST.in trunk/py2exe-3/MIT-License.txt trunk/py2exe-3/MPL2-License.txt trunk/py2exe-3/README.rst trunk/py2exe-3/TODO.txt trunk/py2exe-3/build_exe.py trunk/py2exe-3/py2exe/ trunk/py2exe-3/py2exe/__init__.py trunk/py2exe-3/py2exe/__main__.py trunk/py2exe-3/py2exe/_wapi.py trunk/py2exe-3/py2exe/boot_common.py trunk/py2exe-3/py2exe/boot_ctypes_com_server.py trunk/py2exe-3/py2exe/boot_service.py trunk/py2exe-3/py2exe/build_exe.py trunk/py2exe-3/py2exe/distutils_buildexe.py trunk/py2exe-3/py2exe/dllfinder.py trunk/py2exe-3/py2exe/hooks.py trunk/py2exe-3/py2exe/icons.py trunk/py2exe-3/py2exe/mf3.py trunk/py2exe-3/py2exe/patch_distutils.py trunk/py2exe-3/py2exe/py2exe_distutils.py trunk/py2exe-3/py2exe/resources.py trunk/py2exe-3/py2exe/runtime.py trunk/py2exe-3/py2exe/setup_template.py trunk/py2exe-3/py2exe/versioninfo.py trunk/py2exe-3/py2exe.ods trunk/py2exe-3/setup.py trunk/py2exe-3/source/ trunk/py2exe-3/source/MemoryModule.c trunk/py2exe-3/source/MemoryModule.h trunk/py2exe-3/source/MyLoadLibrary.c trunk/py2exe-3/source/MyLoadLibrary.h trunk/py2exe-3/source/Python-dynload.h trunk/py2exe-3/source/_memimporter.c trunk/py2exe-3/source/actctx.c trunk/py2exe-3/source/actctx.h trunk/py2exe-3/source/dll.c trunk/py2exe-3/source/icon.rc trunk/py2exe-3/source/icon1.ico trunk/py2exe-3/source/python-dynload.c trunk/py2exe-3/source/resource.h trunk/py2exe-3/source/run.c trunk/py2exe-3/source/run_ctypes_dll.c trunk/py2exe-3/source/run_w.c trunk/py2exe-3/source/start.c trunk/py2exe-3/tests/ trunk/py2exe-3/tests/maketest.py trunk/py2exe-3/tests/test_mf.py trunk/py2exe-3/tests/test_modulefinder.py trunk/py2exe-3/zipextimporter.py Added: trunk/py2exe-3/LICENSE.txt =================================================================== --- trunk/py2exe-3/LICENSE.txt (rev 0) +++ trunk/py2exe-3/LICENSE.txt 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,6 @@ +The files source/MemoryModule.c and source/MemoryModule.h are licensed +under the Mozilla Public License Version 2.0, see +MPL2-License.txt. + +All other files are licensed under the MIT/X11 License, +see MIT-License.txt. Added: trunk/py2exe-3/MANIFEST.in =================================================================== --- trunk/py2exe-3/MANIFEST.in (rev 0) +++ trunk/py2exe-3/MANIFEST.in 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,5 @@ +include source/*.c +include source/*.h +include source/*.rc +include source/*.ico +include LICENSE.txt MIT-License.txt MPL2-License.txt \ No newline at end of file Added: trunk/py2exe-3/MIT-License.txt =================================================================== --- trunk/py2exe-3/MIT-License.txt (rev 0) +++ trunk/py2exe-3/MIT-License.txt 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,20 @@ +Copyright (c) 2000-2014 Thomas Heller, Mark Hammond, Jimmy Retzlaff + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Added: trunk/py2exe-3/MPL2-License.txt =================================================================== --- trunk/py2exe-3/MPL2-License.txt (rev 0) +++ trunk/py2exe-3/MPL2-License.txt 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. Added: trunk/py2exe-3/README.rst =================================================================== --- trunk/py2exe-3/README.rst (rev 0) +++ trunk/py2exe-3/README.rst 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,147 @@ +py2exe for Python 3 +=================== + +`py2exe` is a distutils extension which allows to build standalone +Windows executable programs from Python scripts; Python 3.3 and Python +3.4 are supported. + +`py2exe` for ``Python 2`` is available at http://sourceforge.net/project/showfiles.php?group_id=15583 + +.. contents:: + + +News +---- + +Create an exe-file with a simple command +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +In addition to you beloved setup.py scripts, there is now a +command-line utility which allows to build the exe without any effort: + +:: + + py -3.3 -m py2exe.build_exe myscript.py + +or (if you have the Python ``Scripts`` directory on your PATH): + +:: + + build_exe myscript.py + + +will create an executable `myscript.exe` in the `dist` subdirectory. + +If you add the ``-W <setup-script.py>`` switch to the command line it +will write a *commented* ``setup.py`` script for you, which can be +customized further: + +:: + + py -3.3 -m py2exe myscript.py -W mysetup.py + ... edit myssetup.py + py -3.3 mysetup.py py2exe + +Hooks +~~~~~ + +`py2exe` now contains a hooks module which allows to customize the +build-process. The goal is to fine-tune the build process so that no +warnings are emitted from modulefinder. + +The hooks module is the `py2exe\\hooks.py` file in your installation; +it currently contains hooks for quite some libraries. Patches for +more libraries will gratefully be accepted. + +Windows C-runtime library +~~~~~~~~~~~~~~~~~~~~~~~~~ + +The C-runtime library for Python 3 does NOT need a windows manifest +any longer, unless you have special requirements. + +Compatibility with py2exe for Python 2 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +It is planned to achive full compatibility with the setup-scripts for +Python 2; however this is probably not yet the case. + +Installation +------------ + +:: + + py -3.3 -m pip install py2exe + +or + +:: + + pip install py2exe + + +Using the builder +----------------- + +Build runtime archive for a script: + +:: + + build_exe [-h] [-i modname] [-x modname] [-p package_name] [-O] [-s] + [-r] [-f modname] [-v] [-c] [-d DESTDIR] [-l LIBNAME] + [-b {0,1,2,3}] [-W setup_path] + [-svc service] + [script [script ...]] + + +positional arguments: + script + +optional arguments: + -h, --help show this help message and exit + -i modname, --include modname + module to include + -x modname, --exclude modname + module to exclude + -p package_name, --package package_name + module to exclude + -O, --optimize use optimized bytecode + -s, --summary print a single line listing how many modules were + found and how many modules are missing + -r, --report print a detailed report listing all found modules, the + missing modules, and which module imported them. + -f modname, --from modname + print where the module <modname> is imported. + -v verbose output + -c, --compress create a compressed library + -d DESTDIR, --dest DESTDIR + destination directory + -l LIBNAME, --library LIBNAME + relative pathname of the python archive + + -b option, --bundle-files option + How to bundle the files. 3 - create an .exe, a zip- + archive, and .pyd files in the file system. 2 - create + .exe and a zip-archive that contains the pyd files. + + -W setup_path, --write-setup-script setup_path + Do not build the executables; instead write a setup + script that allows further customizations of the build + process. + + --service modname + The name of a module that contains a service + + +Using a setup-script +-------------------- + +Creating an executable (or more than one at the same time) with a +setup-script works in the same way as for Python 2. The command-line +switches are the same as before; but they are *NOT* compatible with +the command-line switches for the builder mentioned above. + +Bugs +---- + +Building isapi extensions is not supported: I don't use them so I will +not implement this. Added: trunk/py2exe-3/TODO.txt =================================================================== --- trunk/py2exe-3/TODO.txt (rev 0) +++ trunk/py2exe-3/TODO.txt 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,51 @@ +Bugs: + +- debug the 'verbose' argument to py2exe. It defaults to 1, using + '-q' sets it to 0, '-v' doesn't change it, '-vv' sets it to 2. + Strange. + +- Is this true any longer ???: + ctypes com servers (inproc) do not work with bundle_files 2 or 3 + when the same Python version is used in the client. Did this work + at all with py2exe 0.6? + +- distutils catches errors different from DistutilsError (or so) + +- distutils_buildexe needs to import DistutilsOptionError (or so) + +- Does probably not work with extensions built against the limited API + (python3.dll)??? + +- py2exe for Python2 used an 'uac_info' string (exec_level) or tuple + (exec_level, ui_access) attribute on the Target to include or patch + a default manifest. + +- custom_boot_script ? + +- typelib ? + +Ideas: + +- clean up console output when building. + +- add some scripts to inspect executables, like: +- dump_manifest.py +- dump_versioninfo.py +- or even a general resource dumper? + +TODO: + +- services cmdline_style not yet implemented + +Fixed bugs: + + rev 380: - ctypes DLL COM servers can now load dlls (like sqlite3.dll) correctly. + rev 343: - DLL com servers are now implemented + rev 336: - py2exe\dll.dll is not installed. + rev 342: - when installed as egg, py2exe/boot_common.py is not a file and so not found. + rev 342: - number of icons (or icon images) is limited for whatever reason. + rev 342: - extensions are in the wrong directory when library is in a subdirectory + rev 342: - (String) Versioninfo not build? (Needs 'self.version = "6.5"' attribute in Target???) + Must include this into setup_template.py! + rev 342: - services not yet implemented + Added: trunk/py2exe-3/build_exe.py =================================================================== --- trunk/py2exe-3/build_exe.py (rev 0) +++ trunk/py2exe-3/build_exe.py 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,8 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +"""build_exe script.""" + +from py2exe.build_exe import main + +if __name__ == "__main__": + main() Added: trunk/py2exe-3/py2exe/__init__.py =================================================================== --- trunk/py2exe-3/py2exe/__init__.py (rev 0) +++ trunk/py2exe-3/py2exe/__init__.py 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,9 @@ +#!/usr/bin/python3,3 +# -*- coding: utf-8 -*- +"""py2exe package +""" +__version__ = "0.9.1.8" + +from .patch_distutils import patch_distutils + +patch_distutils() Added: trunk/py2exe-3/py2exe/__main__.py =================================================================== --- trunk/py2exe-3/py2exe/__main__.py (rev 0) +++ trunk/py2exe-3/py2exe/__main__.py 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,8 @@ +#!/usr/bin/python3.3 +# -*- coding: utf-8 -*- +"""py2exe.__main__ +""" + +if __name__ == "__main__": + from . import build_exe + build_exe.main() Added: trunk/py2exe-3/py2exe/_wapi.py =================================================================== --- trunk/py2exe-3/py2exe/_wapi.py (rev 0) +++ trunk/py2exe-3/py2exe/_wapi.py 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,126 @@ +"""Some Windows api functions, data types, and constants.""" +from ctypes import * + +_kernel32 = WinDLL("kernel32") +_imagehlp = WinDLL("imagehlp") + +def BOOL_errcheck(result, func, args): + if result: + return result + raise WinError() + +## if __debug__: +## from ctypeslib.dynamic_module import include +## # 0x0502: Windows XP SP2 +## # 0x0600: (Internet Explorer 6) shell32.dll version 6 +## include("""\ +## #define UNICODE +## #define NO_STRICT +## #define WINVER 0x0502 +## #define _WIN32_WINNT 0x0502 +## #define _WIN32_IE 0x0600 +## #include <windows.h> +## #include <imagehlp.h> +## """, +## persist=True) + +WSTRING = c_wchar_p +STRING = c_char_p +UINT = c_uint +WCHAR = c_wchar +LPWSTR = WSTRING +GetWindowsDirectoryW = _kernel32.GetWindowsDirectoryW +GetWindowsDirectoryW.restype = UINT +GetWindowsDirectoryW.argtypes = [LPWSTR, UINT] +GetSystemDirectoryW = _kernel32.GetSystemDirectoryW +GetSystemDirectoryW.restype = UINT +GetSystemDirectoryW.argtypes = [LPWSTR, UINT] +DWORD = c_ulong +PVOID = c_void_p +HANDLE = PVOID +HINSTANCE = HANDLE +HMODULE = HINSTANCE +GetModuleFileNameW = _kernel32.GetModuleFileNameW +GetModuleFileNameW.restype = DWORD +GetModuleFileNameW.argtypes = [HMODULE, LPWSTR, DWORD] +BOOL = c_int + +# values for enumeration '_IMAGEHLP_STATUS_REASON' +BindOutOfMemory = 0 +BindRvaToVaFailed = 1 +BindNoRoomInImage = 2 +BindImportModuleFailed = 3 +BindImportProcedureFailed = 4 +BindImportModule = 5 +BindImportProcedure = 6 +BindForwarder = 7 +BindForwarderNOT = 8 +BindImageModified = 9 +BindExpandFileHeaders = 10 +BindImageComplete = 11 +BindMismatchedSymbols = 12 +BindSymbolsNotUpdated = 13 +BindImportProcedure32 = 14 +BindImportProcedure64 = 15 +BindForwarder32 = 16 +BindForwarder64 = 17 +BindForwarderNOT32 = 18 +BindForwarderNOT64 = 19 +_IMAGEHLP_STATUS_REASON = c_int # enum +CHAR = c_char +PIMAGEHLP_STATUS_ROUTINE = WINFUNCTYPE(BOOL, _IMAGEHLP_STATUS_REASON, STRING, STRING, c_ulong, c_ulong) +PSTR = STRING +BindImageEx = _imagehlp.BindImageEx +BindImageEx.restype = BOOL +BindImageEx.argtypes = [DWORD, PSTR, PSTR, PSTR, PIMAGEHLP_STATUS_ROUTINE] +BindImageEx.errcheck = BOOL_errcheck +BIND_ALL_IMAGES = 4 # Variable c_int +BIND_CACHE_IMPORT_DLLS = 8 # Variable c_int +BIND_NO_UPDATE = 2 # Variable c_int +LPCWSTR = WSTRING +SearchPathW = _kernel32.SearchPathW +SearchPathW.restype = DWORD +SearchPathW.argtypes = [LPCWSTR, LPCWSTR, LPCWSTR, DWORD, LPWSTR, POINTER(LPWSTR)] +BeginUpdateResourceW = _kernel32.BeginUpdateResourceW +BeginUpdateResourceW.restype = HANDLE +BeginUpdateResourceW.argtypes = [LPCWSTR, BOOL] +WORD = c_ushort +LPVOID = c_void_p +UpdateResourceW = _kernel32.UpdateResourceW +UpdateResourceW.restype = BOOL +UpdateResourceW.argtypes = [HANDLE, LPCWSTR, LPCWSTR, WORD, LPVOID, DWORD] +UpdateResourceW.errcheck = BOOL_errcheck +EndUpdateResourceW = _kernel32.EndUpdateResourceW +EndUpdateResourceW.restype = BOOL +EndUpdateResourceW.argtypes = [HANDLE, BOOL] +EndUpdateResourceW.errcheck = BOOL_errcheck +LPCSTR = STRING +UpdateResourceA = _kernel32.UpdateResourceA +UpdateResourceA.restype = BOOL +UpdateResourceA.argtypes = [HANDLE, LPCSTR, LPCSTR, WORD, LPVOID, DWORD] +UpdateResourceA.errcheck = BOOL_errcheck +RT_STRING = 6 # Variable WSTRING +RT_VERSION = 16 # Variable WSTRING +class tagVS_FIXEDFILEINFO(Structure): + pass +VS_FIXEDFILEINFO = tagVS_FIXEDFILEINFO +tagVS_FIXEDFILEINFO._fields_ = [ + ('dwSignature', DWORD), + ('dwStrucVersion', DWORD), + ('dwFileVersionMS', DWORD), + ('dwFileVersionLS', DWORD), + ('dwProductVersionMS', DWORD), + ('dwProductVersionLS', DWORD), + ('dwFileFlagsMask', DWORD), + ('dwFileFlags', DWORD), + ('dwFileOS', DWORD), + ('dwFileType', DWORD), + ('dwFileSubtype', DWORD), + ('dwFileDateMS', DWORD), + ('dwFileDateLS', DWORD), +] +VFT_APP = 1 # Variable c_long +VOS_NT_WINDOWS32 = 262148 # Variable c_long +BYTE = c_ubyte +RT_ICON = 3 # Variable WSTRING +RT_GROUP_ICON = 14 # Variable WSTRING Added: trunk/py2exe-3/py2exe/boot_common.py =================================================================== --- trunk/py2exe-3/py2exe/boot_common.py (rev 0) +++ trunk/py2exe-3/py2exe/boot_common.py 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,104 @@ +# Common py2exe boot script - executed for all target types. + +# When we are a windows_exe we have no console, and writing to +# sys.stderr or sys.stdout will sooner or later raise an exception, +# and tracebacks will be lost anyway (see explanation below). +# +# We assume that output to sys.stdout can go to the bitsink, but we +# *want* to see tracebacks. So we redirect sys.stdout into an object +# with a write method doing nothing, and sys.stderr into a logfile +# having the same name as the executable, with '.log' appended. +# +# We only open the logfile if something is written to sys.stderr. +# +# If the logfile cannot be opened for *any* reason, we have no choice +# but silently ignore the error. +# +# It remains to be seen if the 'a' flag for opening the logfile is a +# good choice, or 'w' would be better. +# +# More elaborate explanation on why this is needed: +# +# The sys.stdout and sys.stderr that GUI programs get (from Windows) are +# more than useless. This is not a py2exe problem, pythonw.exe behaves +# in the same way. +# +# To demonstrate, run this program with pythonw.exe: +# +# import sys +# sys.stderr = open("out.log", "w") +# for i in range(10000): +# print i +# +# and open the 'out.log' file. It contains this: +# +# Traceback (most recent call last): +# File "out.py", line 6, in ? +# print i +# IOError: [Errno 9] Bad file descriptor +# +# In other words, after printing a certain number of bytes to the +# system-supplied sys.stdout (or sys.stderr) an exception will be raised. +# + +import sys +import os +import ctypes + +##print("this is boot_common") +##print("PATH", repr(sys.path[0]), "thats it.") + +if sys.frozen == "windows_exe": + class Stderr(object): + _file = None + _error = None + def write(self, text, alert=ctypes.windll.user32.MessageBoxW, + fname=os.path.splitext(sys.executable)[0] + '.log'): + if self._file is None and self._error is None: + import atexit, os, sys + try: + self._file = open(fname, 'a') + except Exception as details: + self._error = details + atexit.register(alert, 0, + "The logfile '%s' could not be opened:\n %s" % \ + (fname, details), + "Errors in %r" % os.path.basename(sys.executable), + 0) + else: + atexit.register(alert, 0, + "See the logfile '%s' for details" % fname, + "Errors in %r" % os.path.basename(sys.executable), + 0) + if self._file is not None: + self._file.write(text) + self._file.flush() + def flush(self): + if self._file is not None: + self._file.flush() + sys.stderr = Stderr() + del Stderr + + class Blackhole(object): + softspace = 0 + def write(self, text): + pass + def flush(self): + pass + sys.stdout = Blackhole() + del Blackhole +del sys, ctypes + +## # Disable linecache.getline() which is called by +## # traceback.extract_stack() when an exception occurs to try and read +## # the filenames embedded in the packaged python code. This is really +## # annoying on windows when the d: or e: on our build box refers to +## # someone elses removable or network drive so the getline() call +## # causes it to ask them to insert a disk in that drive. +## import linecache +## def fake_getline(filename, lineno, module_globals=None): +## return '' +## linecache.orig_getline = linecache.getline +## linecache.getline = fake_getline +## +##del linecache, fake_getline Added: trunk/py2exe-3/py2exe/boot_ctypes_com_server.py =================================================================== --- trunk/py2exe-3/py2exe/boot_ctypes_com_server.py (rev 0) +++ trunk/py2exe-3/py2exe/boot_ctypes_com_server.py 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,89 @@ +# This support script is executed as the entry point for ctypes com servers. +# XXX Currently, this is always run as part of a dll. + +import sys +import _ctypes + +if 1: + ################################################################ + # XXX Remove later! + import ctypes + class LOGGER: + def __init__(self): + self.softspace = None + def write(self, text): + if isinstance(text, str): + ctypes.windll.kernel32.OutputDebugStringW(text) + else: + ctypes.windll.kernel32.OutputDebugStringA(text) + sys.stderr = sys.stdout = LOGGER() +## sys.stderr.write("PATH is %s\n" % sys.path) + +################################################################ +# tell the win32 COM registering/unregistering code that we're inside +# of an EXE/DLL + +if not hasattr(sys, "frozen"): + # standard exes have none. + sys.frozen = _ctypes.frozen = 1 +else: + # com DLLs already have sys.frozen set to 'dll' + _ctypes.frozen = sys.frozen + +# Add some extra imports here, just to avoid putting them as "hidden imports" +# anywhere else - this script has the best idea about what it needs. +# (and hidden imports are currently disabled :) +#... + +# We assume that py2exe has magically set com_module_names +# to the module names that expose the COM objects we host. +# Note that here all the COM modules for the app are imported - hence any +# environment changes (such as sys.stderr redirection) will happen now. +try: + com_module_names +except NameError: + print("This script is designed to be run from inside py2exe % s" % str(details)) + sys.exit(1) + +com_modules = [] +for name in com_module_names: + __import__(name) + com_modules.append(sys.modules[name]) + +def get_classes(module): + return [ob + for ob in module.__dict__.values() + if hasattr(ob, "_reg_progid_") + ] + +def build_class_map(): + # Set _clsid_to_class in comtypes.server.inprocserver. + # + # This avoids the need to have registry entries pointing to the + # COM server class. + classmap = {} + for mod in com_modules: + # dump each class + for cls in get_classes(mod): + classmap[cls._reg_clsid_] = cls + import comtypes.server.inprocserver + comtypes.server.inprocserver._clsid_to_class = classmap +build_class_map() +del build_class_map + +def DllRegisterServer(): + # Enumerate each module implementing an object + from comtypes.server.register import register + for mod in com_modules: + # register each class + for cls in get_classes(mod): + register(cls) + + +def DllUnregisterServer(): + # Enumerate each module implementing an object + from comtypes.server.register import unregister + for mod in com_modules: + # unregister each class + for cls in get_classes(mod): + unregister(cls) Added: trunk/py2exe-3/py2exe/boot_service.py =================================================================== --- trunk/py2exe-3/py2exe/boot_service.py (rev 0) +++ trunk/py2exe-3/py2exe/boot_service.py 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,200 @@ +# boot_service.py +import sys +import os +import servicemanager +import win32service +import win32serviceutil +import winerror +# We assume that py2exe has magically set service_module_names +# to the module names that expose the services we host. +service_klasses = [] +try: + service_module_names +except NameError: + print("This script is designed to be run from inside py2exe") + sys.exit(1) + +for name in service_module_names: + # Use the documented fact that when a fromlist is present, + # __import__ returns the innermost module in 'name'. + # This makes it possible to have a dotted name work the + # way you'd expect. + mod = __import__(name, globals(), locals(), ['DUMMY']) + for ob in mod.__dict__.values(): + if hasattr(ob, "_svc_name_"): + service_klasses.append(ob) + +if not service_klasses: + raise RuntimeError("No service classes found") + +# Event source records come from servicemanager +evtsrc_dll = os.path.abspath(servicemanager.__file__) + +# Tell the Python servicemanager what classes we host. +if len(service_klasses)==1: + k = service_klasses[0] + # One service - make the event name the same as the service. + servicemanager.Initialize(k._svc_name_, evtsrc_dll) + # And the class that hosts it. + servicemanager.PrepareToHostSingle(k) +else: + # Multiple services (NOTE - this hasn't been tested!) + # Use the base name of the exe as the event source + servicemanager.Initialize(os.path.basename(sys.executable), evtsrc_dll) + for k in service_klasses: + servicemanager.PrepareToHostMultiple(k._svc_name_, k) + +################################################################ + +if cmdline_style == "py2exe": + # Simulate the old py2exe service command line handling (to some extent) + # This could do with some re-thought + + class GetoptError(Exception): + pass + + def w_getopt(args, options): + """A getopt for Windows style command lines. + + Options may start with either '-' or '/', the option names may + have more than one letter (examples are /tlb or -RegServer), and + option names are case insensitive. + + Returns two elements, just as getopt.getopt. The first is a list + of (option, value) pairs in the same way getopt.getopt does, but + there is no '-' or '/' prefix to the option name, and the option + name is always lower case. The second is the list of arguments + which do not belong to any option. + + Different from getopt.getopt, a single argument not belonging to an option + does not terminate parsing. + """ + opts = [] + arguments = [] + while args: + if args[0][:1] in "/-": + arg = args[0][1:] # strip the '-' or '/' + arg = arg.lower() + if arg + ':' in options: + try: + opts.append((arg, args[1])) + except IndexError: + raise GetoptError("option '%s' requires an argument" % args[0]) + args = args[1:] + elif arg in options: + opts.append((arg, '')) + else: + raise GetoptError("invalid option '%s'" % args[0]) + args = args[1:] + else: + arguments.append(args[0]) + args = args[1:] + + return opts, arguments + + options = "help install remove auto disabled interactive user: password:".split() + + def usage(): + print("Services are supposed to be run by the system after they have been installed.") + print("These command line options are available for (de)installation:") + for opt in options: + if opt.endswith(":"): + print("\t-%s <arg>" % opt) + else: + print("\t-%s" % opt) + print() + + try: + opts, args = w_getopt(sys.argv[1:], options) + except GetoptError as detail: + print(detail) + usage() + sys.exit(1) + + if opts: + startType = None + bRunInteractive = 0 + serviceDeps = None + userName = None + password = None + + do_install = False + do_remove = False + + done = False + + for o, a in opts: + if o == "help": + usage() + done = True + elif o == "install": + do_install = True + elif o == "remove": + do_remove = True + elif o == "auto": + startType = win32service.SERVICE_AUTO_START + elif o == "disabled": + startType = win32service.SERVICE_DISABLED + elif o == "user": + userName = a + elif o == "password": + password = a + elif o == "interactive": + bRunInteractive = True + + if do_install: + for k in service_klasses: + svc_display_name = getattr(k, "_svc_display_name_", k._svc_name_) + svc_deps = getattr(k, "_svc_deps_", None) + win32serviceutil.InstallService(None, + k._svc_name_, + svc_display_name, + exeName = sys.executable, + userName = userName, + password = password, + startType = startType, + bRunInteractive = bRunInteractive, + serviceDeps = svc_deps, + description = getattr(k, "_svc_description_", None), + ) + done = True + + if do_remove: + for k in service_klasses: + win32serviceutil.RemoveService(k._svc_name_) + done = True + + if done: + sys.exit(0) + else: + usage() + + print("Connecting to the Service Control Manager") + servicemanager.StartServiceCtrlDispatcher() + +elif cmdline_style == "pywin32": + assert len(service_klasses) == 1, "Can only handle 1 service!" + k = service_klasses[0] + if len(sys.argv) == 1: + try: + servicemanager.StartServiceCtrlDispatcher() + except win32service.error as details: + if details[0] == winerror.ERROR_FAILED_SERVICE_CONTROLLER_CONNECT: + win32serviceutil.usage() + else: + win32serviceutil.HandleCommandLine(k) + +elif cmdline_style == "custom": + assert len(service_module_names) == 1, "Can only handle 1 service!" + # Unlike services implemented in .py files, when a py2exe service exe is + # executed without args, it may mean the service is being started. + if len(sys.argv) == 1: + try: + servicemanager.StartServiceCtrlDispatcher() + except win32service.error as details: + if details[0] == winerror.ERROR_FAILED_SERVICE_CONTROLLER_CONNECT: + win32serviceutil.usage() + else: + # assume/insist that the module provides a HandleCommandLine function. + mod = sys.modules[service_module_names[0]] + mod.HandleCommandLine() Added: trunk/py2exe-3/py2exe/build_exe.py =================================================================== --- trunk/py2exe-3/py2exe/build_exe.py (rev 0) +++ trunk/py2exe-3/py2exe/build_exe.py 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,145 @@ +#!/usr/bin/python3.3 +# -*- coding: utf-8 -*- +import argparse +import logging +import os +import textwrap +from . import runtime + +def main(): + parser = argparse.ArgumentParser(description="Build runtime archive for a script", + formatter_class=argparse.RawTextHelpFormatter) + + # what to include, what to exclude... + parser.add_argument("-i", "--include", + help="module to include", + dest="includes", + metavar="modname", + action="append" + ) + parser.add_argument("-x", "--exclude", + help="module to exclude", + dest="excludes", + metavar="modname", + action="append") + parser.add_argument("-p", "--package", + help="module to exclude", + dest="packages", + metavar="package_name", + action="append") + + # how to compile the code... + parser.add_argument("-O", "--optimize", + help="use optimized bytecode", + dest="optimize", + action="count") + + # reporting options... + parser.add_argument("-s", "--summary", + help="""print a single line listing how many modules were + found and how many modules are missing""", + dest="summary", + action="store_true") + parser.add_argument("-r", "--report", + help="""print a detailed report listing all found modules, + the missing modules, and which module imported them.""", + dest="report", + action="store_true") + parser.add_argument("-f", "--from", + help="""print where the module <modname> is imported.""", + metavar="modname", + dest="show_from", + action="append") + + parser.add_argument("-v", + dest="verbose", + action="store_true") + + parser.add_argument("-c", "--compress", + dest="compress", + action="store_true") + + # what to build + parser.add_argument("-d", "--dest", +## required=True, + default="dist", + help="""destination directory""", + dest="destdir") + + parser.add_argument("-l", "--library", + help="""relative pathname of the python archive""", + dest="libname") + + parser.add_argument("-b", "--bundle-files", + help=textwrap.dedent("""\ + How to bundle the files: + 3 - create script.exe, python.dll, extensions.pyd, others.dll. + 2 - create script.exe, python.dll, others.dll. + 1 - create script.exe, others.dll. + 0 - create script.exe. + """), + choices=[0, 1, 2, 3], + type=int, + default=3) + + parser.add_argument("-W", "--write-setup-script", + help=textwrap.dedent("""\ + Do not build the executables; instead write a setup script that allows + further customizations of the build process. + """), + metavar="setup_path", + dest="setup_path") + + # exe files to build... + parser.add_argument("script", + metavar="script", + nargs="*", + ) + + parser.add_argument("-svc", "--service", + help="""Build a service""", + metavar="service", + action="append", + ) + + + options = parser.parse_args() + if not options.service and not options.script: + parser.error("nothing to build") + + options.service = runtime.fixup_targets(options.service, "modules") + for target in options.service: + target.exe_type = "service" + + options.script = runtime.fixup_targets(options.script, "script") + for target in options.script: + if target.script.endswith(".pyw"): + target.exe_type = "windows_exe" + else: + target.exe_type = "console_exe" + + if options.setup_path: + if os.path.isfile(options.setup_path): + message = "File %r already exists, are you sure you want to overwrite it? [yN]: " + answer = input(message % options.setup_path) + if answer not in "yY": + print("Canceled.") + return + from .setup_template import write_setup + write_setup(options) + # no further action + return + + options.data_files = None + options.com_servers = [] + options.unbuffered = False + + level = logging.INFO if options.verbose else logging.WARNING + logging.basicConfig(level=level) + + builder = runtime.Runtime(options) + builder.analyze() + builder.build() + +if __name__ == "__main__": + main() Added: trunk/py2exe-3/py2exe/distutils_buildexe.py =================================================================== --- trunk/py2exe-3/py2exe/distutils_buildexe.py (rev 0) +++ trunk/py2exe-3/py2exe/distutils_buildexe.py 2014-05-08 18:40:18 UTC (rev 740) @@ -0,0 +1,1742 @@ +import sys +import warnings + +from distutils.core import Command + +## from distutils.spawn import spawn +## from distutils.errors import * +## import sys, os, imp, types, stat +## import marshal +## import zipfile +## try: +## set +## except NameError: +## from sets import Set as set +## import tempfile +## import struct +## import re +## import fnmatch + +## is_win64 = struct.calcsize("P") == 8 + +## def _is_debug_build(): +## for ext, _, _ in imp.get_suffixes(): +## if ext == "_d.pyd": +## return True +## return False + +## is_debug_build = _is_debug_build() + +## if is_debug_build: +## python_dll = "python%d%d_d.dll" % sys.version_info[:2] +## else: +## python_dll = "python%d%d.dll" % sys.version_info[:2] + +## # resource constants +## RT_BITMAP=2 +## RT_MANIFEST=24 + +## # Pattern for modifying the 'requestedExecutionLevel' in the manifest. Groups +## # are setup so all text *except* for the values is matched. +## pat_manifest_uac = re.compile(r'(^.*<requestedExecutionLevel level=")([^"])*(" uiAccess=")([^"])*(".*$)') + +## # note: we cannot use the list from imp.get_suffixes() because we want +## # .pyc and .pyo, independent of the optimize flag. +## _py_suffixes = ['.py', '.pyo', '.pyc', '.pyw'] +## _c_suffixes = [_triple[0] for _triple in imp.get_suffixes() +## if _triple[2] == imp.C_EXTENSION] + +## def imp_find_module(name): +## # same as imp.find_module, but handles dotted names +## names = name.split('.') +## path = None +## for name in names: +## result = imp.find_module(name, path) +## path = [result[1]] +## return result + +def fancy_split(str, sep=","): + # a split which also strips whitespace from the items + # passing a list or tuple will return it unchanged + if str is None: + return [] + if hasattr(str, "split"): + return [item.strip() for item in str.split(sep)] + return str + +## def ensure_unicode(text): +## if isinstance(text, unicode): +## return text +## return text.decode("mbcs") + +## # This loader locates extension modules relative to the library.zip +## # file when an archive is used (i.e., skip_archive is not used), otherwise +## # it locates extension modules relative to sys.prefix. +## LOADER = """ +## def __load(): +## import imp, os, sys +## try: +## dirname = os.path.dirname(__loader__.archive) +## except NameError: +## dirname = sys.prefix +## path = os.path.join(dirname, '%s') +## #print "py2exe extension module", __name__, "->", path +## mod = imp.load_dynamic(__name__, path) +## ## mod.frozen = 1 +## __load() +## del __load +## """ + + +from . import runtime + + +class py2exe(Command): + description = "" + # List of option tuples: long name, short name (None if no short + # name), and help string. + user_options = [ + ('optimize=', 'O', + "optimization level: -O1 for \"python -O\", " + "-O2 for \"python -OO\", and -O0 to disable [default: -O0]"), + ('dist-dir=', 'd', + "directory to put final built distributions in (default is dist)"), + + ("excludes=", 'e', + "comma-separated list of modules to exclude"), + ("dll-excludes=", None, + "comma-separated list of DLLs to exclude"), + ("ignores=", None, + "comma-separated list of modules to ignore if they are not found"), + ("includes=", 'i', + "comma-separated list of modules to include"), + ("packages=", 'p', + "comma-separated list of packages to include"), + + ("compressed", 'c', + "create a compressed zipfile"), + + ("xref", 'x', + "create and show a module cross reference"), + + ("bundle-files=", 'b', + "bundle dlls in the zipfile or the exe. Valid levels are 1, 2, or 3 (default)"), + + ("skip-archive", None, + "do not place Python bytecode files in an archive, put them directly in the file system"), + + ("ascii", 'a', + "do not automatically include encodings and codecs"), + + ('custom-boot-script=', None, + "Python file that will be run when setting up the runtime environment"), + ] + + boolean_options = ["compressed", "xref", "ascii", "skip-archive"] + + def initialize_options (self): + self.xref =0 + self.compressed = 0 + self.unbuffered = 0 + self.optimize = 0 + self.includes = None + self.excludes = None + self.ignores = None + self.packages = None + self.dist_dir = None + self.dll_excludes = None + self.typelibs = None + self.bundle_files = 3 + self.skip_archive = 0 + self.ascii = 0 + self.custom_boot_script = None + + def finalize_options (self): + self.optimize = int(self.optimize) + self.excludes = fancy_split(self.excludes) + self.includes = fancy_split(self.includes) + self.ignores = fancy_split(self.ignores) + self.bundle_files = int(self.bundle_files) + if self.bundle_files < 1 or self.bundle_files > 3: + raise ValueError("bundle-files must be 1, 2, or 3, not %s" + % self.bundle_files) + if self.ascii: + warnings.warn("The 'ascii' option is no longer supported, ignored.") + if self.s... [truncated message content] |