Skip to content

Commit 0ec638f

Browse files
committed
Fixed the problem that couldn't start ModChecker.
1 parent 72b8dca commit 0ec638f

3 files changed

Lines changed: 83 additions & 60 deletions

File tree

Mopy/Wrye Flash.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ Additionally, Wrye Bash comes packaged with the following programs:
3838
{{CONTENTS=0}}
3939
**All versions by Wrye team and or Valda unless otherwise noted.**
4040

41+
=== 30.2 [04/04/2012]
42+
* Fixed the problem that could not start Mod Checker.
43+
4144
=== 30.1 [04/02/2012]
4245
* Added a NAVM (Navi-mesh) record support.
4346
* Fixed a REFR record structure.

Mopy/bash/bolt.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from __future__ import with_statement
2727
#--Standard
2828
import cPickle
29+
import StringIO
2930
import copy
3031
import locale
3132
import os
@@ -807,6 +808,15 @@ def __cmp__(self, other):
807808
if isinstance(other,LString): return cmp(self._cs, other._cs)
808809
else: return cmp(self._cs, other.lower())
809810

811+
# sio - StringIO wrapper so it uses the 'with' statement, so they can be used
812+
# in the same functions that accept files as input/output as well. Really,
813+
# StringIO objects don't need to 'close' ever, since the data is unallocated
814+
# once the object is destroyed.
815+
#------------------------------------------------------------------------------
816+
class sio(StringIO.StringIO):
817+
def __enter__(self): return self
818+
def __exit__(self,*args,**kwdargs): self.close()
819+
810820
# Paths -----------------------------------------------------------------------
811821
#------------------------------------------------------------------------------
812822
_gpaths = {}

Mopy/bash/bosh.py

Lines changed: 70 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def unformatDate(str,format):
8585
import bolt
8686
import bush
8787
from bolt import BoltError, AbstractError, ArgumentError, StateError, UncodedError, PermissionError
88-
from bolt import _, LString, Unicode, Encode, GPath, Flags, DataDict, SubProgress, cstrip, deprint, delist
88+
from bolt import _, LString, Unicode, Encode, GPath, Flags, DataDict, SubProgress, cstrip, deprint, delist, sio
8989
from cint import *
9090
import bapi
9191

@@ -9814,8 +9814,7 @@ def getDirtyMessage(self):
98149814
"""Returns a dirty message from BOSS."""
98159815
if modInfos.table.getItem(self.name,'ignoreDirty',False):
98169816
return (False,'')
9817-
crc = self.cachedCrc()
9818-
return configHelpers.getDirtyMessage(crc)
9817+
return configHelpers.getDirtyMessage(self.name)
98199818

98209819
#--Header Editing ---------------------------------------------------------
98219820
def getHeader(self):
@@ -10921,66 +10920,76 @@ def selectExact(self,modNames):
1092110920
else:
1092210921
return None
1092310922

