ColinDuquesnoy / QDarkStyleSheet

A dark style sheet for QtWidgets application
Other
2.83k stars 730 forks source link

Run scripts to generate files on server (tox/Travis) #226

Open dpizetta opened 4 years ago

dpizetta commented 4 years ago

Generate files (qss and compiled versions) on Travis, so we do not need to update every time we change .scss files and also guarantee an updated status, making PR easier.

tsilia commented 4 years ago

Do you have the log or the errors you faced? This can help us o provide better scripts. If you have, please, comment in the #226 so I can take into account when providing the compilation on the server.

I read the CONTRIBUTING.rst file and it wasn't clear to me how to regenerate style.qss from .scss files. But I'm almost sure I'm doing it wrong as I'm not very much into Python :confused:

I tried to run scripts/process_qrc.py and got the following output:

$ ./process_qrc.py 
./process_qrc.py: line 24: Script to process QRC files (convert .qrc to _rc.py and .rcc).

The script will attempt to compile the qrc file using the following tools:

    - pyrcc4 for PyQt4 and PyQtGraph (Python)
    - pyrcc5 for PyQt5 and QtPy (Python)
    - pyside-rcc for PySide (Python)
    - pyside2-rcc for PySide2 (Python)
    - rcc for Qt4 and Qt5 (C++)

Delete the compiled files that you don't want to use manually after
running this script.

Links to understand those tools:

    - pyrcc4: http://pyqt.sourceforge.net/Docs/PyQt4/resources.html#pyrcc4
    - pyrcc5: http://pyqt.sourceforge.net/Docs/PyQt5/resources.html#pyrcc5
    - pyside-rcc: https://www.mankier.com/1/pyside-rcc
    - pyside2-rcc: https://doc.qt.io/qtforpython/overviews/resources.html (Documentation Incomplete)
    - rcc on Qt4: http://doc.qt.io/archives/qt-4.8/rcc.html
    - rcc on Qt5: http://doc.qt.io/qt-5/rcc.html

: File name too long
from: can't read /var/mail/__future__
from: can't read /var/mail/subprocess
./process_qrc.py: line 30: import: command not found
./process_qrc.py: line 31: import: command not found
./process_qrc.py: line 32: import: command not found
./process_qrc.py: line 33: import: command not found
from: can't read /var/mail/watchdog.events
from: can't read /var/mail/watchdog.observers
from: can't read /var/mail/qdarkstyle
from: can't read /var/mail/qdarkstyle.utils.images
from: can't read /var/mail/qdarkstyle.utils.scss
./process_qrc.py: line 45: syntax error near unexpected token `('
./process_qrc.py: line 45: `class QSSFileHandler(FileSystemEventHandler):'

I also tried to run scripts/run_ui_css_edition.py and got the following output:

$ ./run_ui_css_edition.py 
Dark not running!
No Dark not running!
['./run_ui_css_edition.py']
python: can't open file '/home/ilya/QDarkStyleSheet/scripts/process_images.py': [Errno 2] No such file or directory
Traceback (most recent call last):
  File "/home/ilya/QDarkStyleSheet/scripts/process_qrc.py", line 36, in <module>
    from watchdog.events import FileSystemEventHandler
ImportError: No module named watchdog.events
Changing directory to:  /home/ilya/QDarkStyleSheet/example/ui
Converting .ui to .py ...
mw_menus ...
Compiling using pyuic5 ...
Creating also for qtpy ...
dw_containers_no_tabs ...
Compiling using pyuic5 ...
Creating also for qtpy ...
dw_displays ...
Compiling using pyuic5 ...
Creating also for qtpy ...
dw_views ...
Compiling using pyuic5 ...
Creating also for qtpy ...
dw_inputs_no_fields ...
Compiling using pyuic5 ...
Creating also for qtpy ...
dw_buttons ...
Compiling using pyuic5 ...
Creating also for qtpy ...
dw_inputs_fields ...
Compiling using pyuic5 ...
Creating also for qtpy ...
dw_containers_tabs ...
Compiling using pyuic5 ...
Creating also for qtpy ...
dw_widgets ...
Compiling using pyuic5 ...
Creating also for qtpy ...
Traceback (most recent call last):
  File "/home/ilya/QDarkStyleSheet/example/example.py", line 371, in <module>
    sys.exit(main())
  File "/home/ilya/QDarkStyleSheet/example/example.py", line 101, in main
    from qtpy import API_NAME, QT_VERSION, PYQT_VERSION, PYSIDE_VERSION
ImportError: No module named qtpy
Traceback (most recent call last):
  File "/home/ilya/QDarkStyleSheet/example/example.py", line 371, in <module>
    sys.exit(main())
  File "/home/ilya/QDarkStyleSheet/example/example.py", line 101, in main
    from qtpy import API_NAME, QT_VERSION, PYQT_VERSION, PYSIDE_VERSION
ImportError: No module named qtpy
Traceback (most recent call last):
  File "/home/ilya/QDarkStyleSheet/example/example.py", line 371, in <module>
    sys.exit(main())
  File "/home/ilya/QDarkStyleSheet/example/example.py", line 101, in main
    from qtpy import API_NAME, QT_VERSION, PYQT_VERSION, PYSIDE_VERSION
ImportError: No module named qtpy
Traceback (most recent call last):
  File "/home/ilya/QDarkStyleSheet/example/example.py", line 371, in <module>
    sys.exit(main())
  File "/home/ilya/QDarkStyleSheet/example/example.py", line 101, in main
    from qtpy import API_NAME, QT_VERSION, PYQT_VERSION, PYSIDE_VERSION
ImportError: No module named qtpy
Unf! It not worked! Please, check the error(s).

I tried to Setup virtual environent following the Getting started section of the CONTRIBUTING.rst and got the following:

~/QDarkStyleSheet$ pip install -e .
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Obtaining file:///home/ilya/QDarkStyleSheet
Processing /home/ilya/.cache/pip/wheels/04/e6/38/1391340905cb99109c0ddeac7dc1dea6e8b6c44fdcc8b29efe/helpdev-0.6.10-py2-none-any.whl
Collecting qtpy>=1.7
  Using cached QtPy-1.9.0-py2.py3-none-any.whl (54 kB)
Collecting psutil>=5.6
  Using cached psutil-5.7.0.tar.gz (449 kB)
