示例#1
0
 def get_metapackage_info(self):
     return dict(
         IFRequirementDicts=[plists.python_requirement(self.get_name())],
         IFPkgFlagComponentDirectory=tools.unicode_path(
             self.component_directory
         ),
     )
示例#2
0
 def get_metapackage_info(self):
     return dict(
         IFRequirementDicts=[plists.python_requirement(self.get_name())],
         IFPkgFlagComponentDirectory=tools.unicode_path(
             self.component_directory
         ),
     )
示例#3
0
文件: pkg.py 项目: rougier/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)
示例#4
0
 def get_scheme_description(self, scheme):
     description = self.scheme_descriptions.get(scheme)
     if description is None:
         return None
     files, common, prefix = self.get_scheme_root(scheme)
     if prefix is not None:
         description += u'\nInstalled to: ' + tools.unicode_path(prefix)
     return description
示例#5
0
 def get_scheme_description(self, scheme):
     description = self.scheme_descriptions.get(scheme)
     if description is None:
         return None
     files, common, prefix = self.get_scheme_root(scheme)
     if prefix is not None:
         description += u'\nInstalled to: ' + tools.unicode_path(prefix)
     return description
示例#6
0
def path_requirement(SpecArgument, Level='requires', **kw):
    return dict(Level=Level,
                SpecType='file',
                SpecArgument=tools.unicode_path(SpecArgument),
                SpecProperty='NSFileType',
                TestOperator='eq',
                TestObject='NSFileTypeDirectory',
                **kw)
示例#7
0
文件: plists.py 项目: bitcraft/pyglet
def path_requirement(SpecArgument, Level='requires', **kw):
    return dict(
        Level=Level,
        SpecType='file',
        SpecArgument=tools.unicode_path(SpecArgument),
        SpecProperty='NSFileType',
        TestOperator='eq',
        TestObject='NSFileTypeDirectory',
        **kw
    )
示例#8
0
def path_requirement(SpecArgument, Level=u"requires", **kw):
    return dict(
        Level=Level,
        SpecType=u"file",
        SpecArgument=tools.unicode_path(SpecArgument),
        SpecProperty=u"NSFileType",
        TestOperator=u"eq",
        TestObject=u"NSFileTypeDirectory",
        **kw
    )
示例#9
0
文件: plists.py 项目: bitcraft/pyglet
def python_requirement(pkgname, prefix=None, version=None, **kw):
    if prefix is None:
        prefix = sys.prefix
    if version is None:
        version = sys.version[:3]
    prefix = os.path.realpath(prefix)
    fmwkprefix = os.path.dirname(os.path.dirname(prefix))
    is_framework = fmwkprefix.endswith('.framework')
    if is_framework:
        dprefix = os.path.dirname(fmwkprefix)
    else:
        dprefix = prefix
    dprefix = tools.unicode_path(dprefix)
    name = '%s Python %s' % (FRIENDLY_PREFIX.get(dprefix, dprefix), version)
    kw.setdefault('LabelKey', name)
    title = '%s requires %s to install.' % (pkgname, name,)
    kw.setdefault('TitleKey', title)
    kw.setdefault('MessageKey', title)
    return path_requirement(prefix, **kw)
示例#10
0
def python_requirement(pkgname, prefix=None, version=None, **kw):
    if prefix is None:
        prefix = sys.prefix
    if version is None:
        version = sys.version[:3]
    prefix = os.path.realpath(prefix)
    fmwkprefix = os.path.dirname(os.path.dirname(prefix))
    is_framework = fmwkprefix.endswith('.framework')
    if is_framework:
        dprefix = os.path.dirname(fmwkprefix)
    else:
        dprefix = prefix
    dprefix = tools.unicode_path(dprefix)
    name = '%s Python %s' % (FRIENDLY_PREFIX.get(dprefix, dprefix), version)
    kw.setdefault('LabelKey', name)
    title = '%s requires %s to install.' % (
        pkgname,
        name,
    )
    kw.setdefault('TitleKey', title)
    kw.setdefault('MessageKey', title)
    return path_requirement(prefix, **kw)
示例#11
0
文件: pkg.py 项目: 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)