Kaydet (Commit) 14757a54 authored tarafından Your Name's avatar Your Name

minor fix

üst 9caee2b8
......@@ -15,6 +15,7 @@
import inary.context as ctx
from inary.errors import Error
def error(msg):
if ctx.config.get_option('ignore_action_errors'):
ctx.ui.error(msg)
......
......@@ -192,6 +192,7 @@ class ArchiveBinary(ArchiveBase):
# we can't unpack .bin files. we'll just move them to target
# directory and leave the dirty job to actions.py ;)
print(target_dir)
target_file = os.path.join(target_dir,
os.path.basename(self.file_path))
if os.path.isfile(self.file_path):
......
......@@ -519,7 +519,7 @@ class Install(AtomicOperation):
ctx.ui.info(_("Precaching postoperations.py file"), verbose=True)
if 'postOps' in self.metadata.package.isA:
for postops in ctx.const.postops :
for postops in ctx.const.postops:
try:
self.package.extract_file_synced(
postops, ctx.config.tmp_dir())
......@@ -535,7 +535,7 @@ class Install(AtomicOperation):
self.package.extract_file_synced(
ctx.const.metadata_xml, self.package.pkg_dir())
if 'postOps' in self.metadata.package.isA:
for postops in ctx.const.postops :
for postops in ctx.const.postops:
try:
self.package.extract_file_synced(
postops, ctx.config.tmp_dir())
......
......@@ -30,6 +30,8 @@ __trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
# in old releases used this printu function
def printu(obj, err=False):
if not isinstance(obj, str):
obj = str(obj)
......
......@@ -48,7 +48,7 @@ Usage: check-relation
self.parser.add_option_group(group)
def fix_reinstall(self,need_reinstall):
def fix_reinstall(self, need_reinstall):
need_reinstall = util.unique_list(need_reinstall)
if len(need_reinstall) > 0:
sys.stderr.write(
......@@ -92,4 +92,3 @@ Usage: check-relation
sys.stderr.write(
_("Missing: /{} - {}").format(f.path, pkg)+"\n")
self.fix_reinstall(need_reinstall)
......@@ -12,6 +12,11 @@
# Please read the COPYING file.
#
import inary.operations as operations
import inary.db
import inary.context as ctx
import inary.blacklist
import inary.cli.command as command
import optparse
import sys
......@@ -20,12 +25,6 @@ import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
import inary.cli.command as command
import inary.blacklist
import inary.context as ctx
import inary.db
import inary.operations as operations
class ListUpgrades(command.Command, metaclass=command.autocommand):
__doc__ = _("""List packages to be upgraded
......@@ -64,14 +63,17 @@ Lists the packages that will be upgraded.
# upgradable_pkgs.extend(list_replaces())
# consider also blacklist filtering
upgradable_pkgs = inary.blacklist.exclude_from(upgradable_pkgs, ctx.const.blacklist)
upgradable_pkgs = inary.blacklist.exclude_from(
upgradable_pkgs, ctx.const.blacklist)
component = ctx.get_option('component')
if component:
component_pkgs = self.componentdb.get_union_packages(component, walk=True)
component_pkgs = self.componentdb.get_union_packages(
component, walk=True)
upgradable_pkgs = list(set(upgradable_pkgs) & set(component_pkgs))
upgradable_pkgs = inary.blacklist.exclude_from(upgradable_pkgs, ctx.const.blacklist)
upgradable_pkgs = inary.blacklist.exclude_from(
upgradable_pkgs, ctx.const.blacklist)
if not upgradable_pkgs:
ctx.ui.info(_('No packages to upgrade.'))
......@@ -83,8 +85,10 @@ Lists the packages that will be upgraded.
maxlen = max([len(_p) for _p in upgradable_pkgs])
if self.options.install_info:
ctx.ui.info(_('Package Name |St| Version| Rel.| Distro| Date'))
sys.stdout.write('===========================================================================')
ctx.ui.info(
_('Package Name |St| Version| Rel.| Distro| Date'))
sys.stdout.write(
'===========================================================================')
for pkg in upgradable_pkgs:
package = self.installdb.get_package(pkg)
......@@ -93,7 +97,9 @@ Lists the packages that will be upgraded.
ctx.ui.info(package)
sys.stdout.write(inst_info)
elif self.options.install_info:
ctx.ui.info('%-20s |%s ' % (package.name, inst_info.one_liner()))
ctx.ui.info('%-20s |%s ' %
(package.name, inst_info.one_liner()))
else:
package.name += ' ' * max(0, maxlen - len(package.name))
ctx.ui.info('{0} - {1}'.format(package.name, str(package.summary)))
ctx.ui.info(
'{0} - {1}'.format(package.name, str(package.summary)))
......@@ -107,7 +107,7 @@ class Constants(metaclass=Singleton):
self.__c.translations_file = "translations.xml"
self.__c.files_xml = "files.xml"
self.__c.metadata_xml = "metadata.xml"
self.__c.postops = [ "postoperations.py", "postoperations.sh" ]
self.__c.postops = ["postoperations.py", "postoperations.sh"]
self.__c.install_tar = "install.tar"
self.__c.mirrors_conf = "/etc/inary/mirrors.conf"
self.__c.blacklist = "/etc/inary/blacklist"
......
......@@ -13,6 +13,7 @@
from gettext import translation
_ = translation('inary', fallback=True).gettext
class Error(Exception):
"""Class of exceptions that lead to program termination"""
pass
......@@ -26,6 +27,8 @@ class PrivilegeError(Error):
pass
# Error Classes
class FileError(Error):
def __init__(self, value=''):
Error.__init__(self, value)
......@@ -37,10 +40,13 @@ class ArgumentError(Error):
Error.__init__(self, value)
self.value = value
class FilePermissionDeniedError(Error):
pass
# Error Classes
class FileError(Error):
def __init__(self, value=''):
Error.__init__(self, value)
......@@ -52,6 +58,7 @@ class ArgumentError(Error):
Error.__init__(self, value)
self.value = value
class AlreadyHaveException(Error):
def __init__(self, url, localfile):
Error.__init__(
......@@ -67,12 +74,14 @@ class NoSignatureFound(Error):
self, _("No signature found for \"{}\"").format(url))
self.url = url
class InvalidSignature(Error):
def __init__(self, url):
Error.__init__(
self, _("GPG Signature is invalid for \"{}\"").format(url))
self.url = url
class CycleException(Error):
def __init__(self, cycle):
self.cycle = cycle
......@@ -80,6 +89,7 @@ class CycleException(Error):
def __str__(self):
return _('Encountered cycle {}').format(self.cycle)
class ParserError(Error):
pass
......@@ -90,4 +100,3 @@ class PostOpsError(Error):
class NotfoundError(Error):
pass
......@@ -687,7 +687,6 @@ class Builder:
# mode is octal!
os.chmod(dest, int(afile.permission, 8))
def get_action_variable(self, name, default):
if name in self.variable_buffer.keys():
return self.variable_buffer[name]
......
......@@ -284,7 +284,7 @@ def install_pkg_files(package_URIs, reinstall=False):
for x in B:
pkg = packagedb.get_package(x)
G_f.add_package(x)
#for dep in pkg.runtimeDependencies():
# for dep in pkg.runtimeDependencies():
# G_f.add_package(dep)
B = Bp
order = G_f.topological_sort()
......
......@@ -15,6 +15,16 @@
"""misc. utility functions, including process and file utils"""
# Inary Modules
from inary.util.strings import *
from inary.util.process import *
from inary.util.path import *
from inary.util.package import *
from inary.util.misc import *
from inary.util.kernel import *
from inary.util.filesystem_terminal import *
from inary.util.files import *
from inary.util.curses import *
import fcntl
import inary
import inary.errors
import inary.context as ctx
......@@ -24,18 +34,6 @@ import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
import fcntl
from inary.util.curses import *
from inary.util.files import *
from inary.util.filesystem_terminal import *
from inary.util.kernel import *
from inary.util.misc import *
from inary.util.package import *
from inary.util.path import *
from inary.util.process import *
from inary.util.strings import *
class Singleton(type):
def __init__(cls, name, bases, dict):
......
......@@ -15,6 +15,7 @@
"""misc. utility functions, including process and file utils"""
# Inary Modules
import sys
import inary
import inary.errors
import inary.context as ctx
......@@ -24,7 +25,6 @@ import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
import sys
#############################
# ncurses like functions #
......
......@@ -14,7 +14,14 @@
"""misc. utility functions, including process and file utils"""
import os, re
from inary.errors import FileError, FilePermissionDeniedError
from inary.util.strings import remove_prefix
from inary.util.process import run_batch
import fnmatch
import hashlib
import shutil
import os
import re
# Inary Modules
import inary
......@@ -26,16 +33,12 @@ import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
import shutil
import hashlib
import fnmatch
from inary.util.strings import remove_prefix
from inary.errors import FileError, FilePermissionDeniedError
####################################
# File/Directory Related Functions #
####################################
def check_file(_file, mode=os.F_OK, noerr=False):
"""Shorthand to check if a file exists."""
if not os.access(_file, mode):
......@@ -441,4 +444,3 @@ def partition_freespace(directory):
"""Return free space of given directory's partition."""
st = os.statvfs(directory)
return st.f_frsize * st.f_bfree
......@@ -15,6 +15,11 @@
"""misc. utility functions, including process and file utils"""
# Inary Modules
import struct
import termios
import fcntl
import sys
import os
import inary
import inary.errors
import inary.context as ctx
......@@ -24,16 +29,12 @@ import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
import os
import sys
import fcntl
import termios
import struct
########################
# Filesystem functions #
########################
def fs_sync():
if ctx.config.values.general.fs_sync:
ctx.ui.debug(
......
......@@ -15,6 +15,7 @@
"""misc. utility functions, including process and file utils"""
# Inary Modules
import platform
import inary
import inary.errors
import inary.context as ctx
......@@ -24,7 +25,6 @@ import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
import platform
def get_kernel_option(option):
"""Get a dictionary of args for the given kernel command line option"""
......
......@@ -15,6 +15,7 @@
"""misc. utility functions, including process and file utils"""
# Inary Modules
from unicodedata import category as ucategory
import inary.context as ctx
from os import listdir, path, readlink, rmdir
from sys import maxunicode
......@@ -25,7 +26,6 @@ import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
from unicodedata import category as ucategory
def join_path(a, *p):
"""Join two or more pathname components.
......@@ -40,6 +40,7 @@ def join_path(a, *p):
path += '/' + b
return path
def colorize(msg, color):
"""Colorize the given message for console output"""
if color in ctx.const.colors and not (ctx.get_option(
......@@ -91,4 +92,3 @@ def letters():
result.append(start + "-" + end)
start = None
return ''.join(result)
......@@ -15,6 +15,7 @@
"""misc. utility functions, including process and file utils"""
# Inary Modules
from inary.util.strings import *
import inary
import inary.errors
import inary.context as ctx
......@@ -24,12 +25,12 @@ import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
from inary.util.strings import *
########################################
# Package/Repository Related Functions #
########################################
def package_filename(name, version, release, distro_id=None, arch=None):
"""Return a filename for a package with the given information. """
......
......@@ -14,6 +14,9 @@
"""misc. utility functions, including process and file utils"""
from inary.util.strings import *
import struct
from functools import reduce
import os
# Inary Modules
......@@ -26,9 +29,6 @@ import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
from functools import reduce
import struct
from inary.util.strings import *
#############################
# Path Processing Functions #
......@@ -89,4 +89,3 @@ def join_path(a, *p):
else:
path += '/' + b
return path
......@@ -97,4 +97,3 @@ def hewal(expr):
elif expr in ("FALSE", "0", "OFF", "F", "N", "NO"):
return False
return None
......@@ -15,6 +15,10 @@
"""misc. utility functions, including process and file utils"""
# Inary Modules
from inary.util.filesystem_terminal import get_terminal_size
import operator
from inary.util.filesystem_terminal import *
from functools import reduce
import inary
import inary.errors
import inary.context as ctx
......@@ -24,10 +28,6 @@ import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
from functools import reduce
from inary.util.filesystem_terminal import *
import operator
from inary.util.filesystem_terminal import get_terminal_size
#########################
# string/list/functional#
......@@ -203,4 +203,3 @@ def format_by_columns(strings, sep_width=2):
lines.append(sep.join(current_line))
return "\n".join(lines)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment