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)
Exemple #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)
#
# 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)
Exemple #4
0
"""macgen_info - Generate PYC resource file only"""
Exemple #5
0
"""Findmodulefiles - Find out where modules are loaded from.
Exemple #6
0
"""macgen_info - Generate PYC resource file only"""
Exemple #7
0
#
Exemple #8
0
#
Exemple #9
0
"""Findmodulefiles - Find out where modules are loaded from.
Exemple #10
0
#