diff options
author | Simo Fält <simo.falt@qt.io> | 2018-08-27 09:19:08 +0300 |
---|---|---|
committer | Christian Tismer <tismer@stackless.com> | 2018-10-02 13:08:09 +0000 |
commit | e3e3caeba4aebd68dc301b23e89dc4f78d708d15 (patch) | |
tree | f3b663776d30a3835c291469760b2bcc1e830375 | |
parent | ace3452791d038fc2a042b420528a56be2e661aa (diff) |
Add python wrapper to call native tools
To install command to path, we need a python script which can be
used as an entry point in setup.py . This is sufficient.
On Windows, setuptools takes care of creating executable
files which are inserted into the "Scripts" folder.
Task-number: PYSIDE-779
Change-Id: Ic81087e10dfd98af65dfe07a68f351fca9f8637a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r-- | CMakeLists.txt | 14 | ||||
-rwxr-xr-x | pyside_tool.py | 53 |
2 files changed, 61 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d328654..5bb2f9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,12 +43,6 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pyside2-uic GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ) -# on win32 we cannot rely on the shebang for the shell to interpret the pyside2-uic command -if (WIN32) - file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/pyside2-uic.bat "python %~dp0pyside2-uic %*\n") - install (FILES ${CMAKE_CURRENT_BINARY_DIR}/pyside2-uic.bat DESTINATION bin) -endif () - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pyside2uic/__init__.py" DESTINATION "${SITE_PACKAGE}/pyside2uic") install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/pyside2uic @@ -85,6 +79,14 @@ set(PYSIDE2RCC_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/pyrcc/pyside2-rcc) add_subdirectory(pyrcc) add_subdirectory(pylupdate) +# pyside2-rcc, shiboken and pyside2-lupdate entrypoints +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/pyside_tool.py + DESTINATION bin + PERMISSIONS + OWNER_EXECUTE OWNER_WRITE OWNER_READ + GROUP_EXECUTE GROUP_READ + WORLD_EXECUTE WORLD_READ) + if (BUILD_TESTS) enable_testing() add_subdirectory(tests) diff --git a/pyside_tool.py b/pyside_tool.py new file mode 100755 index 0000000..8494c5d --- /dev/null +++ b/pyside_tool.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +############################################################################# +## +## Copyright (C) 2018 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of Qt for Python. +## +## $QT_BEGIN_LICENSE:LGPL$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 3 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL3 included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 3 requirements +## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 2.0 or (at your option) the GNU General +## Public license version 3 or any later version approved by the KDE Free +## Qt Foundation. The licenses are as published by the Free Software +## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-2.0.html and +## https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# +import sys +import os +import subprocess + +def main(): + # The tools listed as entrypoints in setup.py are copied to 'scripts/..' + cmd = os.path.join("..", os.path.basename(sys.argv[0])) + command = [os.path.join(os.path.dirname(os.path.realpath(__file__)), cmd)] + command.extend(sys.argv[1:]) + sys.exit(subprocess.call(command)) + +if __name__ == "__main__": + main() |