本文整理汇总了Python中pisi.package.Package.extract_dir_flat方法的典型用法代码示例。如果您正苦于以下问题:Python Package.extract_dir_flat方法的具体用法?Python Package.extract_dir_flat怎么用?Python Package.extract_dir_flat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pisi.package.Package
的用法示例。
在下文中一共展示了Package.extract_dir_flat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Install
# 需要导入模块: from pisi.package import Package [as 别名]
# 或者: from pisi.package.Package import extract_dir_flat [as 别名]
#.........这里部分代码省略.........
ctx.ui.info(_('Upgrading to new upstream version'))
upgrade = True
elif pkg.release > irelease:
ctx.ui.info(_('Upgrading to new distribution release'))
upgrade = True
elif ((not ignore_build) and ibuild and pkg.build
and pkg.build > ibuild):
ctx.ui.info(_('Upgrading to new distribution build'))
upgrade = True
self.upgrade = upgrade
# is this a downgrade? confirm this action.
if self.ask_reinstall and (not upgrade):
if pkg.version < iversion:
x = _('Downgrade to old upstream version?')
elif pkg.release < irelease:
x = _('Downgrade to old distribution release?')
else:
x = _('Downgrade to old distribution build?')
if not ctx.ui.confirm(x):
raise Error(_('Package downgrade declined'))
# schedule for reinstall
self.old_files = ctx.installdb.files(pkg.name)
self.old_path = ctx.installdb.pkg_dir(pkg.name, iversion, irelease)
self.reinstall = True
Remove(pkg.name).run_preremove()
def extract_install(self):
"unzip package in place"
ctx.ui.info(_('Extracting files'))
self.package.extract_dir_flat('install', ctx.config.dest_dir())
if self.reinstall:
# remove left over files
new = set(map(lambda x: str(x.path), self.files.list))
old = set(map(lambda x: str(x.path), self.old_files.list))
leftover = old - new
old_fileinfo = {}
for fileinfo in self.old_files.list:
old_fileinfo[str(fileinfo.path)] = fileinfo
for path in leftover:
Remove.remove_file( old_fileinfo[path] )
def store_pisi_files(self):
"""put files.xml, metadata.xml, actions.py and COMAR scripts
somewhere in the file system. We'll need these in future..."""
ctx.ui.info(_('Storing %s, ') % ctx.const.files_xml)
self.package.extract_file(ctx.const.files_xml, self.package.pkg_dir())
ctx.ui.info(_('Storing %s.') % ctx.const.metadata_xml)
self.package.extract_file(ctx.const.metadata_xml, self.package.pkg_dir())
for pcomar in self.metadata.package.providesComar:
fpath = os.path.join(ctx.const.comar_dir, pcomar.script)
# comar prefix is added to the pkg_dir while extracting comar
# script file. so we'll use pkg_dir as destination.
ctx.ui.info(_('Storing %s') % fpath)
self.package.extract_file(fpath, self.package.pkg_dir())
def register_comar_scripts(self):
"register COMAR scripts"
示例2: __init__
# 需要导入模块: from pisi.package import Package [as 别名]
# 或者: from pisi.package.Package import extract_dir_flat [as 别名]
#.........这里部分代码省略.........
# determine if same version
same_ver = False
ignore_build = ctx.config.options and ctx.config.options.ignore_build_no
if (not ibuild) or (not pkg.build) or ignore_build:
# we don't look at builds to compare two package versions
if pkg.version == iversion and pkg.release == irelease:
same_ver = True
else:
if pkg.build == ibuild:
same_ver = True
if same_ver:
if self.ask_reinstall:
if not ctx.ui.confirm('Re-install same version package?'):
raise InstallError('Package re-install declined')
else:
upgrade = False
# is this an upgrade?
# determine and report the kind of upgrade: version, release, build
if pkg.version > iversion:
ctx.ui.info('Upgrading to new upstream version')
upgrade = True
elif pkg.release > irelease:
ctx.ui.info('Upgrading to new distribution release')
upgrade = True
elif ((not ignore_build) and ibuild and pkg.build
and pkg.build > ibuild):
ctx.ui.info('Upgrading to new distribution build')
upgrade = True
# is this a downgrade? confirm this action.
if self.ask_reinstall and (not upgrade):
if pkg.version < iversion:
x = 'Downgrade to old upstream version?'
elif pkg.release < irelease:
x = 'Downgrade to old distribution release?'
else:
x = 'Downgrade to old distribution build?'
if not ctx.ui.confirm(x):
raise InstallError('Package downgrade declined')
# remove old package then
operations.remove_single(pkg.name)
def extract_install(self):
"unzip package in place"
ctx.ui.info('Extracting files,')
self.package.extract_dir_flat('install', ctx.config.destdir)
def store_pisi_files(self):
"""put files.xml, metadata.xml, actions.py and COMAR scripts
somewhere in the file system. We'll need these in future..."""
ctx.ui.info('Storing %s, ' % ctx.const.files_xml)
self.package.extract_file(ctx.const.files_xml, self.package.pkg_dir())
ctx.ui.info('%s.' % ctx.const.metadata_xml)
self.package.extract_file(ctx.const.metadata_xml, self.package.pkg_dir())
for pcomar in self.metadata.package.providesComar:
fpath = os.path.join(ctx.const.comar_dir, pcomar.script)
# comar prefix is added to the pkg_dir while extracting comar
# script file. so we'll use pkg_dir as destination.
ctx.ui.info('Storing %s' % fpath)
self.package.extract_file(fpath, self.package.pkg_dir())
def register_comar_scripts(self):
"register COMAR scripts"
com = ctx.comard
for pcomar in self.metadata.package.providesComar:
scriptPath = os.path.join(self.package.comar_dir(),pcomar.script)
ctx.ui.info("Registering COMAR script %s" % pcomar.script)
com.register(pcomar.om,
self.metadata.package.name,
scriptPath)
while 1:
reply = com.read_cmd()
if reply[0] == com.RESULT:
break
elif reply[1] == com.ERROR:
raise InstallError, "COMAR.register failed!"
def update_databases(self):
"update databases"
# installdb
ctx.installdb.install(self.metadata.package.name,
self.metadata.package.version,
self.metadata.package.release,
self.metadata.package.build,
self.metadata.package.distribution)
# installed packages
packagedb.inst_packagedb.add_package(self.pkginfo)
示例3: len
# 需要导入模块: from pisi.package import Package [as 别名]
# 或者: from pisi.package.Package import extract_dir_flat [as 别名]
import pisi.util as util
from pisi.package import Package
locale.setlocale(locale.LC_ALL, '')
options = pisi.config.Options()
if len(sys.argv) > 2:
options.destdir=sys.argv[2]
else:
options.destdir = '/'
pisi.api.init(database=True, comar=False, options=options)
filename = sys.argv[1]
package = Package(filename)
package.read()
util.clean_dir('/tmp/install')
package.extract_dir_flat('install', '/tmp/install')
deps = set()
needed = set()
for file in package.files.list:
#print file.path, file.type
if file.type == 'executable':
(ret, lines) = util.run_batch('objdump -p %s' % util.join_path('/tmp/install', file.path))
for x in lines:
if x.startswith(' NEEDED'):
needed.add(x[8:].strip())
#print 'needed guys', needed
for lib in needed:
(ret, out) = util.run_batch('locate %s' % lib)