summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2020-01-02 00:55:55 +0100
committeremkael <emkael@tlen.pl>2020-01-02 00:55:55 +0100
commit8ec9f68131ff3ff6f3dab3af5f27fa25e6d66f45 (patch)
tree3e15f1bb69f26b4f4dfa4b9dec72176abe6e671c
parent18c8b492ae89319163c4d11d489bf404b6c58e52 (diff)
Adjustments to the result info client model to make it usable with PyInstallerv2.1.0
-rw-r--r--hook-jfr_playoff.data.py5
-rw-r--r--jfr_playoff/data/info.py15
-rw-r--r--jfr_playoff/data/match/__init__.py7
-rw-r--r--jfr_playoff/data/tournament/__init__.py7
-rw-r--r--playoff-gui.spec4
-rw-r--r--playoff.spec5
6 files changed, 28 insertions, 15 deletions
diff --git a/hook-jfr_playoff.data.py b/hook-jfr_playoff.data.py
new file mode 100644
index 0000000..18d838d
--- /dev/null
+++ b/hook-jfr_playoff.data.py
@@ -0,0 +1,5 @@
+from PyInstaller.utils.hooks import collect_submodules
+hiddenimports = (
+ collect_submodules('jfr_playoff.data.tournament') +
+ collect_submodules('jfr_playoff.data.match')
+)
diff --git a/jfr_playoff/data/info.py b/jfr_playoff/data/info.py
index 342a878..55cc926 100644
--- a/jfr_playoff/data/info.py
+++ b/jfr_playoff/data/info.py
@@ -1,7 +1,5 @@
import copy
-import glob
import inspect
-from os.path import dirname, basename, isfile, join
from urlparse import urljoin
from jfr_playoff.dto import Match, Team
@@ -35,14 +33,11 @@ class ResultInfo(object):
@property
def _client_classes(self):
module = __import__(self.submodule_path, fromlist=[''])
- for f in glob.glob(join(dirname(module.__file__), "*.py")):
- if isfile(f) and not f.endswith('__init__.py'):
- submodule_name = basename(f)[:-3]
- submodule_path = self.submodule_path + '.' + submodule_name
- submodule = __import__(submodule_path, fromlist=[''])
- for member in inspect.getmembers(submodule, inspect.isclass):
- if member[1].__module__ == submodule_path:
- yield member[1]
+ for submodule_path in module.CLIENTS:
+ submodule = __import__(submodule_path, fromlist=[''])
+ for member in inspect.getmembers(submodule, inspect.isclass):
+ if member[1].__module__ == submodule_path:
+ yield member[1]
def _fill_client_list(self, *args):
all_clients = [c(*args) for c in self._client_classes]
diff --git a/jfr_playoff/data/match/__init__.py b/jfr_playoff/data/match/__init__.py
index 6137078..b397be6 100644
--- a/jfr_playoff/data/match/__init__.py
+++ b/jfr_playoff/data/match/__init__.py
@@ -13,3 +13,10 @@ class MatchInfoClient(ResultInfoClient):
def running_link(self):
raise NotImplementedError
+
+
+CLIENTS = [
+ 'jfr_playoff.data.match.jfrdb',
+ 'jfr_playoff.data.match.jfrhtml',
+ 'jfr_playoff.data.match.tcjson'
+]
diff --git a/jfr_playoff/data/tournament/__init__.py b/jfr_playoff/data/tournament/__init__.py
index 792f634..996a399 100644
--- a/jfr_playoff/data/tournament/__init__.py
+++ b/jfr_playoff/data/tournament/__init__.py
@@ -10,3 +10,10 @@ class TournamentInfoClient(ResultInfoClient):
def get_tournament_results(self):
raise NotImplementedError
+
+
+CLIENTS = [
+ 'jfr_playoff.data.tournament.jfrdb',
+ 'jfr_playoff.data.tournament.jfrhtml',
+ 'jfr_playoff.data.tournament.tcjson'
+]
diff --git a/playoff-gui.spec b/playoff-gui.spec
index f80f0a4..d59a9c7 100644
--- a/playoff-gui.spec
+++ b/playoff-gui.spec
@@ -8,10 +8,10 @@ icon_path = os.path.join('jfr_playoff', 'gui', 'icons')
datas = [(icon_path, os.path.join('res', 'icons'))]
a = Analysis(['gui.py'],
- pathex=[os.path.abspath('.')],
+ pathex=[SPECPATH],
datas=datas,
hiddenimports=['mysql.connector.locales.eng.client_error'],
- hookspath=[],
+ hookspath=['.'],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
diff --git a/playoff.spec b/playoff.spec
index 6ef27ca..337be2b 100644
--- a/playoff.spec
+++ b/playoff.spec
@@ -1,8 +1,7 @@
-import os
a = Analysis(['playoff.py'],
- pathex=[os.path.abspath('.')],
+ pathex=[SPECPATH],
hiddenimports=['mysql.connector.locales.eng.client_error'],
- hookspath=None,
+ hookspath=['.'],
runtime_hooks=None,
excludes=None)
pyz = PYZ(a.pure)