Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. setup.py - how should such a file be structured?
Forum Updated to NodeBB v4.3 + New Features

setup.py - how should such a file be structured?

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
6 Posts 2 Posters 417 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PythonQTMarlem
    wrote on 15 Jul 2020, 18:04 last edited by
    #1

    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?
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 15 Jul 2020, 18:07 last edited by
      #2

      Hi,

      You should rather list PySide2 or PyQt5 as dependencies of your application so they will be automatically installed.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • P Offline
        P Offline
        PythonQTMarlem
        wrote on 15 Jul 2020, 18:17 last edited by
        #3

        @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?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 15 Jul 2020, 18:22 last edited by
          #4

          Python setup.py dependencies

          You will get this nice tutorial

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • P Offline
            P Offline
            PythonQTMarlem
            wrote on 15 Jul 2020, 18:57 last edited by
            #5

            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!

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 15 Jul 2020, 19:13 last edited by
              #6

              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.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              1/6

              15 Jul 2020, 18:04

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved