diff --git a/README.rst b/README.rst index 42f0c8fd9..4983b3cbc 100644 --- a/README.rst +++ b/README.rst @@ -64,8 +64,8 @@ Note: Usage ----- -A program is provided available as ``Scripts/pyqt6-tools.exe`` or ``python -m pyqt6_tools``. -There are subcommands provided for each of Designer, QML Scene, and the QML Test Runner. +A program is provided available as ``Scripts/pyqt6-tools.exe``. There are +subcommands provided for each of Designer, QML Scene, and the QML Test Runner. These wrapper commands provide additional functionality related to launching the underlying programs. A larger set of Qt application are available as subcommands of the ``Scripts/qt6-tools.exe`` program. In both cases, passing @@ -81,6 +81,12 @@ environment variable ``DOT_ENV_DIRECTORY`` will be set to the directory containing the ``.env`` file. With this extra variable you can specify paths relative to the ``.env`` location. +There alternative ways to call ``Scripts/pyqt6-tools.exe``, ``python -m pyqt6_tools`` +works the same way but allows you to choose the version of python to run the tools +with. On Windows if you create a shortcut to `pyqt6-tools.exe`, it will show a +command prompt that stays open for the duration of the launched application. You +can address this by using ``Scripts/pyqt6-toolsw.exe`` or ``pythonw -m pyqt6_tools``. + .. code-block:: powershell PYQTDESIGNERPATH=${PYQTDESIGNERPATH};${DOT_ENV_DIRECTORY}/path/to/my/widgets diff --git a/setup.py b/setup.py index f13f09d5a..94f3eb3e2 100644 --- a/setup.py +++ b/setup.py @@ -55,6 +55,7 @@ def pad_version(v, segment_count=3): ["Qt6", "Qt5"], ["Qt6", "Qt 5"], ["6.4", "5.15"], + ["pyuic6", "pyuic5"], ] for a, b in replacements: readme = readme.replace(a, b) @@ -108,6 +109,9 @@ def pad_version(v, segment_count=3): entry_points={ 'console_scripts': [ 'pyqt{major}-tools = pyqt{major}_tools.entrypoints:main'.format(major=pyqt_major_version), + ], + 'gui_scripts': [ + 'pyqt{major}-toolsw = pyqt{major}_tools.entrypoints:main'.format(major=pyqt_major_version), ] } ) diff --git a/src/pyqt_tools/tests/test_entrypoints.py b/src/pyqt_tools/tests/test_entrypoints.py index b2cdb2b10..9a7a11a4b 100644 --- a/src/pyqt_tools/tests/test_entrypoints.py +++ b/src/pyqt_tools/tests/test_entrypoints.py @@ -23,7 +23,15 @@ fspath = getattr(os, 'fspath', str) scripts_path = pathlib.Path(sysconfig.get_path("scripts")) -executable_path_string = fspath(scripts_path.joinpath("pyqt{}-tools".format(major))) +# Use parametrize to test each method for launching pyqt-tools in a subprocess +executable_paths = ( + "cmd", + [ + [fspath(scripts_path.joinpath("pyqt{}-tools".format(major)))], + [fspath(scripts_path.joinpath("pyqt{}-toolsw".format(major)))], + [sys.executable, "-m", "pyqt{}_tools".format(major)], + ] +) vars_to_print = [ *pyqt_plugins.utilities.diagnostic_variables_to_print, @@ -41,7 +49,8 @@ def environment_fixture(): return environment -def test_designer_creates_test_widget(tmp_path, environment): +@pytest.mark.parametrize(*executable_paths) +def test_designer_creates_test_widget(tmp_path, environment, cmd): file_path = tmp_path/'tigger' environment[pyqt_plugins.tests.testbutton.test_path_env_var] = fspath(file_path) @@ -60,10 +69,7 @@ def test_designer_creates_test_widget(tmp_path, environment): with pytest.raises(subprocess.TimeoutExpired): subprocess.run( - [ - executable_path_string, - 'designer', - ], + cmd + ['designer'], check=True, env=environment, timeout=40, @@ -127,7 +133,8 @@ def test_qmlscene_paints_test_item(tmp_path, environment): reason="accepting failure until we figure out the problem".format(string_version), strict=True, ) -def test_qmltestrunner_paints_test_item(tmp_path, environment): +@pytest.mark.parametrize(*executable_paths) +def test_qmltestrunner_paints_test_item(tmp_path, environment, cmd): file_path = tmp_path/'piglet' environment[pyqt_plugins.examples.exampleqmlitem.test_path_env_var] = fspath(file_path) @@ -139,7 +146,7 @@ def test_qmltestrunner_paints_test_item(tmp_path, environment): subprocess.run( [ - executable_path_string, + cmd, 'qmltestrunner', '--', '-input', @@ -156,12 +163,13 @@ def test_qmltestrunner_paints_test_item(tmp_path, environment): ) -def test_installuic_does_not_fail(environment): +@pytest.mark.parametrize(*executable_paths) +def test_installuic_does_not_fail(environment, cmd): pyqt_plugins.utilities.print_environment_variables(environment, *vars_to_print) subprocess.run( [ - executable_path_string, + cmd, 'installuic', ], check=True,