예제 #1
0
 def setuphackversion(self):
     '''Internal: Handle 'auto' for --hackversion.''' # TODO: Probably doesn't work for all releases
     if self.hackversion == 'auto':
         log.debug('Attempting to automatically detect DFHack version.')
         
         dfhackdir = findfile(name='hack', paths=(self.input, self.output))
         if dfhackdir is None:
             log.error('Unable to detect DFHack directory.')
             return
         else:
             log.debug('Detected DFHack directory at %s.' % dfhackdir)
             
         newspath = os.path.join(dfhackdir, 'NEWS')
         if os.path.isfile(newspath):
             with open(newspath, 'rb') as news: self.hackversion = news.readline().strip()
             
         if self.hackversion is None:
             log.error('Unable to detect DFHack version.')
         else:
             log.debug('Detected DFHack version %s.' % self.hackversion)
             
     elif self.hackversion is None:
         log.warning('No DFHack version was specified.')
예제 #2
0
파일: config.py 프로젝트: m-stanley/PyDwarf
    def setuphackversion(self):
        '''Internal: Handle 'auto' for --hackversion.'''  # TODO: Probably doesn't work for all releases
        if self.hackversion == 'auto':
            log.debug('Attempting to automatically detect DFHack version.')

            dfhackdir = findfile(name='hack', paths=(self.input, self.output))
            if dfhackdir is None:
                log.error('Unable to detect DFHack directory.')
                return
            else:
                log.debug('Detected DFHack directory at %s.' % dfhackdir)

            newspath = os.path.join(dfhackdir, 'NEWS')
            if os.path.isfile(newspath):
                with open(newspath, 'rb') as news:
                    self.hackversion = news.readline().strip()

            if self.hackversion is None:
                log.error('Unable to detect DFHack version.')
            else:
                log.debug('Detected DFHack version %s.' % self.hackversion)

        elif self.hackversion is None:
            log.warning('No DFHack version was specified.')
예제 #3
0
def detectversion(*args, **kwargs):
    '''Internal: Detect Dwarf Fortress version.'''
    path = helpers.findfile(name='release notes.txt', *args, **kwargs)
    return versionfromreleasenotes(path)