Skip to content

Instantly share code, notes, and snippets.

@fredrikaverpil
Last active October 1, 2018 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fredrikaverpil/fb6204d2fcc252cbcd8194dff732f22d to your computer and use it in GitHub Desktop.
Save fredrikaverpil/fb6204d2fcc252cbcd8194dff732f22d to your computer and use it in GitHub Desktop.
PySide2 setup.py __file__ issues
# Get the repo, get the docker image
$ git clone -b 5.9 --recursive https://code.qt.io/pyside/pyside-setup.git pyside-setup-5.9
$ docker pull fredrikaverpil/pyside2-linux:centos7-qt5.9.4
# Execute pwd
$ docker run --rm --interactive --tty -v ${pwd}:/workdir fredrikaverpil/pyside2-linux:centos7-qt5.9.4 pwd
/workdir
# Just execute "ls" to show what's in the current directory
$ docker run --rm --interactive --tty -v ${pwd}:/workdir fredrikaverpil/pyside2-linux:centos7-qt5.9.4 ls
pyside-setup-5.9
# List the details on "pyside-setup-5.9/setup.py"
$ docker run --rm --interactive --tty -v ${pwd}:/workdir fredrikaverpil/pyside2-linux:centos7-qt5.9.4 ls -alh pyside-setup-5.9/setup.py
-rwxr-xr-x 1 root root 82K Mar 15 08:10 pyside-setup-5.9/setup.py
# Run the build
$ docker run --rm --interactive --tty -v ${pwd}:/workdir fredrikaverpil/pyside2-linux:centos7-qt5.9.4 /usr/bin/python3.6 pyside-setup-5.9/setup.py bdist_wheel --ignore-git --standalone --no-examples --qmake=/root/Qt-5.9.4/5.9.4/gcc_64/bin/qmake --cmake=/usr/bin/cmake3 --jobs=3
Traceback (most recent call last):
File "./pyside-setup-5.9/setup.py", line 250, in <module>
check_allowed_python_version()
File "./pyside-setup-5.9/setup.py", line 238, in check_allowed_python_version
with open(__file__) as setup:
FileNotFoundError: [Errno 2] No such file or directory: 'pyside-setup-5.9/setup.py'
# Change "with open(__file__) as setup:" to "with open(os.path.realpath(__file__)) as setup:"
# and build again
$ docker run --rm --interactive --tty -v ${pwd}:/workdir fredrikaverpil/pyside2-linux:centos7-qt5.9.4 /usr/bin/python3.6 pyside-setup-5.9/setup.py bdist_wheel --ignore-git --standalone --no-examples --qmake=/root/Qt-5.9.4/5.9.4/gcc_64/bin/qmake --cmake=/usr/bin/cmake3 --jobs=3
Traceback (most recent call last):
File "./pyside-setup-5.9/setup.py", line 250, in <module>
check_allowed_python_version()
File "./pyside-setup-5.9/setup.py", line 238, in check_allowed_python_version
with open(os.path.realpath(__file__)) as setup:
FileNotFoundError: [Errno 2] No such file or directory: '/workdir/pyside-setup-5.9/pyside-setup-5.9/setup.py'
# --> Solution, change "with open(__file__) as setup:" to "with open(this_file) as setup:"
# and build again
$ docker run --rm --interactive --tty -v ${pwd}:/workdir fredrikaverpil/pyside2-linux:centos7-qt5.9.4 /usr/bin/python3.6 pyside-setup-5.9/setup.py bdist_wheel --ignore-git --standalone --no-examples --qmake=/root/Qt-5.9.4/5.9.4/gcc_64/bin/qmake --cmake=/usr/bin/cmake3 --jobs=3
running bdist_wheel
running build
Removing /workdir/pyside-setup-5.9/pyside_package
Python architecture is 64bit
Inserting path "/root/Qt-5.9.4/5.9.4/gcc_64/bin" to environment
Inserting path "/workdir/pyside-setup-5.9/pyside3_install/py3.6-qt5.9.4-64bit-release/bin" to environment
==============================
Package version: 5.9.0a1
Build type: Release
Build tests: False
---
Make path: /usr/bin/make
Make generator: Unix Makefiles
Make jobs: -j3
---
Script directory: /workdir/pyside-setup-5.9
Sources directory: /workdir/pyside-setup-5.9/sources
Building PySide2 will create and touch directories in the following order:
make build directory (py*_build/*/*) ->
make install directory (py*_install/*/*) ->
pyside_package directory (pyside_package/*) ->
setuptools build directory (build/*/*) ->
setuptools install directory (usually path-installed-python/lib/python*/site-packages/*)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment