https://pantsbuild.org/ logo
#general
Title
# general
f

full-oyster-41619

08/21/2020, 10:47 AM
are there any integrations/plugins on python binary build for pyinstaller instead of pex? We are using pyinstaller + staticx to deliver our python binaries because pex does not include a python interpreter.
h

happy-kitchen-89482

08/21/2020, 2:07 PM
Not that I know of. I don't know much about pyinstaller, but it probably wouldn't be difficult to add support for it. I assume there is a command you run and you pass it your requirements and source files, similar in spirit to the pex command?
f

full-oyster-41619

08/21/2020, 6:48 PM
correct. here is an article that explain different scenarios to build a binary https://www.pither.com/simon/blog/2018/09/18/how-build-portable-executable-single-python-script this is what I have in the CI that works on rhel/centos/oel
Copy code
stripped_installer="installer"
unstripped_installer="unstripped_installer"
main="installer/main.py"

pyinstaller \
  --noconfirm \
  --onefile \
  --strip \
  --add-data "installer/additional_data:installer/additional_data" \
  --name ${unstripped_installer} \
  --clean \
  --hidden-import='pty' \
  --hidden-import='xml.etree' \
  --hidden-import='xml.etree.ElementTree' \
  --hidden-import='selectors' \
  --hidden-import='csv' \
  --hidden-import='smtplib' \
  --hidden-import='ansible' \
  --hidden-import='logging.handlers' \
  --hidden-import='pkg_resources.py2_warn' \
  ${main}

staticx ./dist/${unstripped_installer} ${stripped_installer}
shall I open a ticket for this improvement?
2 Views