-
I am using the code in the docs to run pyinstaller like this: import PyInstaller.__main__
PyInstaller.__main__.run([
'my_script.py',
'--onefile',
'--windowed'
]) Is equivalent to: pyinstaller my_script.py --onefile --windowed How do I run the |
Beta Was this translation helpful? Give feedback.
Answered by
rokm
Jun 11, 2024
Replies: 2 comments 1 reply
-
By implementing the equivalent of https://github.com/pyinstaller/pyinstaller/blob/develop/PyInstaller/utils/cliutils/makespec.py |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Eboubaker
-
This worked! pyarmor can use the spec file now... import pyarmor.cli.__main__
import PyInstaller.building.makespec
import PyInstaller.log
import os
import argparse
oscript = script = 'main.py'
def name(f):
root, ext = os.path.splitext(f)
return os.path.basename(root)
p = argparse.ArgumentParser()
PyInstaller.building.makespec.__add_options(p)
PyInstaller.log.__add_options(p)
p.add_argument(
'scriptname',
nargs='+',
)
args = p.parse_args([
script,
'--onefile',
'--windowed',
'--noconfirm',
'--icon=icon.ico',
'--log-level=ERROR',
'--splash=img/splash.png',
'--add-data=nltk_data:nltk_data',
'--add-data=env/Lib/site-packages/arramooz/data/wordfreq.sqlite:data/',
'--add-data=env/Lib/site-packages/arramooz/data/stopwords.sqlite:data/',
'--add-data=env/Lib/site-packages/pyvis/templates:pyvis/templates',
'--add-data=img:img',
'--name=' + name(oscript) + '.exe',
])
temppaths = args.pathex[:]
args.pathex = []
for p in temppaths:
args.pathex.extend(p.split(os.pathsep))
PyInstaller.building.makespec.main(args.scriptname, **vars(args))
from PyInstaller.config import CONF
CONF['noconfirm'] = True
pyarmor.cli.__main__.main_entry([
'gen',
'--pack',
name(oscript) + '.exe.spec',
'-r',
script
]) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
By implementing the equivalent of https://github.com/pyinstaller/pyinstaller/blob/develop/PyInstaller/utils/cliutils/makespec.py