Changeset 498

Show
Ignore:
Timestamp:
Fri Jul 25 05:35:26 2008
Author:
htgoebel
Message:

Minor code cleanup: Moved functional lines into main().

Files:

Legend:

Unmodified
Added
Removed
Modified
  • trunk/Makespec.py

    r477 r498  
    1 1 #!/usr/bin/env python  
      2 #  
    2 3 # Automatically build spec files containing a description of the project  
      4 #  
    3 5 # Copyright (C) 2005, Giovanni Bajo  
    4 6 # Based on previous work under copyright (c) 2002 McMillan Enterprises, Inc.  
     
    22 24 # For Python 1.5 compatibility  
    23 25 try:  
    24       True  
      26     True, False  
    24 26 except:  
    25       True,False = 1,0  
      27     True  = 1 == 1  
      28     False = not True  
    26 29  
    27 30 freezetmplt = """# -*- mode: python -*-  
     
    85 88                name='%(distdir)s')  
    86 89 """ # scripts pathex, exename, debug, console tktree distdir  
      90  
    87 91 HOME = os.path.dirname(sys.argv[0])  
    88   if HOME == '':  
    89       HOME = os.getcwd()  
    90   if not os.path.isabs(HOME):  
    91       HOME = os.path.abspath(HOME)  
      92 HOME = os.path.abspath(HOME)  
      93  
    92 94 iswin = sys.platform[:3] == "win"  
    93 95 cygwin = sys.platform == "cygwin"  
    94   try:  
    95       config = eval(open(os.path.join(HOME, 'config.dat'), 'r').read())  
    96   except IOError:  
    97       print "You must run Configure.py before building!"  
    98       sys.exit(1)  
    99    
    100   if config['pythonVersion'] != sys.version:  
    101       print "The current version of Python is not the same with which PyInstaller was configured."  
    102       print "Please re-run Configure.py with this version."  
    103       sys.exit(1)  
    104 96  
    105 97 def quote_win_filepath( path ):  
     
    141 133         return "os.path.join(" + self.variable_prefix + "," + repr(self.filename_suffix) + ")"  
    142 134  
    143   def main(scripts, name=None, tk=0, freeze=0, console=1, debug=0, strip=0, upx=0,  
    144            comserver=0, ascii=0, workdir=None, pathex=[], version_file=None, icon_file=None):  
    145       if name is None:  
      135  
      136 def main(scripts, name=None, tk=0, freeze=0, console=1, debug=0,  
      137          strip=0, upx=0, comserver=0, ascii=0, workdir=None,  
      138          pathex=[], version_file=None, icon_file=None):  
      139  
      140     try:  
      141         config = eval(open(os.path.join(HOME, 'config.dat'), 'r').read())  
      142     except IOError:  
      143         print "You must run Configure.py before building!"  
      144         sys.exit(1)  
      145  
      146     if config['pythonVersion'] != sys.version:  
      147         print "The current version of Python is not the same with which PyInstaller was configured."  
      148         print "Please re-run Configure.py with this version."  
      149         raise SystemExit(1)  
      150  
      151     if not name:  
    146 152         name = os.path.splitext(os.path.basename(scripts[0]))[0]  
      153  
    147 154     distdir = "dist%s" % name  
    148 155     builddir = "build%s" % name  
      156      
    149 157     pathex = pathex[:]  
    150 158     if workdir is None:  
     
    206 214     return specfnm  
    207 215  
      216  
    208 217 if __name__ == '__main__':  
    209 218     import optparse