Requirement already satisfied: importlib-metadata in /home/ilya/.venv/lib/python2.7/site-packages (from helpdev>=0.6.2->QDarkStyle==2.8) (1.5.0)
Requirement already satisfied: contextlib2; python_version < "3" in /home/ilya/.venv/lib/python2.7/site-packages (from importlib-metadata->helpdev>=0.6.2->QDarkStyle==2.8) (0.6.0.post1)
Requirement already satisfied: zipp>=0.5 in /home/ilya/.venv/lib/python2.7/site-packages (from importlib-metadata->helpdev>=0.6.2->QDarkStyle==2.8) (1.2.0)
Requirement already satisfied: configparser>=3.5; python_version < "3" in /home/ilya/.venv/lib/python2.7/site-packages (from importlib-metadata->helpdev>=0.6.2->QDarkStyle==2.8) (4.0.2)
Requirement already satisfied: pathlib2; python_version < "3" in /home/ilya/.venv/lib/python2.7/site-packages (from importlib-metadata->helpdev>=0.6.2->QDarkStyle==2.8) (2.3.5)
Requirement already satisfied: scandir; python_version < "3.5" in /home/ilya/.venv/lib/python2.7/site-packages (from pathlib2; python_version < "3"->importlib-metadata->helpdev>=0.6.2->QDarkStyle==2.8) (1.10.0)
Requirement already satisfied: six in /home/ilya/.venv/lib/python2.7/site-packages (from pathlib2; python_version < "3"->importlib-metadata->helpdev>=0.6.2->QDarkStyle==2.8) (1.14.0)
Building wheels for collected packages: psutil
  Building wheel for psutil (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/ilya/.venv/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-Xt0r6w/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-Xt0r6w/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-7PqEF2
       cwd: /tmp/pip-install-Xt0r6w/psutil/
  Complete output (44 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/psutil
  copying psutil/_common.py -> build/lib.linux-x86_64-2.7/psutil
  copying psutil/_psposix.py -> build/lib.linux-x86_64-2.7/psutil
  copying psutil/__init__.py -> build/lib.linux-x86_64-2.7/psutil
  copying psutil/_psaix.py -> build/lib.linux-x86_64-2.7/psutil
  copying psutil/_pswindows.py -> build/lib.linux-x86_64-2.7/psutil
  copying psutil/_compat.py -> build/lib.linux-x86_64-2.7/psutil
  copying psutil/_psosx.py -> build/lib.linux-x86_64-2.7/psutil
  copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.7/psutil
  copying psutil/_pslinux.py -> build/lib.linux-x86_64-2.7/psutil
  copying psutil/_pssunos.py -> build/lib.linux-x86_64-2.7/psutil
  creating build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/__init__.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/test_system.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/runner.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/test_process.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/__main__.py -> build/lib.linux-x86_64-2.7/psutil/tests
  copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-2.7/psutil/tests
  running build_ext
  building 'psutil._psutil_linux' extension
  creating build/temp.linux-x86_64-2.7
  creating build/temp.linux-x86_64-2.7/psutil
  x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-5Z483E/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=570 -DPSUTIL_LINUX=1 -I/usr/include/python2.7 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_common.o
  psutil/_psutil_common.c:9:10: fatal error: Python.h: No such file or directory
   #include <Python.h>
            ^~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for psutil
  Running setup.py clean for psutil
Failed to build psutil
Installing collected packages: psutil, helpdev, qtpy, QDarkStyle
    Running setup.py install for psutil ... error
    ERROR: Command errored out with exit status 1:
     command: /home/ilya/.venv/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-Xt0r6w/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-Xt0r6w/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-bc5HJU/install-record.txt --single-version-externally-managed --compile --install-headers /home/ilya/.venv/include/site/python2.7/psutil
         cwd: /tmp/pip-install-Xt0r6w/psutil/
    Complete output (44 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/psutil
    copying psutil/_common.py -> build/lib.linux-x86_64-2.7/psutil
    copying psutil/_psposix.py -> build/lib.linux-x86_64-2.7/psutil
    copying psutil/__init__.py -> build/lib.linux-x86_64-2.7/psutil
    copying psutil/_psaix.py -> build/lib.linux-x86_64-2.7/psutil
    copying psutil/_pswindows.py -> build/lib.linux-x86_64-2.7/psutil
    copying psutil/_compat.py -> build/lib.linux-x86_64-2.7/psutil
    copying psutil/_psosx.py -> build/lib.linux-x86_64-2.7/psutil
    copying psutil/_psbsd.py -> build/lib.linux-x86_64-2.7/psutil
    copying psutil/_pslinux.py -> build/lib.linux-x86_64-2.7/psutil
    copying psutil/_pssunos.py -> build/lib.linux-x86_64-2.7/psutil
    creating build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/test_aix.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/__init__.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/test_contracts.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/test_system.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/test_osx.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/runner.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/test_unicode.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/test_posix.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/test_connections.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/test_process.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/test_misc.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/test_sunos.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/test_linux.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/test_bsd.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/__main__.py -> build/lib.linux-x86_64-2.7/psutil/tests
    copying psutil/tests/test_windows.py -> build/lib.linux-x86_64-2.7/psutil/tests
    running build_ext
    building 'psutil._psutil_linux' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/psutil
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-5Z483E/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=570 -DPSUTIL_LINUX=1 -I/usr/include/python2.7 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_common.o
    psutil/_psutil_common.c:9:10: fatal error: Python.h: No such file or directory
     #include <Python.h>
              ^~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/ilya/.venv/bin/python2 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-Xt0r6w/psutil/setup.py'"'"'; __file__='"'"'/tmp/pip-install-Xt0r6w/psutil/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-bc5HJU/install-record.txt --single-version-externally-managed --compile --install-headers /home/ilya/.venv/include/site/python2.7/psutil Check the logs for full command output.

I'm running Linux Mint 19.2, it uses Ubuntu 18.04's package repositories.

Well, I guess I just don't know how to run these scripts properly and set up the correct environment. Perhaps you could edit the Modifying QSS File section of CONTRIBUTING.rst and add an example command that just converts .scss files to a single .qss file.

Anyways, thank you @dpizetta and @goanpeca for your time and efforts! And this dark theme is awesome!

dpizetta commented 4 years ago

@tsilia thank you for the messages and comments, we will try to improve those. We appreciate your time too :)