diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | helpers/__init__.py | 13 | ||||
-rw-r--r-- | music_sampler.py | 5 | ||||
-rw-r--r-- | music_sampler.spec | 9 |
4 files changed, 26 insertions, 2 deletions
@@ -2,3 +2,4 @@ build/ | |||
2 | dist/ | 2 | dist/ |
3 | helpers/__pycache__/ | 3 | helpers/__pycache__/ |
4 | __pycache__/ | 4 | __pycache__/ |
5 | .pyinstaller_commit | ||
diff --git a/helpers/__init__.py b/helpers/__init__.py index 0f819e7..f3e5967 100644 --- a/helpers/__init__.py +++ b/helpers/__init__.py | |||
@@ -9,6 +9,19 @@ def path(): | |||
9 | path = os.path.dirname(os.path.realpath(__file__)) | 9 | path = os.path.dirname(os.path.realpath(__file__)) |
10 | return path + "/../" | 10 | return path + "/../" |
11 | 11 | ||
12 | def parse_args(): | ||
13 | for arg in sys.argv: | ||
14 | if arg == "-v": | ||
15 | sys.argv.remove(arg) | ||
16 | |||
17 | if getattr(sys, 'frozen', False): | ||
18 | f = open(path() + ".pyinstaller_commit", "r") | ||
19 | print(f.read(), end="") | ||
20 | f.close() | ||
21 | else: | ||
22 | print("option '-v' can only be used in bundled package") | ||
23 | sys.exit() | ||
24 | |||
12 | def duration_to_min_sec(duration): | 25 | def duration_to_min_sec(duration): |
13 | minutes = int(duration / 60) | 26 | minutes = int(duration / 60) |
14 | seconds = int(duration) % 60 | 27 | seconds = int(duration) % 60 |
diff --git a/music_sampler.py b/music_sampler.py index 7bd7513..fd5bd90 100644 --- a/music_sampler.py +++ b/music_sampler.py | |||
@@ -1,3 +1,7 @@ | |||
1 | import helpers | ||
2 | |||
3 | helpers.parse_args() | ||
4 | |||
1 | import kivy | 5 | import kivy |
2 | kivy.require("1.9.1") | 6 | kivy.require("1.9.1") |
3 | from kivy.app import App | 7 | from kivy.app import App |
@@ -9,7 +13,6 @@ from kivy.core.window import Window | |||
9 | from kivy.lang import Builder | 13 | from kivy.lang import Builder |
10 | from helpers.key import Key | 14 | from helpers.key import Key |
11 | from helpers.mapping import Mapping | 15 | from helpers.mapping import Mapping |
12 | import helpers | ||
13 | 16 | ||
14 | class KeyList(RelativeLayout): | 17 | class KeyList(RelativeLayout): |
15 | keylist = ListProperty([]) | 18 | keylist = ListProperty([]) |
diff --git a/music_sampler.spec b/music_sampler.spec index ef949f2..7a885fd 100644 --- a/music_sampler.spec +++ b/music_sampler.spec | |||
@@ -1,14 +1,21 @@ | |||
1 | # -*- mode: python -*- | 1 | # -*- mode: python -*- |
2 | import os | ||
2 | from kivy.tools.packaging.pyinstaller_hooks import get_deps_minimal, hookspath, runtime_hooks | 3 | from kivy.tools.packaging.pyinstaller_hooks import get_deps_minimal, hookspath, runtime_hooks |
3 | 4 | ||
4 | excluded_and_hidden_modules = get_deps_minimal(video=None, camera=None, audio=None, clipboard=None, spelling=None) | 5 | excluded_and_hidden_modules = get_deps_minimal(video=None, camera=None, audio=None, clipboard=None, spelling=None) |
5 | excluded_and_hidden_modules['hiddenimports'] += [ 'six', 'packaging', 'packaging.version', 'packaging.specifiers', 'packaging.requirements'] | 6 | excluded_and_hidden_modules['hiddenimports'] += [ 'six', 'packaging', 'packaging.version', 'packaging.specifiers', 'packaging.requirements'] |
6 | 7 | ||
8 | commit_message = os.popen('git log -1 --format="%h %ci"').read() | ||
9 | pyinstaller_file = open(".pyinstaller_commit", "w") | ||
10 | pyinstaller_file.write(commit_message) | ||
11 | pyinstaller_file.close() | ||
12 | |||
7 | a = Analysis(['music_sampler.py'], | 13 | a = Analysis(['music_sampler.py'], |
8 | binaries=None, | 14 | binaries=None, |
9 | datas=[ | 15 | datas=[ |
10 | ('fonts/*', 'fonts'), | 16 | ('fonts/*', 'fonts'), |
11 | ('music_sampler.kv', '.') | 17 | ('music_sampler.kv', '.'), |
18 | ('.pyinstaller_commit', '.') | ||
12 | ], | 19 | ], |
13 | hookspath=hookspath(), | 20 | hookspath=hookspath(), |
14 | runtime_hooks=runtime_hooks(), | 21 | runtime_hooks=runtime_hooks(), |