Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleGraph can get confused by symlinks #1750

Closed
inglesp opened this issue Jan 5, 2016 · 3 comments · Fixed by #1755
Closed

ModuleGraph can get confused by symlinks #1750

inglesp opened this issue Jan 5, 2016 · 3 comments · Fixed by #1755
Assignees
Labels
area:hooks Caused by or effecting some hook area:modulegraph platform:OS X

Comments

@inglesp
Copy link
Contributor

inglesp commented Jan 5, 2016

I'm trying to package an application that uses PyQt5 and QScintilla2 on OSX. Building the package works fine, but when it comes to run, it fails with an ImportError on:

import PyQt5.Qsci

This is because although ModuleGraph is able to find and import the PyQt5 package, it's not able to find PyQt5.Qsci, because it's looking in the wrong place.

I've installed PyQt5 with homebrew, which puts the relevant .so files in /usr/local/Cellar/pyqt5/5.5.1/lib/python3.5/site-packages/PyQt5/, and then creates a symlink to each .so file in /usr/local/lib/python3.5/site-packages/PyQt5/.

I've also installed QScintilla2 with homebrew, which puts Qsci.so in /usr/local/Cellar/qscintilla2/2.8.4/lib/python3.5/site-packages/PyQt5/, and symlinks this to /usr/local/lib/python3.5/site-packages/PyQt5/Qsci.so.

The problem comes when ModuleGraph tries to work out where it should be importing PyQt5.Qsci from. I think it assumes that PyQt5.Qsci's "head" package is the PyQt5 package. It has previously found the PyQt5 package in /usr/local/lib/python3.5/site-packages/PyQt5/, but via ModuleGraph._find_module's call to os.path.realpath, it records the PyQt5 package as being in /usr/local/Cellar/pyqt5/5.5.1/lib/python3.5/site-packages/PyQt5/.

As such, it tries to look here for PyQt5.Qsci, and this fails.

Commenting out these two lines causes the build to produce something usable. Beyond that though, I'm not sure what to recommend as a fix -- I assume those lines are there for a reason, but it looks like they've been there since the modulegraph project was imported into bitbucket almost ten years ago!

@htgoebel
Copy link
Member

htgoebel commented Jan 5, 2016

Said two lines resolve the sym-link (using realpath). This was not done in modulefinder on which modulegraph is based on, see the original commit of modulefinder.

I can see no reason, why realpath should be required at all here: Either it is a module, then the real path does not matter at all. Or it is a package, in which case the real path is of no interest and even hurts as this issue shows.

I assume, it should be save to replace this by abspath or absnormpath, or even remove it.

Any opinions? Should this go into release 3.1?

@htgoebel htgoebel self-assigned this Jan 5, 2016
@bjones1
Copy link
Contributor

bjones1 commented Jan 5, 2016

I see no reason for these two lines -- if tests pass with them removed, I'd suggest including this in v3.1.

@inglesp
Copy link
Contributor Author

inglesp commented Jan 5, 2016

I did try to run the tests with those lines removed, the tests seem to leak temporary files and I ran out of disk space... Is this a known problem?

inglesp added a commit to inglesp/pyinstaller that referenced this issue Jan 9, 2016
inglesp added a commit to inglesp/pyinstaller that referenced this issue Jan 10, 2016
inglesp added a commit to inglesp/pyinstaller that referenced this issue Jan 10, 2016
htgoebel pushed a commit that referenced this issue Jan 29, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area:hooks Caused by or effecting some hook area:modulegraph platform:OS X
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants