Skip to content

Commit 0d131d5

Browse files
Daniel NunesUtumno
authored andcommitted
Remove fomod metadata handling
1 parent d935ca9 commit 0d131d5

3 files changed

Lines changed: 10 additions & 44 deletions

File tree

Mopy/bash/basher/gui_fomod.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,11 @@ def __init__(self):
5656

5757
class InstallerFomod(wiz.Wizard):
5858
def __init__(self, parent_window, installer, page_size, pos):
59-
fomod_files = installer.fomod_files()
60-
info_path = fomod_files[0]
61-
if info_path is not None:
62-
info_path = info_path.s
63-
conf_path = fomod_files[1].s
59+
fomod_file = installer.fomod_file().s
6460
data_path = bass.dirs['mods']
6561
ver = env.get_file_version(bass.dirs['app'].join(bush.game.exe).s)
6662
game_ver = u'.'.join([unicode(i) for i in ver])
67-
self.parser = FomodInstaller(info_path, conf_path, dest=data_path,
63+
self.parser = FomodInstaller(fomod_file, dest=data_path,
6864
game_version=game_ver)
6965
mod_name = self.parser.fomod_name
7066

Mopy/bash/bosh/bain.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ def initDefault(self):
195195
# LowerDict mapping destinations (relative to Data/ directory) of files
196196
# in this installer to their size and crc - built in refreshDataSizeCrc
197197
self.ci_dest_sizeCrc = bolt.LowerDict()
198-
self.has_fomod_info = False
199198
self.has_fomod_conf = False
200199
self.hasWizard = False
201200
self.hasBCF = False
@@ -604,7 +603,7 @@ def refreshDataSizeCrc(self, checkOBSE=False, splitExt=os.path.splitext):
604603
"""
605604
type_ = self.type
606605
#--Init to empty
607-
self.has_fomod_info = self.has_fomod_conf = False
606+
self.has_fomod_conf = False
608607
self.hasWizard = self.hasBCF = self.hasReadme = False
609608
self.packageDoc = self.packagePic = None # = self.extras_dict['readMe']
610609
for attr in {'skipExtFiles','skipDirFiles','espms'}:
@@ -652,9 +651,7 @@ def refreshDataSizeCrc(self, checkOBSE=False, splitExt=os.path.splitext):
652651
root_path = self.extras_dict.get('root_path', u'')
653652
rootIdex = len(root_path)
654653
for full,size,crc in self.fileSizeCrcs:
655-
if full.lower() == "fomod" + os.sep + "info.xml":
656-
self.has_fomod_info = full
657-
elif full.lower() == "fomod" + os.sep + "moduleconfig.xml":
654+
if full.lower() == "fomod" + os.sep + "moduleconfig.xml":
658655
self.has_fomod_conf = full
659656
fomod_dict = self.extras_dict.get('fomod_files_dict', {})
660657
if self.extras_dict.get('fomod_active', False) and full in fomod_dict.values():
@@ -1001,7 +998,7 @@ def open_readme(self): self._open_txt_file(self.hasReadme)
1001998
def open_wizard(self): self._open_txt_file(self.hasWizard)
1002999
def _open_txt_file(self, rel_path): raise AbstractError
10031000
def wizard_file(self): raise AbstractError
1004-
def fomod_files(self): raise AbstractError
1001+
def fomod_file(self): raise AbstractError
10051002

10061003
def __repr__(self):
10071004
return self.__class__.__name__ + u"<" + repr(self.archive) + u">"
@@ -1296,12 +1293,10 @@ def wizard_file(self):
12961293
bolt.SubProgress(progress,0,0.9), recurse=True)
12971294
return unpack_dir.join(self.hasWizard)
12981295

1299-
def fomod_files(self):
1296+
def fomod_file(self):
13001297
with balt.Progress(_(u'Extracting fomod files...'), u'\n' + u' ' * 60,
13011298
abort=True) as progress:
13021299
files_to_extract = [self.has_fomod_conf]
1303-
if self.has_fomod_info:
1304-
files_to_extract.append(self.has_fomod_info)
13051300
files_to_extract.extend(x for (x, _s, _c) in self.fileSizeCrcs if
13061301
x.lower().endswith((
13071302
u'bmp', u'jpg', u'jpeg', u'png',
@@ -1311,11 +1306,7 @@ def fomod_files(self):
13111306
unpack_dir = self.unpackToTemp(files_to_extract,
13121307
bolt.SubProgress(progress, 0, 0.9),
13131308
recurse=True)
1314-
if self.has_fomod_info:
1315-
return (unpack_dir.join(self.has_fomod_info),
1316-
unpack_dir.join(self.has_fomod_conf))
1317-
else:
1318-
return None, unpack_dir.join(self.has_fomod_conf)
1309+
return unpack_dir.join(self.has_fomod_conf)
13191310

13201311
#------------------------------------------------------------------------------
13211312
class InstallerProject(Installer):
@@ -1519,13 +1510,8 @@ def _open_txt_file(self, rel_path):
15191510
def wizard_file(self):
15201511
return bass.dirs['installers'].join(self.archive, self.hasWizard)
15211512

1522-
def fomod_files(self):
1523-
if self.has_fomod_info:
1524-
info = bass.dirs['installers'].join(self.archive, self.has_fomod_info)
1525-
else:
1526-
info = None
1527-
conf = bass.dirs['installers'].join(self.archive, self.has_fomod_conf)
1528-
return info, conf
1513+
def fomod_file(self):
1514+
return bass.dirs['installers'].join(self.archive, self.has_fomod_conf)
15291515

15301516
def projects_walk_cache(func): ##: HACK ! Profile
15311517
"""Decorator to make sure I dont leak self._dir_dirs_files project cache.

Mopy/bash/fomod.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -370,26 +370,10 @@ class FomodInstaller(object):
370370
after the installation process to keep track of flag and file changes,
371371
respectively.
372372
"""
373-
def __init__(self, info_path, conf_path, dest=None, game_version=None):
373+
def __init__(self, conf_path, dest=None, game_version=None):
374374
# read metadata
375375
conf_tree = etree.parse(conf_path)
376376
self.fomod_name = conf_tree.findtext('moduleName', '').strip()
377-
elem_image = conf_tree.find('moduleImage')
378-
if elem_image is None:
379-
self.fomod_image = ''
380-
else:
381-
self.fomod_image = elem_image.get('path', '')
382-
if info_path is not None: # info.xml is optional - has only metadata
383-
info_tree = etree.parse(info_path)
384-
self.fomod_author = info_tree.findtext('Author', '').strip()
385-
self.fomod_version = info_tree.findtext('Version', '').strip()
386-
self.fomod_description = info_tree.findtext('Description', '').strip()
387-
self.fomod_website = info_tree.findtext('Website', '').strip()
388-
else:
389-
self.fomod_author = ""
390-
self.fomod_version = ""
391-
self.fomod_description = ""
392-
self.fomod_website = ""
393377

394378
# setup the installer
395379
self.gen = self._installer(conf_tree, dest, game_version)

0 commit comments

Comments
 (0)