setup.py - how should such a file be structured?
-
wrote on 15 Jul 2020, 18:04 last edited by
Hello,
I am still dealing with the deployment of a Python Qt application.
I discovered that you can create a setup.py file.
My goal:
I would like to query the operating system in setup.py and call the correct command depending on the operating system to install Qt.
I tried the following:
import os import sys from distutils.core import setup setup(name='PQT-Texteditor', version='1.0', description='Barrierefreier Texteditor der plattformunabhängig ist', author='Markus Lemcke', author_email='info@marlem-software.de', url='https://www.marlem-software.de', ) def betriebssystemabfragen(): name_des_betriebssystems = sys.platform return name_des_betriebssystems def qtinstallieren(): name_des_betriebssystems = betriebssystemabfragen if name_des_betriebssystems == "win32": print("Das aktuelle Betriebssystems ist Windows!") else: if name_des_betriebssystems == "linux": print("Das aktuelle Betriebssystems ist Linux!") if __name__ == '__main__': qtinstallieren If I call setup.py like this: python setup.py install qtinstall is not executed. Why?
-
Hi,
You should rather list PySide2 or PyQt5 as dependencies of your application so they will be automatically installed.
-
wrote on 15 Jul 2020, 18:17 last edited by
@SGaist said in setup.py - how should such a file be structured?:
dependencies
Thank you for your fast answer.
what do I have to search for in the search engine to find an example of this?
-
Python setup.py dependencies
You will get this nice tutorial
-
wrote on 15 Jul 2020, 18:57 last edited by
You are a giant!
That's working:import os import sys from setuptools import setup setup(name='PQT-Texteditor', version='1.0', description='Barrierefreier Texteditor der plattformunabhängig ist', author='Markus Lemcke', author_email='info@marlem-software.de', url='https://www.marlem-software.de', install_requires=['PyQt5'], )
Thank you so much!
-
You're welcome !
Since you have it working now, please mark the thread as solved using the "Topic Tools" button or the three doted menu beside the answer you deem correct so that other forum users may know a solution has been found.
1/6