当前位置: 首页>>代码示例>>Python>>正文


Python OUT.debug方法代码示例

本文整理汇总了Python中WebappConfig.debug.OUT.debug方法的典型用法代码示例。如果您正苦于以下问题:Python OUT.debug方法的具体用法?Python OUT.debug怎么用?Python OUT.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebappConfig.debug.OUT的用法示例。


在下文中一共展示了OUT.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: packageavail

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def packageavail(self):
        '''
        Check to see whether the given package has been installed or not.

        These checks are carried out by using wrapper.py to facilitate
        distribution independant handling of the task.

        Outputs:
            0       - on success
            1       - package not found
            2       - no package to find
            3       - package isn't webapp-config compatible          '
        '''

        OUT.debug('Verifying package ' + self.package_name(), 6)

        # package_installed() does not handle "/PN" correctly
        package = self.pn

        if self.category:
            package = self.category + '/' + self.pn

        # not using self.package_name() here as we don't need pvr
            return 1

        # unfortunately, just because a package has been installed, it
        # doesn't mean that the package itself is webapp-compatible
        #
        # we need to check that the package has an entry in the
        # application repository

        if not self.appdb():
            return 3
        else:
            return 0
开发者ID:PPed72,项目名称:webapp-config,代码行数:37,代码来源:db.py

示例2: remove

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def remove(self, entry):
        '''
        Decide whether to delete something - and then go ahead and do so

        Just like portage, we only remove files that have not changed
        from when we installed them.  If the timestamp or checksum is
        different, we leave the file in place.

        Inputs

          entry    - file/dir/sym to remove
        '''

        OUT.debug('Trying to remove file', 6)

        # okay, deal with the file | directory | symlink

        removeable = self.__content.get_canremove(entry)

        if not removeable:

            # Remove directory or file.

            # Report if we are only pretending
            if self.__p:
                OUT.info('    pretending to remove: ' + entry)

            # try to remove the entry
            try:
                entry_type = self.__content.etype(entry)
                if self.__content.etype(entry) == 'dir':
                    # its a directory -> rmdir
                    if not self.__p:
                        os.rmdir(entry)
                else:
                    # its a file -> unlink
                    if not self.__p:
                        os.unlink(entry)
            except:
                # Report if there is a problem
                OUT.notice('!!!      '
                           + self.__content.epath(entry))
                return

            if self.__v and not self.__p:
                # Report successful deletion

                OUT.notice('<<< ' + entry_type + ' '
                           * (5 - len(entry_type))
                           + self.__content.epath(entry))

            self.__content.delete(entry)

            return True

        else:

            OUT.notice(removeable)

            return False
开发者ID:Feandil,项目名称:webapp-config,代码行数:62,代码来源:worker.py

示例3: read

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def read(self,
             config_owned  = 'config-files',
             server_owned  = 'server-owned-files',
             virtual_files = 'virtual',
             default_dirs  = 'default-owned'):
        '''
        Initialize the type cache.
        '''
        import WebappConfig.filetype

        server_files = []
        config_files = []

        if os.access(self.appdir() + '/' + config_owned, os.R_OK):
            flist = open(self.appdir() + '/' + config_owned)
            config_files = flist.readlines()

            OUT.debug('Identified config-protected files.', 7)

            flist.close()

        if os.access(self.appdir() + '/' + server_owned, os.R_OK):
            flist = open(self.appdir() + '/' + server_owned)
            server_files = flist.readlines()

            OUT.debug('Identified server-owned files.', 7)

            flist.close()

        self.__types = WebappConfig.filetype.FileType(config_files,
                                                      server_files,
                                                      virtual_files,
                                                      default_dirs)
开发者ID:PPed72,项目名称:webapp-config,代码行数:35,代码来源:db.py

示例4: read

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def read(self):
        ''' Read the contents of the dot config file.'''
        dotconfig = self.__dot_config()

        OUT.debug('Checking for dotconfig ', 6)

        if not self.has_dotconfig():
            raise Exception('Cannot read file ' + dotconfig)

        tokens = shlex.shlex(open(dotconfig))

        while True:
            a = tokens.get_token()
            b = tokens.get_token()
            c = tokens.get_token()

            OUT.debug('Reading token', 8)

            if (a in self.__tokens and
                b == '=' and c):

                if c[0] == '"':
                    c = c[1:]

                if c[-1] == '"':
                    c = c[:-1]

                self.__data[a] = c

            else:
                break
