Skip to content

Commit

Permalink
Fixed issue with malformed packages (close #25)
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Oct 8, 2019
1 parent 65958cc commit 724b1a7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion CB/Core.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def update_config(self):
if addon['Name'] == 'TukUI':
addon['Name'] = 'Tukui'
addon['URL'] = 'Tukui'
# 2.7.3
addon['Directories'] = list(filter(None, set(addon['Directories'])))
# 1.3.0
if 'URLCache' in self.config.keys():
self.config.pop('URLCache', None)
Expand Down Expand Up @@ -112,7 +114,7 @@ def check_if_dev(self, url):
return False

def cleanup(self, directories):
if len(directories) > 0 and directories != ['']:
if len(directories) > 0:
for directory in directories:
shutil.rmtree(self.path / directory, ignore_errors=True)

Expand Down
4 changes: 2 additions & 2 deletions CB/CurseForge.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def get_addon(self):
for file in self.archive.namelist():
if '/' not in os.path.dirname(file):
self.directories.append(os.path.dirname(file))
self.directories = list(set(self.directories))
if len(self.directories) == 0 or self.directories == ['']:
self.directories = list(filter(None, set(self.directories)))
if len(self.directories) == 0:
raise RuntimeError(f'{self.name}.\nProject package is corrupted or incorrectly packaged.')

def install(self, path):
Expand Down
3 changes: 2 additions & 1 deletion CB/GitLab.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def get_addon(self):
file_info = self.archive.getinfo(file)
if file_info.is_dir() and file_info.filename.count('/') == 2 and '.gitlab' not in file_info.filename:
self.directories.append(file_info.filename.split('/')[1])
if len(self.directories) == 0 or self.directories == ['']:
self.directories = list(filter(None, set(self.directories)))
if len(self.directories) == 0:
raise RuntimeError(f'{self.name}.\nProject package is corrupted or incorrectly packaged.')

def install(self, path):
Expand Down
4 changes: 2 additions & 2 deletions CB/Tukui.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def get_addon(self):
for file in self.archive.namelist():
if '/' not in os.path.dirname(file):
self.directories.append(os.path.dirname(file))
self.directories = list(set(self.directories))
if len(self.directories) == 0 or self.directories == ['']:
self.directories = list(filter(None, set(self.directories)))
if len(self.directories) == 0:
raise RuntimeError(f'{self.name}.\nProject package is corrupted or incorrectly packaged.')

def install(self, path):
Expand Down
4 changes: 2 additions & 2 deletions CB/WoWInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def get_addon(self):
for file in self.archive.namelist():
if '/' not in os.path.dirname(file):
self.directories.append(os.path.dirname(file))
self.directories = list(set(self.directories))
if len(self.directories) == 0 or self.directories == ['']:
self.directories = list(filter(None, set(self.directories)))
if len(self.directories) == 0:
raise RuntimeError(f'{self.name}.\nProject package is corrupted or incorrectly packaged.')

def install(self, path):
Expand Down
2 changes: 1 addition & 1 deletion CB/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import string
import random

__version__ = '2.7.2'
__version__ = '2.7.3'
__license__ = 'GPLv3'
__copyright__ = '2019, Paweł Jastrzębski <[email protected]>'
__docformat__ = 'restructuredtext en'
Expand Down

0 comments on commit 724b1a7

Please sign in to comment.