Changeset 503

Show
Ignore:
Timestamp:
Mon Jul 28 13:21:50 2008
Author:
htgoebel
Message:

Minor cleanup, esp. user messages.

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/Makespec.py

    r499 r503  
    141 141         config = eval(open(os.path.join(HOME, 'config.dat'), 'r').read())  
    142 142     except IOError:  
    143           print "You must run Configure.py before building!"  
    144           sys.exit(1)  
      143         raise SystemExit("Configfile is missing or unreadable. Please run Configure.py before building!")  
    145 144  
    146 145     if config['pythonVersion'] != sys.version:  
     
    228 227     g.add_option("-o", "--out", type="string", default=None,  
    229 228                  dest="workdir", metavar="DIR",  
    230                    help="generate the spec file in the specified directory")  
      229                  help="generate the spec file in the specified directory "  
      230                       "(default: current directory")  
    231 231  
    232 232     g = p.add_option_group('What to bundle, where to seach')  
     
    281 281  
    282 282     if not args:  
    283           p.print_help()  
    284           sys.exit(1)  
      283         p.error('Requires at least one scriptname file')  
    285 284  
    286       nm = apply(main, (args,), opts.__dict__)  
    287       print "wrote %s" % nm  
      285     name = apply(main, (args,), opts.__dict__)  
      286     print "wrote %s" % name  
    288 287     print "now run Build.py to build the executable"  
  • trunk/.hgignore

    r501 r503  
    14 14 ^support/loader/run_d  
    15 15 ^source/linux/Makefile  
    16   ^buildtests/test[0-9]+.exe  
    17 16 ^patches  
  • trunk/buildtests/runtests.py

    r491 r503  
    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))  
     
    110 119     normal_tests = glob.glob('test*[0-9].py')  
    111 120     interactive_tests = glob.glob('test*[0-9]i.py')  
    112       args = sys.argv[1:]  
    113 121  
    114       run_executable = 1  
    115       if "-n" in args:  
    116           # Do not run the built executables. Useful for cross builds.  
    117           run_executable = 0  
    118       if "-c" in args:  
      122     from optparse import OptionParser  
      123     parser = OptionParser(usage="%prog [options]")  
      124     parser.add_option('-c', '--clean', action='store_true',  
      125                       help='Clean up generated files')  
      126     parser.add_option('-i', '--interactive-tests', action='store_true',  
      127                       help='Run interactive tests (default: run normal tests)')  
      128     parser.add_option('-n', '--no-run', action='store_true',  
      129                       help='Do not run the built executables. '  
      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)')  
      134  
      135     opts, args = parser.parse_args()  
      136     if args:  
      137         parser.error('Does not expect any arguments')  
      138  
      139     if opts.clean:  
    119 140         # only clean up  
    120           tests = []  
    121       elif "-i" in args:  
      141         clean()  
      142         raise SystemExit()  
      143  
      144     if opts.interactive_tests:  
    122 145         print "Running interactive tests"  
    123 146         tests = interactive_tests  
    124 147     else:  
    125           print "Running normal tests (-i for interactive tests)"  
    126 148         tests = normal_tests  
      149         print "Running normal tests (-i for interactive tests)"  
    127 150  
    128 151     clean()  
    129       if tests:  
    130           runtests(tests, run_executable=run_executable)  
      152     runtests(tests, configfile=opts.configfile, run_executable=not opts.no_run)