开发者ID:PPed72,项目名称:webapp-config,代码行数:33,代码来源:dotconfig.py

示例5: dirtype

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def dirtype(self, directory, parent_type = ''):
        ''' Determine filetype for the given directory.'''
        if self.__types:

            OUT.debug('Returning directory type', 7)

            return self.__types.dirtype(directory, parent_type)
开发者ID:Feandil,项目名称:webapp-config,代码行数:9,代码来源:db.py

示例6: listunused

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def listunused(self, db):
        '''
        Outputs a list of what has not been installed so far
        '''

        packages = self.list_locations()

        if not packages:
            OUT.die('No packages found!')

        keys = sorted(packages)

        OUT.debug('Check for unused web applications', 7)

        for i in keys:

            db.set_category(packages[i][0])
            db.set_package (packages[i][1])
            db.set_version (packages[i][2])

            if not db.has_installs():
                if packages[i][0]:
                    OUT.notice(packages[i][0] + '/' + packages[i][1] + '-' + packages[i][2])
                else:
                    OUT.notice(packages[i][1] + '-' + packages[i][2])
开发者ID:Feandil,项目名称:webapp-config,代码行数:27,代码来源:db.py

示例7: filetype

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def filetype(self, filename, parent_type = ''):
        ''' Determine filetype for the given file.'''
        if self.__types:

            OUT.debug('Returning file type', 7)

            return self.__types.filetype(filename, parent_type)
开发者ID:Feandil,项目名称:webapp-config,代码行数:9,代码来源:db.py

示例8: show_postupgrade

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def show_postupgrade(self, server = None):
        '''
        Display any post-upgrade instructions, if there are any.
        '''

        OUT.debug('Running show_postupgrade', 6)

        self.show_post(filename = 'postupgrade-en.txt', ptype = 'upgrade', server = server)
开发者ID:PPed72,项目名称:webapp-config,代码行数:10,代码来源:ebuild.py

示例9: show_postinst

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def show_postinst(self, server = None):
        '''
        Display any post-installation instructions, if there are any.
        '''

        OUT.debug('Running show_postinst', 6)

        self.show_post(filename = 'postinst-en.txt', ptype = 'install', server = server)
开发者ID:PPed72,项目名称:webapp-config,代码行数:10,代码来源:ebuild.py

示例10: clean

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def clean(self):

        self.file_behind_flag = False

        OUT.debug('Basic server clean', 7)

        self.file_behind_flag |= self.__del.remove_files()

        self.file_behind_flag |= self.__del.remove_dirs()

        OUT.info('Any files or directories listed above must be removed b'
                 'y hand')

        # okay, let's finish off
        #
        # we don't need the contents file anymore

        self.file_behind_flag |= not self.__content.kill()

        # right - we need to run the hook scripts now
        # if they fail, we don't actually care

        # run the hooks

        self.__ebuild.run_hooks('clean', self)

        # do we need the dotconfig file?
        #
        # if the .webapp file is the only one in the dir, we believe
        # that we can remove it

        self.__dotconfig.kill()

        # is the installation directory empty?

        if not os.listdir(self.__destd) and os.path.isdir(self.__destd):
            if not self.__p:
                os.rmdir(self.__destd)
        else:
            OUT.notice('--- ' + self.__destd)

        # update the list of installs

        self.__db.remove(self.__destd)

        # Remove the selinux module

        if self.__selinux is not None:
            self.__selinux.remove_module()

        # did we leave anything behind?

        if self.file_behind_flag:
            OUT.warn('Remove whatever is listed above by hand')
开发者ID:Feandil,项目名称:webapp-config,代码行数:56,代码来源:server.py

示例11: remove_files

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def remove_files(self):
        '''
        It is time to remove the files that we installed originally.
        '''

        OUT.debug('Trying to remove files', 6)

        success = [self.remove(i) for i in self.__content.get_files()]

        # Tell the caller if anything was left behind

        return all(success)
