Exemplo n.º 1
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)
Exemplo n.º 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)
Exemplo n.º 3
0
#
# Create attrdefs resource file
#
import os
import sys
import string
import macfs
from Carbon import Res
import py_resource

# For now:
progdir = os.path.split(sys.argv[0])[0]
CMIFDIR = os.path.split(progdir)[0]

ATTRDEFPATH = CMIFDIR + ':lib:Attrdefs.atc'

fp = open(ATTRDEFPATH, 'rb')
data = fp.read()
fp.close()

fss, ok = macfs.StandardPutFile('Attrdef resource output file:')
if not ok: sys.exit(0)

fsid = py_resource.create(fss.as_pathname(), creator='RSED')

py_resource.writemodule('Attrdefs', 512, data, 'CMat')

Res.CloseResFile(fsid)
print 'Wrote', ATTRDEFPATH, 'to', fss.as_pathname()
sys.exit(1)
Exemplo n.º 4
0
"""macgen_info - Generate PYC resource file only"""
Exemplo n.º 5
0
"""Findmodulefiles - Find out where modules are loaded from.
Exemplo n.º 6
0
"""macgen_info - Generate PYC resource file only"""
Exemplo n.º 7
0
#
Exemplo n.º 8
0
#
Exemplo n.º 9
0
"""Findmodulefiles - Find out where modules are loaded from.
Exemplo n.º 10
0
#