]> git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/commitdiff
Add version number
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 27 Jun 2016 09:58:31 +0000 (11:58 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Mon, 27 Jun 2016 09:58:31 +0000 (11:58 +0200)
.gitignore
helpers/__init__.py
music_sampler.py
music_sampler.spec

index 213ec356a53ba6d4436477635233214843577a14..0aa4e4c80c84dbcf1d6b989e38bc549c3b80dea5 100644 (file)
@@ -2,3 +2,4 @@ build/
 dist/
 helpers/__pycache__/
 __pycache__/
+.pyinstaller_commit
index 0f819e793653744983f99702daef11df9a51af60..f3e59674ecfddb151ef730552187e0e858b37135 100644 (file)
@@ -9,6 +9,19 @@ def path():
         path = os.path.dirname(os.path.realpath(__file__))
         return path + "/../"
 
+def parse_args():
+    for arg in sys.argv:
+        if arg == "-v":
+            sys.argv.remove(arg)
+
+            if getattr(sys, 'frozen', False):
+                f = open(path() + ".pyinstaller_commit", "r")
+                print(f.read(), end="")
+                f.close()
+            else:
+                print("option '-v' can only be used in bundled package")
+            sys.exit()
+
 def duration_to_min_sec(duration):
     minutes = int(duration / 60)
     seconds = int(duration) % 60
index 7bd7513d738e8c33c33d3a5e6bd9aaed8172bd76..fd5bd908daf3b81ebe67f9e0b7128d451278e932 100644 (file)
@@ -1,3 +1,7 @@
+import helpers
+
+helpers.parse_args()
+
 import kivy
 kivy.require("1.9.1")
 from kivy.app import App
@@ -9,7 +13,6 @@ from kivy.core.window import Window
 from kivy.lang import Builder
 from helpers.key import Key
 from helpers.mapping import Mapping
-import helpers
 
 class KeyList(RelativeLayout):
     keylist = ListProperty([])
index ef949f201fb8b6b30b397961b8e0b144145e007a..7a885fd5ac837da5b90142debaf6531057214610 100644 (file)
@@ -1,14 +1,21 @@
 # -*- mode: python -*-
+import os
 from kivy.tools.packaging.pyinstaller_hooks import  get_deps_minimal, hookspath, runtime_hooks
 
 excluded_and_hidden_modules = get_deps_minimal(video=None, camera=None, audio=None, clipboard=None, spelling=None)
 excluded_and_hidden_modules['hiddenimports'] += [ 'six', 'packaging', 'packaging.version', 'packaging.specifiers', 'packaging.requirements']
 
+commit_message = os.popen('git log -1 --format="%h  %ci"').read()
+pyinstaller_file = open(".pyinstaller_commit", "w")
+pyinstaller_file.write(commit_message)
+pyinstaller_file.close()
+
 a = Analysis(['music_sampler.py'],
              binaries=None,
              datas=[
               ('fonts/*', 'fonts'),
-              ('music_sampler.kv', '.')
+              ('music_sampler.kv', '.'),
+              ('.pyinstaller_commit', '.')
              ],
              hookspath=hookspath(),
              runtime_hooks=runtime_hooks(),