Closed mssalvatore closed 3 years ago
Merging #45 (dd35f27) into master (51fbd8d) will decrease coverage by
0.99%
. The diff coverage is0.00%
.
@@ Coverage Diff @@
## master #45 +/- ##
==========================================
- Coverage 98.26% 97.27% -1.00%
==========================================
Files 7 9 +2
Lines 1094 1099 +5
==========================================
- Hits 1075 1069 -6
- Misses 19 30 +11
Impacted Files | Coverage Δ | |
---|---|---|
pypsexec/__pyinstaller/__init__.py | 0.00% <0.00%> (ø) |
|
pypsexec/__pyinstaller/hook-pypsexec.py | 0.00% <0.00%> (ø) |
|
pypsexec/client.py | 94.06% <0.00%> (-2.55%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 51fbd8d...dd35f27. Read the comment docs.
Thanks for the PR, I'll have to set aside some time in the coming week(s) to try and understand this setup a bit more. Is pyinstaller a way to essentially package Python and some libraries into a self contained executable or is there some other reason to use it?
Is pyinstaller a way to essentially package Python and some libraries into a self contained executable?
Yep!
@jborean93 Any update on this PR? Do you need any more information from me?
Sorry for the delay. I've had a very brief look at this and I think I'm still quite reluctant to add official support for this. I don't know much about this environment and I don't particular want to be on the hook for any future changes to the structure of this library that might affect pyinstaller.
One thing when reading online is I see there's something called a spec file to generate the executable https://pyinstaller.readthedocs.io/en/stable/spec-files.html#spec-file-operation. It seems to be just a Python script that is executed so I would assume you can do the following to manually include the paexec.exe
file.
import os.path
import pypsexec
paexec_path = os.path.join(os.path.dirname(pypsexec.__file__), 'paexec.exe')
a = Analysis(...
binaries=[paexec_path])
...
You can even adapt the method https://github.com/jborean93/pypsexec/issues/43#issuecomment-895970104 by calling it programmatically through a python script:
import os
import os.path
import PyInstaller.__main__
import pypsexec
pypsexec_path = os.path.dirname(pypsexec.__file__)
paexec_path = os.path.join(pypsexec_path, 'paexec.exe')
PyInstaller.__main__.run([
'--onefile',
f'--add-data={pypsexec_path}{os.pathsep}{paexec_path}',
'my-script.py',
])
When testing this even creates a nice spec file that you can adapt for future use.
Fair enough.
Closing as per the comment above.
These hooks allow pypsexec to be properly packaged with PyInstaller. Specifically, they help Pyinstaller locate the paexec.exe binary.
You can read more about PyInstaller here, and more about PyInstaller hooks here.
Fixes #43