Allowed options in Spec file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Allowed options in Spec file

Parkway
From the manual, a spec file can be used to generate a project ie.

python pyinstaller.py [opts] your-program.spec

Is it possible to put some/all of the Allowed Options in the Spec file eg. --upx-dir, --onefile, etc.?  If so, how is this achieved.  The TOC section maybe applicable but it is not easy to understand.  My aim is to reduce the number of [opts] in the project generation statement.  Thx.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Zak
Reply | Threaded
Open this post in threaded view
|

Re: Allowed options in Spec file

Zak
This is not exactly what you asked for, but what I do is I write a
make.py script for every PyInstaller project I build. The file make.py
might look something like this:

# File make.py

import subprocess
import os

PYI_PATH = "/Users/zakf/Downloads/pyinstaller-2.0/"
OUT_PATH = "/Users/zakf/progs/pyi_builds/"
PYI_EXE = os.path.join(PYI_PATH, "pyinstaller.py")
MAKESPEC_EXE = os.path.join(PYI_PATH, "utils", "Makespec.py")

if __name__ == '__main__':
     base_py_file = "my_app.py"
     name_arg = "--name=my_app"
     deploy_type = '--onefile'
     # deploy_type = '--onedir'

     # The .spec file and all build files will go in this directory:
     out_dir_path = os.path.join(OUT_PATH, "my_app")
     out_dir = "--out=%s" % out_dir_path

     windowed = '--windowed'
     # windowed = '--nowindowed'

     makespec_args = ["python", MAKESPEC_EXE, deploy_type, windowed,
                      out_dir, name_arg, base_py_file]

     subprocess.call(makespec_args)

     spec_path = os.path.join(out_dir_path, 'my_app.spec')
     pyi_args = ["python", pyi_exe, deploy_type, windowed, out_dir,
                 name_arg, spec_path]

     subprocess.call(pyi_args)

I can customize the behavior by switching which lines are commented out.
Then, each time I want to run a PyInstaller build, I just call "python
make.py" and I don't have to remember any of the options. The options
are all baked into the make.py script. As an added bonus, I don't have
to modify the .spec file by hand. What you requested would require you
to modify the .spec file by hand, but that would be a hassle if you had
to run Makespec.py again, because it would wipe out the options you had
included in the .spec file.

Hope that helps,

Zak F.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Allowed options in Spec file

Parkway
This is perfect Zak, as a) don't have to hand-modify the spec file (which I've lost a number of times) and b) the command line options don't have to be remembered and typed out. Many thanks.

Btw, left a message on the "IOError raised when updating cache" thread.

--
You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/pyinstaller?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.