Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-630

setup.py errors if setup.py not in CWD

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.6, 5.9
    • PySide
    • None
    • f9cae4967ee543685729bc1af682b299144ee9d8, 2ae5f1d37bfe8757836a5c091a032ba94760bda0

    Description

      if you call e.g.

      python pyside-setup/setup.py

      instead of calling

      python setup.py

      , the build will fail:

      Traceback (most recent call last):
        File "./pyside-setup/setup.py", line 250, in <module>
          check_allowed_python_version()
        File "./pyside-setup/setup.py", line 238, in check_allowed_python_version
          with open(__file__) as setup:
      FileNotFoundError: [Errno 2] No such file or directory: 'pyside-setup/setup.py'
      

      Unfortunately, I'm not set up with gerrit on this machine.. and so I'm just reporting the issue here along with the fix:

      diff --git a/setup.py b/setup.py
      index 35746e65..abc8d9e5 100644
      --- a/setup.py
      +++ b/setup.py
      @@ -235,7 +235,7 @@ def check_allowed_python_version():
           import re
           pattern = "'Programming Language :: Python :: (\d+)\.(\d+)'"
           supported = []
      -    with open(__file__) as setup:
      +    with open(this_file) as setup:
               for line in setup.readlines():
                   found = re.search(pattern, line)
                   if found:
      

      Here's a gist walking through step-by-step the problem and solving it:
      https://gist.github.com/fredrikaverpil/fb6204d2fcc252cbcd8194dff732f22d

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            alexandru.croitor Alexandru Croitor
            fredrikaverpil Fredrik Averpil
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes