From fd1364c0cfa68661cb7fc2a9355fbf6b60289611 Mon Sep 17 00:00:00 2001 From: Carlos Cordoba Date: Tue, 13 Jul 2021 16:11:08 -0500 Subject: [PATCH] Fix generating assets per operating system The shell kwarg to subprocess.call can't be True in Posix systems --- qdarkstyle/utils/__init__.py | 11 +++++++---- scripts/run_ui_css_edition.py | 7 ++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/qdarkstyle/utils/__init__.py b/qdarkstyle/utils/__init__.py index 1c2a6f2..844d308 100755 --- a/qdarkstyle/utils/__init__.py +++ b/qdarkstyle/utils/__init__.py @@ -40,6 +40,9 @@ def run_process(args, palette): main_dir = os.path.join(PACKAGE_PATH, palette.ID) os.chdir(main_dir) + # Shell kwarg to pass to subprocess. + shell = True if os.name == 'nt' else False + for qrc_file in glob.glob('*.qrc'): # get name without extension filename = os.path.splitext(qrc_file)[0] @@ -64,28 +67,28 @@ def run_process(args, palette): if args.create in ['pyqt', 'pyqtgraph', 'all']: print("Compiling for PyQt4 ...") try: - call(['pyrcc4', '-py3', qrc_file, '-o', py_file_pyqt], shell=True) + call(['pyrcc4', '-py3', qrc_file, '-o', py_file_pyqt], shell=shell) except FileNotFoundError: print("You must install pyrcc4") if args.create in ['pyqt5', 'qtpy', 'all']: print("Compiling for PyQt5 ...") try: - call(['pyrcc5', qrc_file, '-o', py_file_pyqt5], shell=True) + call(['pyrcc5', qrc_file, '-o', py_file_pyqt5], shell=shell) except FileNotFoundError: print("You must install pyrcc5") if args.create in ['pyside', 'all']: print("Compiling for PySide ...") try: - call(['pyside-rcc', '-py3', qrc_file, '-o', py_file_pyside], shell=True) + call(['pyside-rcc', '-py3', qrc_file, '-o', py_file_pyside], shell=shell) except FileNotFoundError: print("You must install pyside-rcc") if args.create in ['pyside2', 'all']: print("Compiling for PySide 2...") try: - call(['pyside2-rcc', qrc_file, '-o', py_file_pyside2], shell=True) + call(['pyside2-rcc', qrc_file, '-o', py_file_pyside2], shell=shell) except FileNotFoundError: print("You must install pyside2-rcc") diff --git a/scripts/run_ui_css_edition.py b/scripts/run_ui_css_edition.py index b105395..1abd58b 100755 --- a/scripts/run_ui_css_edition.py +++ b/scripts/run_ui_css_edition.py @@ -34,6 +34,7 @@ def main(): styled = None no_styled = None themes = {'Styled': styled, 'No styled': no_styled} + shell = True if os.name == 'nt' else False while True: for theme_name, theme_process in themes.items(): try: @@ -49,16 +50,16 @@ def main(): # Process qrc files process_qrc = os.path.join(SCRIPTS_PATH, '../qdarkstyle/utils/__main__.py') - call(['python', process_qrc], shell=True) + call(['python', process_qrc], shell=shell) # Show window example = os.path.join(SCRIPTS_PATH, '../qdarkstyle/example/__main__.py') # Open styled window - styled = call(['python', example, '--palette', palette] + sys.argv[1:], shell=True) + styled = call(['python', example, '--palette', palette] + sys.argv[1:], shell=shell) # Open unstyled window - no_styled = call(['python', example, '--palette', 'none'] + sys.argv[1:], shell=True) + no_styled = call(['python', example, '--palette', 'none'] + sys.argv[1:], shell=shell) if styled or no_styled: print('Unf! It not worked! Please, check the error(s).')