Example #1
0
def make_package(cmd, name, version, files, common, prefix, pkgdir, info=(), description=None):
    license = cmd.license
    readme = cmd.readme
    welcome = cmd.welcome
    background = cmd.background
    template = cmd.template
    dry_run = cmd.dry_run
    dist = cmd.distribution
    copy_tree = cmd.copy_tree
    copy_file = cmd.copy_file
    mkpath = cmd.mkpath

    if description is None:
        description = dist.get_description()

    mkpath(os.path.join(pkgdir, "Contents", "Resources"))
    if not dry_run:
        write_pkginfo(pkgdir)

    tools.mkbom(common, pkgdir)
    count = len(files)
    admin = True  # tools.admin_writable(prefix)
    size = tools.reduce_size(files)
    compressed = tools.pax(common, pkgdir)
    if not dry_run:
        write_sizes(count, size, compressed, pkgdir)

    if admin:
        auth = "AdminAuthorization"
    else:
        auth = "RootAuthorization"

    ninfo = plists.pkg_info(name, version)
    ninfo.update(dict(IFPkgFlagAuthorizationAction=auth, IFPkgFlagDefaultLocation=tools.unicode_path(prefix)))
    ninfo.update(dict(info))
    if not dry_run:
        plists.write(ninfo, os.path.join(pkgdir, "Contents", "Info.plist"))

    desc = plists.common_description(name, version)
    if description is not None:
        desc["IFPkgDescriptionDescription"] = description
    if not dry_run:
        plists.write(desc, os.path.join(pkgdir, "Contents", "Resources", "Description.plist"))

    template_dest = os.path.join(pkgdir, "Contents", "Resources")
    if not os.path.exists(template) and template in InstallationCheck:
        write_template(InstallationCheck[template], template_dest, mkpath=mkpath)
    else:
        copy_tree(template, template_dest)

    def doc(path, name, exts=TEXT_EXTS):
        copy_doc(
            path, name, pkgdir, exts=exts, dry_run=dry_run, mkpath=mkpath, copy_tree=copy_tree, copy_file=copy_file
        )

    doc(readme, "ReadMe")
    doc(license, "License")
    doc(welcome, "Welcome")
    doc(background, "background", exts=IMAGE_EXTS)
Example #2
0
def make_metapackage(cmd, name, version, packages, pkgdir,
        info=(), description=None):
    license = cmd.license
    readme = cmd.readme
    welcome = cmd.welcome
    background = cmd.background
    template = cmd.template
    dry_run = cmd.dry_run
    dist = cmd.distribution
    copy_tree = cmd.copy_tree
    copy_file = cmd.copy_file
    mkpath = cmd.mkpath

    if description is None:
        description = dist.get_description()
    if not description:
        description = u'%s %s' % (name, version)

    mkpath(os.path.join(pkgdir, 'Contents', 'Resources'))
    if not dry_run:
        write_pkginfo(pkgdir)

    ninfo = plists.mpkg_info(name, version, packages)
    ninfo.update(dict(info))
    if not dry_run:
        plists.write(ninfo, os.path.join(pkgdir, 'Contents', 'Info.plist'))

    desc = plists.common_description(name+' '+version, version)
    if description:
        desc['IFPkgDescriptionDescription'] = description
    if not dry_run:
        plists.write(
            desc,
            os.path.join(pkgdir, 'Contents', 'Resources', 'Description.plist')
        )

    template_dest = os.path.join(pkgdir, 'Contents', 'Resources')
    if not os.path.exists(template) and template in InstallationCheck:
        write_template(InstallationCheck[template], template_dest,
            mkpath=mkpath)
    else:
        copy_tree(template, template_dest)

    if readme is None:
        readme_text = dist.get_long_description()
        if readme_text:
            readme = StringIO(readme_text)

    def doc(path, name, exts=TEXT_EXTS):
        copy_doc(path, name, pkgdir, exts=exts, dry_run=dry_run,
            mkpath=mkpath, copy_tree=copy_tree, copy_file=copy_file,
        )

    doc(readme, 'ReadMe')
    doc(license, 'License')
    doc(welcome, 'Welcome')
    doc(background, 'background', exts=IMAGE_EXTS)
