Changeset 507

Show
Ignore:
Timestamp:
Mon Jul 28 13:45:11 2008
Author:
htgoebel
Message:

Added option -C/--configfile as preperation of cross-building. This
allows using one PyInstaller? installation to be used for differnet
target platforms.

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/Makespec.py

    r505 r507  
    134 134  
    135 135  
    136   def main(scripts, name=None, tk=0, freeze=0, console=1, debug=0,  
      136 def main(scripts, configfile=None, name=None, tk=0, freeze=0, console=1, debug=0,  
    136 136          strip=0, upx=0, comserver=0, ascii=0, workdir=None,  
    137 137          pathex=[], version_file=None, icon_file=None):  
    138 138  
    139 139     try:  
    140           config = eval(open(os.path.join(HOME, 'config.dat'), 'r').read())  
      140         config = eval(open(configfile, 'r').read())  
    140 140     except IOError:  
    141 141         raise SystemExit("Configfile is missing or unreadable. Please run Configure.py before building!")  
     
    219 219         usage="python %prog [opts] <scriptname> [<scriptname> ...]"  
    220 220     )  
      221     p.add_option('-C', '--configfile',  
      222                  default=os.path.join(HOME, 'config.dat'),  
      223                  help='Name of configfile (default: %default)')  
      224  
    221 225     g = p.add_option_group('What to generate')  
    222 226     g.add_option("-F", "--onefile", dest="freeze",  
  • trunk/buildtests/runtests.py

    r506 r507  
    25 25 import shutil  
    26 26  
      27 HOME = '..'  
      28  
    27 29 try:  
    28 30     here=os.path.dirname(os.path.abspath(__file__))  
     
    68 70  
    69 71  
    70   def runtests(alltests, filters=None, run_executable=1):  
      72 def runtests(alltests, filters=None, configfile=None, run_executable=1):  
    70 72     info = "Executing PyInstaller tests in: %s" % os.getcwd()  
    71       print "*"*len(info)  
      73     print "*" * min(80, len(info))  
    71 73     print info  
    72       print "*"*len(info)  
      74     print "*" * min(80, len(info))  
      75  
      76     OPTS = ''  
      77     if configfile:  
      78         # todo: quote correctly  
      79         OTPS = ' -c "%s"' %  configfile  
    73 80  
    74 81     build_python = open("python_exe.build", "w")  
     
    89 96         _msg("BUILDING TEST", src)  
    90 97         test = os.path.splitext(os.path.basename(src))[0]  
    91           res = os.system('%s ../Build.py %s' % (PYTHON, test+".spec"))  
    92           # Run the test in a clean environment to make sure they're really self-contained  
    93    
      98         res = os.system(string.join([PYTHON, os.path.join(HOME, 'Build.py'),  
      99                                      OPTS, test+".spec"],  
      100                                     ' '))  
    94 101         if run_executable:  
    95 102             _msg("EXECUTING TEST", src)  
      103             # Run the test in a clean environment to make sure they're  
      104             # really self-contained  
    96 105             del os.environ["PATH"]  
    97 106             res = os.system('dist%s%s%s.exe' % (test, os.sep, test))  
     
    120 129                       help='Do not run the built executables. '  
    121 130                            'Useful for cross builds.')  
      131     parser.add_option('-C', '--configfile',  
      132                       default=os.path.join(HOME, 'config.dat'),  
      133                       help='Name of generated configfile (default: %default)')  
    122 134  
    123 135     opts, args = parser.parse_args()  
     
    138 150  
    139 151     clean()  
    140       runtests(tests, run_executable=not opts.no_run)  
      152     runtests(tests, configfile=opts.configfile, run_executable=not opts.no_run)  
  • trunk/Build.py

    r502 r507  
    927 927 """  
    928 928  
    929   def main(specfile):  
      929 def main(specfile, configfilename):  
    929 929     global target_platform, target_iswin, config  
    930 930     global icon, versionInfo  
    931 931  
    932 932     try:  
    933           config = _load_data(os.path.join(HOMEPATH, 'config.dat'))  
      933         config = _load_data(configfilename)  
    933 933     except IOError:  
    934 934         print "You must run Configure.py before building!"  
     
    961 961     from optparse import OptionParser  
    962 962     parser = OptionParser('%prog [options] specfile')  
      963     parser.add_option('-C', '--configfile',  
      964                       default=os.path.join(HOMEPATH, 'config.dat'),  
      965                       help='Name of generated configfile (default: %default)')  
    963 966     opts, args = parser.parse_args()  
    964 967     if len(args) != 1:  
    965 968         parser.error('Requires exactly one .spec-file')  
    966 969  
    967       main(args[0])  
      970     main(args[0], configfilename=opts.configfile)  
  • trunk/Configure.py

    r497 r507  
    251 251  
    252 252  
    253   def main():  
    254       configfile = os.path.join(HOME, 'config.dat')  
      253 def main(configfilename):  
    255 254     try:  
    256           config = eval(open(configfile, 'r').read())  
      255         config = Build._load_data(configfilename)  
      256         print 'I: read old config from', configfilename  
    257 257     except IOError, SyntaxError:  
    258           # IOerror: file not present  
      258         # IOerror: file not present/readable  
    258 258         # SyntaxError: invalid file (platform change?)  
    259           config = {'useELFEXE':1}    # if not set by Make.py we can assume Windows  
      259         # if not set by Make.py we can assume Windows  
      260         config = {'useELFEXE': 1}  
    260 261  
    261 262     # Save Python version, to detect and avoid conflicts  
     
    271 272     find_PYZ_dependencies(config)  
    272 273  
    273       Build._save_data(configfile, config)  
    274       print "I: config.dat generation done!"  
      274     Build._save_data(configfilename, config)  
      275     print "I: done generating", configfilename  
    275 276  
    276 277  
     
    284 285                       help='Python executable to use. Required for '  
    285 286                            'cross-bundling.')  
      287     parser.add_option('-C', '--configfile',  
      288                       default=os.path.join(HOME, 'config.dat'),  
      289                       help='Name of generated configfile (default: %default)')  
    286 290  
    287 291     opts, args = parser.parse_args()  
     
    289 293         parser.error('Does not expect any arguments')  
    290 294  
    291       main()  
      295     main(opts.configfile)