Пример #1
0
def addpythonmodules(module_dict):
    # XXX should really use macgen_rsrc.generate(), this does the same, but skips __main__
    items = module_dict.items()
    items.sort()
    for name, module in items:
        mtype = module.gettype()
        if mtype not in ['module', 'package'] or name == "__main__":
            continue
        location = module.__file__

        if location[-4:] == '.pyc':
            # Attempt corresponding .py
            location = location[:-1]
        if location[-3:] != '.py':
            print '*** skipping', location
            continue

        print 'Adding module "%s"' % name
        id, name = py_resource.frompyfile(location, name, preload=0,
                        ispackage=mtype=='package')
Пример #2
0
def generate(output, module_dict, debug=0, preload=1):
    fsid = py_resource.create(output)

    for name, module in module_dict.items():
        mtype = module.gettype()
        if mtype not in ['module', 'package']:
            continue
        location = module.__file__

        if location[-4:] == '.pyc':
            # Attempt corresponding .py
            location = location[:-1]
        if location[-3:] != '.py':
            print '*** skipping', location
            continue

        id, name = py_resource.frompyfile(location, name, preload=preload,
                        ispackage=mtype=='package')
        if debug > 0:
            print 'PYC resource %5d\t%s\t%s'%(id, name, location)

    Res.CloseResFile(fsid)
Пример #3
0
def addpythonmodules(module_dict):
    # XXX should really use macgen_rsrc.generate(), this does the same, but skips __main__
    items = module_dict.items()
    items.sort()
    for name, module in items:
        mtype = module.gettype()
        if mtype not in ['module', 'package'] or name == "__main__":
            continue
        location = module.__file__

        if location[-4:] == '.pyc':
            # Attempt corresponding .py
            location = location[:-1]
        if location[-3:] != '.py':
            print '*** skipping', location
            continue

        print 'Adding module "%s"' % name
        id, name = py_resource.frompyfile(location,
                                          name,
                                          preload=0,
                                          ispackage=mtype == 'package')
Пример #4
0
def generate(output, module_dict, debug=0, preload=1):
    fsid = py_resource.create(output)

    for name, module in module_dict.items():
        mtype = module.gettype()
        if mtype not in ['module', 'package']:
            continue
        location = module.__file__

        if location[-4:] == '.pyc':
            # Attempt corresponding .py
            location = location[:-1]
        if location[-3:] != '.py':
            print '*** skipping', location
            continue

        id, name = py_resource.frompyfile(location,
                                          name,
                                          preload=preload,
                                          ispackage=mtype == 'package')
        if debug > 0:
            print 'PYC resource %5d\t%s\t%s' % (id, name, location)

    Res.CloseResFile(fsid)
Пример #5
0
"""macgen_info - Generate PYC resource file only"""
Пример #6
0
"""BuildCGIApplet.py -- Create a CGI applet from a Python script.
Пример #7
0
"""macgen_bin - Generate application from shared libraries"""
Пример #8
0
"""Findmodulefiles - Find out where modules are loaded from.
Пример #9
0
"""macgen_info - Generate PYC resource file only"""
Пример #10
0
"""macgen_bin - Generate application from shared libraries"""
Пример #11
0
ide_home = os.path.join(sys.exec_prefix, ":Mac:Tools:IDE")

mainfilename = os.path.join(ide_home, "PythonIDE.py")
dstfilename = os.path.join(sys.exec_prefix, "Python IDE")

buildtools.process(template, mainfilename, dstfilename, 1)

targetref = Res.FSpOpenResFile(dstfilename, 3)
Res.UseResFile(targetref)

files = os.listdir(ide_home)

# skip this script and the main program
files = filter(
    lambda x: x[-3:] == '.py' and x not in ("BuildIDE.py", "PythonIDE.py"),
    files)

# add the modules as PYC resources
for name in files:
    print "adding", name
    fullpath = os.path.join(ide_home, name)
    id, name = py_resource.frompyfile(fullpath,
                                      name[:-3],
                                      preload=1,
                                      ispackage=0)

# add W resources
wresref = Res.FSpOpenResFile(os.path.join(ide_home, "Widgets.rsrc"), 1)
buildtools.copyres(wresref, targetref, [], 0)
Пример #12
0
#
Пример #13
0
"""BuildCGIApplet.py -- Create a CGI applet from a Python script.
Пример #14
0
buildtools.DEBUG=1

template = buildtools.findtemplate()

ide_home = os.path.join(sys.exec_prefix, ":Mac:Tools:IDE")

mainfilename = os.path.join(ide_home, "PythonIDE.py")
dstfilename = os.path.join(sys.exec_prefix, "Python IDE")

buildtools.process(template, mainfilename, dstfilename, 1)

targetref = Res.FSpOpenResFile(dstfilename, 3)
Res.UseResFile(targetref)

files = os.listdir(ide_home)

# skip this script and the main program
files = filter(lambda x: x[-3:] == '.py' and
                x not in ("BuildIDE.py", "PythonIDE.py"), files)

# add the modules as PYC resources
for name in files:
    print "adding", name
    fullpath = os.path.join(ide_home, name)
    id, name = py_resource.frompyfile(fullpath, name[:-3], preload=1,
            ispackage=0)

# add W resources
wresref = Res.FSpOpenResFile(os.path.join(ide_home, "Widgets.rsrc"), 1)
buildtools.copyres(wresref, targetref, [], 0)
Пример #15
0
"""Findmodulefiles - Find out where modules are loaded from.