Ticket #17 (closed enhancement: fixed)
running pyinstaller from a python script is unecessarily hard!
| Reported by: | openticket | Owned by: | giovannibajo |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | PyInstaller | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Description
I have a build script which is written in python. I want to run Pyinstaller from there. This should be easy as PyInstaller? is a python program. However, I'm finding that it is much harder than I thought it would be, mainly because of the reliance on globals and the assumption that the code will be run from a command line and have the working directory be where Build.py/Makespec.py is (it uses this to locate the dat files).
I realise I can workaround this by running the command directly, but it would be *very* nice to just call the build and Makespec functions directly from my python script (maybe just telling it where to find the dat files).
This is an enhancement request; otherwise I am VERY happy with the code!! :) P.S. It would be excellent if you could get this integrated into the Python Standard Library..
Best Regards, Tushar.
Attachments
Change History
comment:1 Changed 6 years ago by giovannibajo
- Status changed from new to closed
- Resolution set to wontfix
comment:2 Changed 5 years ago by openticket
- Status changed from closed to reopened
- Resolution wontfix deleted
I can not see how this would make PyInstaller? harder.
When going for cross-builds (#27), some major code cleanup is required anyhow. This would enhance code-quality and would allow for this kind of stuff. And it would allow easly integrating PyInstaller? into distutils (#32).
Using supprocess, etc is not a good solution here.
If you are willed to integrate the required changes, I may volunteer implementing it.
comment:3 Changed 5 years ago by h.goebel@…
As of changset:507 this should be solved: Configure, Makespec and Build now all have a main() function. You just have to ensure they are on your PYTHONAPTH.
Hmm, hold on. There are still some dependencies on sys.argv[0]. This still has to be fixed.
comment:4 Changed 2 years ago by matysek
- Status changed from reopened to closed
- Resolution set to fixed
In svn pyinstaller is placed in own module PyInstaller? and configure, makespec and build functionality is wrapped into function so I think for current svn version it should be easy to run pyinstaller as you would like.
comment:5 Changed 8 months ago by menyland@…
Tried what was in the last comment here.
Moved the PyInstaller? directory into my build directory then execute this code
import PyInstaller.build
PyInstaller.build.main("Myspecfile.spec","./build_output", False)
and it fails pretty early on saying it can't find support\rthooks.dat
So I moved the support folder from the pyinstaller-2.0 into my directory. After I do that it seems to run just fine. I don't know the code well enough to know if there are any other dependencies. But I guess the suggestion would be can the support directory be moved in to the PyInstaller? package directory making it self contained?

I think this would make PyInstaller? harder for no good reason. If you want to run PyInstaller? externally do not import it: just use os.system or os.popen, or subprocess, or whatever.