diff options
author | Paweł Jastrzębski <pawelj@iosphe.re> | 2014-12-30 11:00:21 +0100 |
---|---|---|
committer | Paweł Jastrzębski <pawelj@iosphe.re> | 2014-12-30 11:00:21 +0100 |
commit | 36f8c82eaf2a539bb4571bf97309f9a30a4f0926 (patch) | |
tree | e41b8f4f7b3635be3deb55f5dea96ecae441f99e /kcc.py | |
parent | Merge pull request #119 from ciromattia/4.x (diff) | |
download | kcc-36f8c82eaf2a539bb4571bf97309f9a30a4f0926.tar.gz kcc-36f8c82eaf2a539bb4571bf97309f9a30a4f0926.tar.bz2 kcc-36f8c82eaf2a539bb4571bf97309f9a30a4f0926.zip |
Fixed OSX race condition
Diffstat (limited to 'kcc.py')
-rwxr-xr-x | kcc.py | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/kcc.py b/kcc.py index 296714a..0c963d3 100755 --- a/kcc.py +++ b/kcc.py @@ -24,10 +24,31 @@ __copyright__ = '2012-2014, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jas __docformat__ = 'restructuredtext en' import sys +import os if sys.version_info[0] != 3: print('ERROR: This is Python 3 script!') exit(1) +# OS specific PATH variable workarounds +if sys.platform.startswith('darwin') and 'RESOURCEPATH' not in os.environ: + os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + '/other/:' + os.environ['PATH'] +elif sys.platform.startswith('win'): + if getattr(sys, 'frozen', False): + os.chdir(os.path.dirname(os.path.abspath(sys.executable))) + + # Implementing dummy stdout and stderr for frozen Windows release + class FakeSTD(object): + def write(self, string): + pass + + def flush(self): + pass + sys.stdout = FakeSTD() + sys.stderr = FakeSTD() + else: + os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + '/other/;' + os.environ['PATH'] + os.chdir(os.path.dirname(os.path.abspath(__file__))) + # Dependency check missing = [] try: @@ -69,30 +90,9 @@ if len(missing) > 0: print('ERROR: ' + ', '.join(missing) + ' is not installed!') exit(1) -import os from multiprocessing import freeze_support from kcc import KCC_gui -# OS specific PATH variable workarounds -if sys.platform.startswith('darwin') and 'RESOURCEPATH' not in os.environ: - os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + '/other/:' + os.environ['PATH'] -elif sys.platform.startswith('win'): - if getattr(sys, 'frozen', False): - os.chdir(os.path.dirname(os.path.abspath(sys.executable))) - - # Implementing dummy stdout and stderr for frozen Windows release - class FakeSTD(object): - def write(self, string): - pass - - def flush(self): - pass - sys.stdout = FakeSTD() - sys.stderr = FakeSTD() - else: - os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + '/other/;' + os.environ['PATH'] - os.chdir(os.path.dirname(os.path.abspath(__file__))) - # Implementing detection of already running KCC instance and forwarding argv to it class QApplicationMessaging(QtWidgets.QApplication): |