aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--helpers/__init__.py13
-rw-r--r--music_sampler.py5
-rw-r--r--music_sampler.spec9
4 files changed, 26 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 213ec35..0aa4e4c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ build/
2dist/ 2dist/
3helpers/__pycache__/ 3helpers/__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
12def 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
12def duration_to_min_sec(duration): 25def 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 @@
1import helpers
2
3helpers.parse_args()
4
1import kivy 5import kivy
2kivy.require("1.9.1") 6kivy.require("1.9.1")
3from kivy.app import App 7from kivy.app import App
@@ -9,7 +13,6 @@ from kivy.core.window import Window
9from kivy.lang import Builder 13from kivy.lang import Builder
10from helpers.key import Key 14from helpers.key import Key
11from helpers.mapping import Mapping 15from helpers.mapping import Mapping
12import helpers
13 16
14class KeyList(RelativeLayout): 17class 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 -*-
2import os
2from kivy.tools.packaging.pyinstaller_hooks import get_deps_minimal, hookspath, runtime_hooks 3from kivy.tools.packaging.pyinstaller_hooks import get_deps_minimal, hookspath, runtime_hooks
3 4
4excluded_and_hidden_modules = get_deps_minimal(video=None, camera=None, audio=None, clipboard=None, spelling=None) 5excluded_and_hidden_modules = get_deps_minimal(video=None, camera=None, audio=None, clipboard=None, spelling=None)
5excluded_and_hidden_modules['hiddenimports'] += [ 'six', 'packaging', 'packaging.version', 'packaging.specifiers', 'packaging.requirements'] 6excluded_and_hidden_modules['hiddenimports'] += [ 'six', 'packaging', 'packaging.version', 'packaging.specifiers', 'packaging.requirements']
6 7
8commit_message = os.popen('git log -1 --format="%h %ci"').read()
9pyinstaller_file = open(".pyinstaller_commit", "w")
10pyinstaller_file.write(commit_message)
11pyinstaller_file.close()
12
7a = Analysis(['music_sampler.py'], 13a = 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(),