Todo: 集成多平台 解决因SaiNiu线程抢占资源问题 本地提交测试环境打包 和 正式打包脚本与正式环境打包bat 提交Python32环境包 改进多日志文件生成情况修改打包日志细节
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
Custom modifications of 3rd party libraries
|
||||
===========================================
|
||||
|
||||
NOTE: PyInstaller does not extend PYTHONPATH (sys.path) with this directory
|
||||
that contains bundled 3rd party libraries.
|
||||
|
||||
Some users complained that PyInstaller failed because their apps were using
|
||||
too old versions of some libraries that PyInstaller uses too and that's why
|
||||
extending sys.path was dropped.
|
||||
|
||||
All libraries are tweaked to be importable as::
|
||||
|
||||
from PyInstaller.lib.LIB_NAME import xyz
|
||||
|
||||
In libraries replace imports like::
|
||||
|
||||
from altgraph import y
|
||||
from modulegraph import z
|
||||
|
||||
with relative prefix::
|
||||
|
||||
from ..altgraph import y
|
||||
from ..modulegraph import z
|
||||
|
||||
|
||||
altgraph
|
||||
----------
|
||||
|
||||
- add fixed version string to ./altgraph/__init__.py::
|
||||
|
||||
# For PyInstaller/lib/ define the version here, since there is no
|
||||
# package-resource.
|
||||
__version__ = '0.13'
|
||||
|
||||
|
||||
modulegraph
|
||||
-----------
|
||||
|
||||
https://bitbucket.org/ronaldoussoren/modulegraph/downloads
|
||||
|
||||
- TODO Use official modulegraph version when following issue is resolved and pull request merged
|
||||
https://bitbucket.org/ronaldoussoren/modulegraph/issues/28/__main__-module-being-analyzed-for-wheel
|
||||
|
||||
- add fixed version string to ./modulegraph/__init__.py::
|
||||
|
||||
# For PyInstaller/lib/ define the version here, since there is no
|
||||
# package-resource.
|
||||
__version__ = '0.13'
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#
|
||||
@@ -0,0 +1 @@
|
||||
__version__ = '0.17'
|
||||
@@ -0,0 +1,89 @@
|
||||
import sys
|
||||
import os
|
||||
import argparse
|
||||
from .modulegraph import ModuleGraph
|
||||
|
||||
|
||||
def parse_arguments():
|
||||
parser = argparse.ArgumentParser(
|
||||
conflict_handler='resolve', prog='%s -mmodulegraph' % (
|
||||
os.path.basename(sys.executable)))
|
||||
parser.add_argument(
|
||||
'-d', action='count', dest='debug', default=1,
|
||||
help='Increase debug level')
|
||||
parser.add_argument(
|
||||
'-q', action='store_const', dest='debug', const=0,
|
||||
help='Clear debug level')
|
||||
parser.add_argument(
|
||||
'-m', '--modules', action='store_true',
|
||||
dest='domods', default=False,
|
||||
help='arguments are module names, not script files')
|
||||
parser.add_argument(
|
||||
'-x', metavar='NAME', action='append', dest='excludes',
|
||||
default=[], help='Add NAME to the excludes list')
|
||||
parser.add_argument(
|
||||
'-p', action='append', metavar='PATH', dest='addpath', default=[],
|
||||
help='Add PATH to the module search path')
|
||||
parser.add_argument(
|
||||
'-g', '--dot', action='store_const', dest='output', const='dot',
|
||||
help='Output a .dot graph')
|
||||
parser.add_argument(
|
||||
'-h', '--html', action='store_const',
|
||||
dest='output', const='html', help='Output a HTML file')
|
||||
parser.add_argument(
|
||||
'scripts', metavar='SCRIPT', nargs='+', help='scripts to analyse')
|
||||
|
||||
opts = parser.parse_args()
|
||||
return opts
|
||||
|
||||
|
||||
def create_graph(scripts, domods, debuglevel, excludes, path_extras):
|
||||
# Set the path based on sys.path and the script directory
|
||||
path = sys.path[:]
|
||||
|
||||
if domods:
|
||||
del path[0]
|
||||
else:
|
||||
path[0] = os.path.dirname(scripts[0])
|
||||
|
||||
path = path_extras + path
|
||||
if debuglevel > 1:
|
||||
print("path:", file=sys.stderr)
|
||||
for item in path:
|
||||
print(" ", repr(item), file=sys.stderr)
|
||||
|
||||
# Create the module finder and turn its crank
|
||||
mf = ModuleGraph(path, excludes=excludes, debug=debuglevel)
|
||||
for arg in scripts:
|
||||
if domods:
|
||||
if arg[-2:] == '.*':
|
||||
mf.import_hook(arg[:-2], None, ["*"])
|
||||
else:
|
||||
mf.import_hook(arg)
|
||||
else:
|
||||
mf.add_script(arg)
|
||||
return mf
|
||||
|
||||
|
||||
def output_graph(output_format, mf):
|
||||
if output_format == 'dot':
|
||||
mf.graphreport()
|
||||
elif output_format == 'html':
|
||||
mf.create_xref()
|
||||
else:
|
||||
mf.report()
|
||||
|
||||
|
||||
def main():
|
||||
opts = parse_arguments()
|
||||
mf = create_graph(
|
||||
opts.scripts, opts.domods, opts.debug,
|
||||
opts.excludes, opts.addpath)
|
||||
output_graph(opts.output, mf)
|
||||
|
||||
|
||||
if __name__ == '__main__': # pragma: no cover
|
||||
try:
|
||||
main()
|
||||
except KeyboardInterrupt:
|
||||
print("\n[interrupt]")
|
||||
@@ -0,0 +1,61 @@
|
||||
"""
|
||||
modulegraph.find_modules - High-level module dependency finding interface
|
||||
=========================================================================
|
||||
|
||||
History
|
||||
........
|
||||
|
||||
Originally (loosely) based on code in py2exe's build_exe.py by Thomas Heller.
|
||||
"""
|
||||
import os
|
||||
import pkgutil
|
||||
|
||||
from .modulegraph import Alias
|
||||
|
||||
def get_implies():
|
||||
def _xml_etree_modules():
|
||||
import xml.etree
|
||||
return [
|
||||
f"xml.etree.{module_name}"
|
||||
for _, module_name, is_package in pkgutil.iter_modules(xml.etree.__path__)
|
||||
if not is_package
|
||||
]
|
||||
|
||||
result = {
|
||||
# imports done from C code in built-in and/or extension modules
|
||||
# (untrackable by modulegraph).
|
||||
"_curses": ["curses"],
|
||||
"posix": ["resource"],
|
||||
"gc": ["time"],
|
||||
"time": ["_strptime"],
|
||||
"datetime": ["time"],
|
||||
"parser": ["copyreg"],
|
||||
"codecs": ["encodings"],
|
||||
"_sre": ["copy", "re"],
|
||||
"zipimport": ["zlib"],
|
||||
|
||||
# _frozen_importlib is part of the interpreter itself
|
||||
"_frozen_importlib": None,
|
||||
|
||||
# os.path is an alias for a platform specific module,
|
||||
# ensure that the graph shows this.
|
||||
"os.path": Alias(os.path.__name__),
|
||||
|
||||
# Python >= 3.2:
|
||||
"_datetime": ["time", "_strptime"],
|
||||
"_json": ["json.decoder"],
|
||||
"_pickle": ["codecs", "copyreg", "_compat_pickle"],
|
||||
"_posixsubprocess": ["gc"],
|
||||
"_ssl": ["socket"],
|
||||
|
||||
# Python >= 3.3:
|
||||
"_elementtree": ["pyexpat"] + _xml_etree_modules(),
|
||||
|
||||
# This is not C extension, but it uses __import__
|
||||
"anydbm": ["dbhash", "gdbm", "dbm", "dumbdbm", "whichdb"],
|
||||
|
||||
# Known package aliases
|
||||
"wxPython.wx": Alias('wx'),
|
||||
}
|
||||
|
||||
return result
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
import dis
|
||||
import inspect
|
||||
|
||||
|
||||
def iterate_instructions(code_object):
|
||||
"""Delivers the byte-code instructions as a continuous stream.
|
||||
|
||||
Yields `dis.Instruction`. After each code-block (`co_code`), `None` is
|
||||
yielded to mark the end of the block and to interrupt the steam.
|
||||
"""
|
||||
# The arg extension the EXTENDED_ARG opcode represents is automatically handled by get_instructions() but the
|
||||
# instruction is left in. Get rid of it to make subsequent parsing easier/safer.
|
||||
yield from (i for i in dis.get_instructions(code_object) if i.opname != "EXTENDED_ARG")
|
||||
|
||||
yield None
|
||||
|
||||
# For each constant in this code object that is itself a code object,
|
||||
# parse this constant in the same manner.
|
||||
for constant in code_object.co_consts:
|
||||
if inspect.iscode(constant):
|
||||
yield from iterate_instructions(constant)
|
||||
Reference in New Issue
Block a user