10924-
def getModList(self,fileInfo=None,wtxt=False):
10923+
def getModList(self,showCRC=False,showVersion=True,fileInfo=None,wtxt=False):
1092510924
"""Returns mod list as text. If fileInfo is provided will show mod list
1092610925
for its masters. Otherwise will show currently loaded mods."""
1092710926
#--Setup
10928-
log = bolt.LogFile(stringBuffer())
10929-
head = ('','=== ')[wtxt]
10930-
bul = ('','* ')[wtxt]
10931-
sMissing = (_('----> MISSING MASTER: '),_(' * __Missing Master:__ '))[wtxt]
10932-
sDelinquent = (_('----> Delinquent MASTER: '),_(' * __Delinquent Master:__ '))[wtxt]
10933-
sImported = ('**','• •')[wtxt]
10934-
if fileInfo:
10935-
masters = set(fileInfo.header.masters)
10936-
missing = sorted([x for x in masters if x not in self])
10937-
log.setHeader(head+_('Missing Masters for: ')+fileInfo.name.s)
10938-
for mod in missing:
10939-
log(bul+'xx '+mod.s)
10940-
log.setHeader(head+_('Masters for: ')+fileInfo.name.s)
10941-
present = set(x for x in masters if x in self)
10942-
if fileInfo.name in self: #--In case is bashed patch
10943-
present.add(fileInfo.name)
10944-
merged,imported = self.getSemiActive(present)
10945-
else:
10946-
log.setHeader(head+_('Active Mod Files:'))
10947-
masters = set(self.ordered)
10948-
merged,imported = self.merged,self.imported
10949-
headers = set(mod for mod in self.data if mod.s[0] in '.=+')
10950-
allMods = masters | merged | imported | headers
10951-
allMods = self.getOrdered([x for x in allMods if x in self])
10952-
#--List
10953-
modIndex,header = 0, None
10954-
if not wtxt: log('[spoiler][xml]', False)
10955-
for name in allMods:
10956-
if name in masters:
10957-
prefix = bul+'%02X' % (modIndex)
10958-
modIndex += 1
10959-
elif name in headers:
10960-
match = re.match('^[\.+= ]*(.*?)\.es[pm]',name.s)
10961-
if match: name = GPath(match.group(1))
10962-
header = bul+'== ' +name.s
10963-
continue
10964-
elif name in merged:
10965-
prefix = bul+'++'
10966-
else:
10967-
prefix = bul+sImported
10968-
version = self.getVersion(name)
10969-
if header:
10970-
log(header)
10971-
header = None
10972-
if version:
10973-
log(_('%s %s [Version %s] [CRC: %08X]') % (prefix,name.s,version,self[name].cachedCrc()))
10927+
with sio() as out:
10928+
log = bolt.LogFile(out)
10929+
head,bul,sMissing,sDelinquent,sImported = (
10930+
u'=== ',
10931+
u'* ',
10932+
_(u' * __Missing Master:__ '),
10933+
_(u' * __Delinquent Master:__ '),
10934+
u'• •'
10935+
) if wtxt else (
10936+
u'',
10937+
u'',
10938+
_(u'----> MISSING MASTER: '),
10939+
_(u'----> Delinquent MASTER: '),
10940+
u'**')
10941+
if fileInfo:
10942+
masters = set(fileInfo.header.masters)
10943+
missing = sorted([x for x in masters if x not in self])
10944+
log.setHeader(head+_(u'Missing Masters for: ')+fileInfo.name.s)
10945+
for mod in missing:
10946+
log(bul+u'xx '+mod.s)
10947+
log.setHeader(head+_(u'Masters for: ')+fileInfo.name.s)
10948+
present = set(x for x in masters if x in self)
10949+
if fileInfo.name in self: #--In case is bashed patch
10950+
present.add(fileInfo.name)
10951+
merged,imported = self.getSemiActive(present)
1097410952
else:
10975-
log('%s %s [CRC: %08X]' % (prefix,name.s,self[name].cachedCrc()))
10976-
if name in masters:
10977-
for master2 in self[name].header.masters:
10978-
if master2 not in self:
10979-
log(sMissing+master2.s)
10980-
elif self.getOrdered((name,master2))[1] == master2:
10981-
log(sDelinquent+master2.s)
10982-
if not wtxt: log('[/xml][/spoiler]')
10983-
return bolt.winNewLines(log.out.getvalue())
10953+
log.setHeader(head+_(u'Active Mod Files:'))
10954+
masters = set(self.ordered)
10955+
merged,imported = self.merged,self.imported
10956+
headers = set(mod for mod in self.data if mod.s[0] in u'.=+')
10957+
allMods = masters | merged | imported | headers
10958+
allMods = self.getOrdered([x for x in allMods if x in self])
10959+
#--List
10960+
modIndex,header = 0, None
10961+
if not wtxt: log(u'[spoiler][xml]', False)
10962+
for name in allMods:
10963+
if name in masters:
10964+
prefix = bul+u'%02X' % (modIndex)
10965+
modIndex += 1
10966+
elif name in headers:
10967+
match = re.match(u'^[\.+= ]*(.*?)\.es[pm]',name.s,flags=re.U)
10968+
if match: name = GPath(match.group(1))
10969+
header = bul+u'== ' +name.s
10970+
continue
10971+
elif name in merged:
10972+
prefix = bul+u'++'
10973+
else:
10974+
prefix = bul+sImported
10975+
if header:
10976+
log(header)
10977+
header = None
10978+
text = u'%s %s' % (prefix,name.s,)
10979+
if showVersion:
10980+
version = self.getVersion(name)
10981+
if version: text += _(u' [Version %s]') % (version)
10982+
if showCRC:
10983+
text +=_(u' [CRC: %08X]') % (self[name].cachedCrc())
10984+
log(text)
10985+
if name in masters:
10986+
for master2 in self[name].header.masters:
10987+
if master2 not in self:
10988+
log(sMissing+master2.s)
10989+
elif self.getOrdered((name,master2))[1] == master2:
10990+
log(sDelinquent+master2.s)
10991+
if not wtxt: log(u'[/xml][/spoiler]')
10992+
return bolt.winNewLines(log.out.getvalue())
1098410993

1098510994
def getTagList(self,modList=None):
1098610995
"""Returns the list as wtxt of current bash tags (but doesn't say what ones are applied via a patch).
@@ -11714,7 +11723,8 @@ def checkMods(self,showModList=False,showRuleSets=False,showNotes=False,showConf
1171411723
shouldDeactivateB = [x for x in active if u'NoMerge' in modInfos[x].getBashTags() and x in modInfos.mergeable]
1171511724
shouldActivateA = [x for x in imported if u'MustBeActiveIfImported' in modInfos[x].getBashTags() and x not in active]
1171611725
#--Mods with invalid TES4 version
11717-
invalidVersion = [(x,unicode(round(modInfos[x].header.version,6))) for x in active if round(modInfos[x].header.version,6) not in bush.game.esp.validHeaderVersions]
11726+
#invalidVersion = [(x,unicode(round(modInfos[x].header.version,6))) for x in active if round(modInfos[x].header.version,6) not in bush.game.esp.validHeaderVersions]
11727+
invalidVersion = [(x,unicode(round(modInfos[x].header.version,6))) for x in active if round(modInfos[x].header.version,6) not in (1.32,1.33,1.34)]
1171811728
if True:
1171911729
#--Look for dirty edits
1172011730
shouldClean = {}

0 commit comments

Comments
 (0)