开发者ID:Feandil,项目名称:webapp-config,代码行数:14,代码来源:worker.py

示例12: packagename

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def packagename(self):
        ''' Retrieve the package name from the values specified in the dot
        config file'''

        OUT.debug('Trying to retrieve package name', 6)

        if 'WEB_PN' in list(self.__data.keys()) and 'WEB_PVR' in list(self.__data.keys()):
            if 'WEB_CATEGORY' in list(self.__data.keys()):
                return self.__data['WEB_CATEGORY'] + '/' + \
                    self.__data['WEB_PN'] + '-' + self.__data['WEB_PVR']
            else:
                return self.__data['WEB_PN'] + '-' + self.__data['WEB_PVR']
        return ''
开发者ID:PPed72,项目名称:webapp-config,代码行数:15,代码来源:dotconfig.py

示例13: packageavail

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def packageavail(self):
        '''
        Check to see whether the given package has been installed or not.

        These checks are carried out by using wrapper.py to facilitate
        distribution independant handling of the task.

        Outputs:
            0       - on success
            1       - package not found
            2       - no package to find
            3       - package isn't webapp-config compatible          '

        >>> import os.path
        >>> here = os.path.dirname(os.path.realpath(__file__))

        Does not exist:

        >>> a = WebappSource(root = here + '/tests/testfiles/share-webapps',
        ...             category='www-apps',package='nothere', version='1',pm='portage')
        >>> a.packageavail()
        1

        Incompatible cannot be tested since that would require a
        oackage (including version number) that is installed on
        all systems.
        '''

        OUT.debug('Verifying package ' + self.package_name(), 6)

        # package_installed() does not handle "/PN" correctly
        package = self.pn

        if self.category:
            package = self.category + '/' + self.pn

        # not using self.package_name() here as we don't need pvr
        if not wrapper.package_installed(package, self.pm):
            return 1

        # unfortunately, just because a package has been installed, it
        # doesn't mean that the package itself is webapp-compatible
        #
        # we need to check that the package has an entry in the
        # application repository

        if not self.appdb():
            return 3
        else:
            return 0
开发者ID:Feandil,项目名称:webapp-config,代码行数:52,代码来源:db.py

示例14: has_dotconfig

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def has_dotconfig(self):
        ''' Return True if the install location already has a dotconfig
        file.'''
        dotconfig = self.__dot_config()

        OUT.debug('Verifying path', 7)

        if not os.path.isfile(dotconfig):
            return False

        if not os.access(dotconfig, os.R_OK):
            return False

        return True
开发者ID:PPed72,项目名称:webapp-config,代码行数:16,代码来源:dotconfig.py

示例15: add

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import debug [as 别名]
    def add(self, installdir, user, group):
        '''
        Add a record to the list of virtual installs.

        installdir - the installation directory
        '''

        if not installdir:
            OUT.die('The installation directory must be specified!')

        if not str(user):
            OUT.die('Please specify a valid user!')

        if not str(group):
            OUT.die('Please specify a valid group!')

        OUT.debug('Adding install record', 6)

        dbpath = self.appdb()

        if not dbpath:
            OUT.die('No package specified!')

        if not self.__p and not os.path.isdir(os.path.dirname(dbpath)):
            os.makedirs(os.path.dirname(dbpath), self.__dir_perm(0o755))

        fd = None

        if not self.__p:
            fd = os.open(dbpath,
                         os.O_WRONLY | os.O_APPEND | os.O_CREAT,
                         self.__file_perm(0o600))

        entry = str(int(time.time())) + ' ' + str(user) + ' ' + str(group)\
            + ' ' + installdir + '\n'

        OUT.debug('New record', 7)

        if not self.__p:
            os.write(fd, (entry).encode('utf-8'))
            os.close(fd)
        else:
            OUT.info('Pretended to append installation ' + installdir)
            OUT.info('Entry:\n' + entry)
开发者ID:Feandil,项目名称:webapp-config,代码行数:46,代码来源:db.py


注:本文中的WebappConfig.debug.OUT.debug方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。