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. Create Setup.py file with PyCharm
Forum Updated to NodeBB v4.3 + New Features

Create Setup.py file with PyCharm

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
7 Posts 4 Posters 1.1k 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 14 Jul 2020, 20:33 last edited by PythonQTMarlem
    #1

    Hello,

    I program with PyCharm 2020.1.3, Python Python 3.7.6
    and Qt version 5.9.7
    I want to create a Setup.py file using PyCharm.
    I would like to query the operating system in Setup.py
    and execute the correct command depending on the operating system
    Install Qt.

    Question:
    How do I do something or where can I find information about this?

    J J 2 Replies Last reply 15 Jul 2020, 06:42
    0
    • P PythonQTMarlem
      14 Jul 2020, 20:33

      Hello,

      I program with PyCharm 2020.1.3, Python Python 3.7.6
      and Qt version 5.9.7
      I want to create a Setup.py file using PyCharm.
      I would like to query the operating system in Setup.py
      and execute the correct command depending on the operating system
      Install Qt.

      Question:
      How do I do something or where can I find information about this?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 15 Jul 2020, 06:42 last edited by
      #2

      @PythonQTMarlem

      import platform
      platform.system()
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P PythonQTMarlem
        14 Jul 2020, 20:33

        Hello,

        I program with PyCharm 2020.1.3, Python Python 3.7.6
        and Qt version 5.9.7
        I want to create a Setup.py file using PyCharm.
        I would like to query the operating system in Setup.py
        and execute the correct command depending on the operating system
        Install Qt.

        Question:
        How do I do something or where can I find information about this?

        J Offline
        J Offline
        JonB
        wrote on 15 Jul 2020, 07:12 last edited by
        #3

        @PythonQTMarlem
        @jsulm's platform.system() may be fine, I don't know. Personally I used

        import os
        
        def isWindows() -> bool:
            # return whether the current OS is Windows
            return os.name == "nt"
        
        
        def isLinux() -> bool:
            # return whether the current OS is Linux
            return os.name == "posix"
        
        1 Reply Last reply
        1
        • P Offline
          P Offline
          PythonQTMarlem
          wrote on 15 Jul 2020, 09:05 last edited by PythonQTMarlem
          #4

          Thank you for both answers.
          What I'm still interested in:
          If I want to create a Setup.py file in PyCharm, is there a certain procedure or can I simply create a new file called setup.py?

          I made operating system queries like this:
          def operatingsystemqueries ():

          os_info = sys.platform
          print ("operating system:" + os_info)
          

          Possible expenses:
          Issue 1: Operating System: win32 Issue 2: Operating System: linux

          @jonB
          Is your method better?

          J 1 Reply Last reply 15 Jul 2020, 09:24
          0
          • P PythonQTMarlem
            15 Jul 2020, 09:05

            Thank you for both answers.
            What I'm still interested in:
            If I want to create a Setup.py file in PyCharm, is there a certain procedure or can I simply create a new file called setup.py?

            I made operating system queries like this:
            def operatingsystemqueries ():

            os_info = sys.platform
            print ("operating system:" + os_info)
            

            Possible expenses:
            Issue 1: Operating System: win32 Issue 2: Operating System: linux

            @jonB
            Is your method better?

            J Offline
            J Offline
            JonB
            wrote on 15 Jul 2020, 09:24 last edited by
            #5

            @PythonQTMarlem said in Create Setup.py file with PyCharm:

            Is your method better?

            Nope, they are all fine, they just produce different strings. I happen to notice that @jsulm's platform.system() produces Linux with a capital L, so you'd have to be careful checking in Python.

            If I want to create a Setup.py file in PyCharm, is there a certain procedure or can I simply create a new file called setup.py?

            You can just go File > New..., pick Python file type, give it a name. Then PyCharm has added it right into your project.

            1 Reply Last reply
            1
            • P Offline
              P Offline
              PythonQTMarlem
              wrote on 15 Jul 2020, 09:38 last edited by
              #6

              @JonB said in Create Setup.py file with PyCharm:

              You can just go File > New..., pick Python file type, give it a name. Then PyCharm has added it right into your project.

              Thank you!

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

                Hi,

                As posted in your other thread, unless you have very specific needs, installing dependencies should be done using python's package manager. Use a proper dependency list to trigger their installation.

                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

                1/7

                14 Jul 2020, 20:33

                • Login

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