Exemplo n.º 1
0
    def findDefaultWorkflowId(self):
        statemachines = self.package.getStateMachines()
        for sm in statemachines:
            if utils.isTGVTrue(sm.getTaggedValue('default', '0')):
                return sm.getCleanName()

        return None
Exemplo n.º 2
0
    def getHeaderInfo(self, element, name=None):
        log.debug("Getting info for the header...")

        # ACV FIX 20110301 - remove the auto injection of year in the copyright notice, y the notice already incluides the year
        aYearStr = str(time.localtime()[0])
        aCopyrightOrAuthor = self.getOption('copyright', element,
                                            self.copyright) or self.author
        if aYearStr in aCopyrightOrAuthor:
            copyright = COPYRIGHT_wo_year % aCopyrightOrAuthor
        else:
            copyright = COPYRIGHT % (aYearStr, aCopyrightOrAuthor)

        log.debug("Copyright = %r.", copyright)

        license = self.getLicenseInfo(element)
        authors, emails, authorline = self.getAuthors(element)

        if self.getOption('rcs_id', element, False):
            log.debug("Using id keyword.")
            filename_or_id = '$' + 'Id' + '$'
        else:
            log.debug("Using filename.")
            filename_or_id = 'File: %s.py' % (name or element.getModuleName())

        if self.getOption('generated_date', element, False):
            date = '# Generated: %s\n' % time.ctime()
        else:
            date = ''

        if utils.isTGVTrue(self.getOption('version_info', element, True)):
            log.debug("We want version info in every file.")
            versiontext = utils.version()
        elif element.__class__ == XMIParser.XMIModel:
            log.debug("We don't want version info in all files, "
                      "but we do want them in the config and Install.")
            versiontext = utils.version()
        else:
            log.debug("We don't want version info in this file.")
            versiontext = ''

        encoding = self.getOption('encoding', element, 'utf-8')
        log.debug("Encoding for python files is set to %s" % encoding)

        moduleinfo = {
            'authors': ', '.join(authors),
            'emails': ', '.join(emails),
            'authorline': authorline,
            'version': versiontext,
            'date': date,
            'copyright': '\n# '.join(utils.wrap(copyright, 77).split('\n')),
            'license': license,
            'filename_or_id': filename_or_id,
            'encoding': encoding,
        }
        return moduleinfo
Exemplo n.º 3
0
    def getHeaderInfo(self, element, name=None, all=0):
        log.debug("Getting info for the header...")

        encoding = self.getOption('encoding', element, 'utf-8')
        log.debug("Encoding for python files is set to %s" % encoding)
        
        authors, emails, authorline = self.getAuthors(element)
        copyright = COPYRIGHT.encode(encoding) % \
            (str(time.localtime()[0]),
             self.getOption('copyright', element, self.copyright) or
                 authorline)
        log.debug("Copyright = %r.", copyright)

        license = self.getLicenseInfo(element, all=all)

        if self.getOption('rcs_id', element, False):
            log.debug("Using id keyword.")
            filename_or_id = '$'+'Id'+'$'
        else:
            log.debug("Using filename.")
            filename_or_id = 'File: %s.py' % (name or element.getModuleName())

        if self.getOption('generated_date', element, False):
            date = '# Generated: %s\n' % time.ctime()
        else:
            date = ''

        if utils.isTGVTrue(self.getOption('version_info', element, True)):
            log.debug("We want version info in every file.")
            versiontext = utils.version()
        elif element.__class__ == xmiparser.XMIModel:
            log.debug("We don't want version info in all files, "
                      "but we do want them in the config and Install.")
            versiontext = utils.version()
        else:
            log.debug("We don't want version info in this file.")
            versiontext = ''
            
        moduleinfo = {
            'authors': ', '.join(authors),
            'emails': ', '.join(emails),
            'authorline': authorline,
            'version': versiontext,
            'date': date,
            'copyright': '\n# '.join(utils.wrap(copyright, 77).split('\n')),
            'license': license,
            'filename_or_id': filename_or_id,
            'encoding': encoding,
        }
        return moduleinfo
Exemplo n.º 4
0
 def isTGVTrue(self, v):
     return utils.isTGVTrue(v)
Exemplo n.º 5
0
 def isTGVTrue(self,v):
     return utils.isTGVTrue(v)