Example #3
0
File: pkg.py Project: pyzh/pyglet
def make_metapackage(cmd,
                     name,
                     version,
                     packages,
                     pkgdir,
                     info=(),
                     description=None):
    license = cmd.license
    readme = cmd.readme
    welcome = cmd.welcome
    background = cmd.background
    template = cmd.template
    dry_run = cmd.dry_run
    dist = cmd.distribution
    copy_tree = cmd.copy_tree
    copy_file = cmd.copy_file
    mkpath = cmd.mkpath

    if description is None:
        description = dist.get_description()
    if not description:
        description = '%s %s' % (name, version)

    mkpath(os.path.join(pkgdir, 'Contents', 'Resources'))
    if not dry_run:
        write_pkginfo(pkgdir)

    ninfo = plists.mpkg_info(name, version, packages)
    ninfo.update(dict(info))
    if not dry_run:
        plists.write(ninfo, os.path.join(pkgdir, 'Contents', 'Info.plist'))

    desc = plists.common_description(name + ' ' + version, version)
    if description:
        desc['IFPkgDescriptionDescription'] = description
    if not dry_run:
        plists.write(
            desc,
            os.path.join(pkgdir, 'Contents', 'Resources', 'Description.plist'))

    template_dest = os.path.join(pkgdir, 'Contents', 'Resources')
    if not os.path.exists(template) and template in InstallationCheck:
        write_template(InstallationCheck[template],
                       template_dest,
                       mkpath=mkpath)
    else:
        copy_tree(template, template_dest)

    if readme is None:
        readme_text = dist.get_long_description()
        if readme_text:
            readme = StringIO(readme_text)

    def doc(path, name, exts=TEXT_EXTS):
        copy_doc(
            path,
            name,
            pkgdir,
            exts=exts,
            dry_run=dry_run,
            mkpath=mkpath,
            copy_tree=copy_tree,
            copy_file=copy_file,
        )

    doc(readme, 'ReadMe')
    doc(license, 'License')
    doc(welcome, 'Welcome')
    doc(background, 'background', exts=IMAGE_EXTS)
Example #4
0
File: pkg.py Project: pyzh/pyglet
def make_package(cmd,
                 name,
                 version,
                 files,
                 common,
                 prefix,
                 pkgdir,
                 info=(),
                 description=None):
    license = cmd.license
    readme = cmd.readme
    welcome = cmd.welcome
    background = cmd.background
    template = cmd.template
    dry_run = cmd.dry_run
    dist = cmd.distribution
    copy_tree = cmd.copy_tree
    copy_file = cmd.copy_file
    mkpath = cmd.mkpath

    if description is None:
        description = dist.get_description()

    mkpath(os.path.join(pkgdir, 'Contents', 'Resources'))
    if not dry_run:
        write_pkginfo(pkgdir)

    tools.mkbom(common, pkgdir)
    count = len(files)
    admin = True  # tools.admin_writable(prefix)
    size = tools.reduce_size(files)
    compressed = tools.pax(common, pkgdir)
    if not dry_run:
        write_sizes(count, size, compressed, pkgdir)

    if admin:
        auth = 'AdminAuthorization'
    else:
        auth = 'RootAuthorization'

    ninfo = plists.pkg_info(name, version)
    ninfo.update(
        dict(
            IFPkgFlagAuthorizationAction=auth,
            IFPkgFlagDefaultLocation=tools.unicode_path(prefix),
        ))
    ninfo.update(dict(info))
    if not dry_run:
        plists.write(ninfo, os.path.join(pkgdir, 'Contents', 'Info.plist'))

    desc = plists.common_description(name, version)
    if description is not None:
        desc['IFPkgDescriptionDescription'] = description
    if not dry_run:
        plists.write(
            desc,
            os.path.join(pkgdir, 'Contents', 'Resources', 'Description.plist'))

    template_dest = os.path.join(pkgdir, 'Contents', 'Resources')
    if not os.path.exists(template) and template in InstallationCheck:
        write_template(InstallationCheck[template],
                       template_dest,
                       mkpath=mkpath)
    else:
        copy_tree(template, template_dest)

    def doc(path, name, exts=TEXT_EXTS):
        copy_doc(
            path,
            name,
            pkgdir,
            exts=exts,
            dry_run=dry_run,
            mkpath=mkpath,
            copy_tree=copy_tree,
            copy_file=copy_file,
        )

    doc(readme, 'ReadMe')
    doc(license, 'License')
    doc(welcome, 'Welcome')
    doc(background, 'background', exts=IMAGE_EXTS)