فهرست منبع

Dedent script template

Thomas Kluyver 11 سال پیش
والد
کامیت
d3cfdffa30
1فایلهای تغییر یافته به همراه16 افزوده شده و 16 حذف شده
  1. 16 16
      nsist/__init__.py

+ 16 - 16
nsist/__init__.py

@@ -101,22 +101,22 @@ class InstallerBuilder(object):
         download(url, target)
 
     SCRIPT_TEMPLATE = """#!python{qualifier}
-    import sys, os
-    scriptdir, script = os.path.split(__file__)
-    pkgdir = os.path.join(scriptdir, 'pkgs')
-    sys.path.insert(0, pkgdir)
-    os.environ['PYTHONPATH'] = pkgdir + os.pathsep + os.environ.get('PYTHONPATH', '')
-    
-    def excepthook(etype, value, tb):
-        "Write unhandled exceptions to a file rather than exiting silently."
-        import traceback
-        with open(os.path.join(scriptdir, script+'.log'), 'w') as f:
-            traceback.print_exception(etype, value, tb, file=f)
-    sys.excepthook = excepthook
-    
-    from {module} import {func}
-    {func}()
-    """
+import sys, os
+scriptdir, script = os.path.split(__file__)
+pkgdir = os.path.join(scriptdir, 'pkgs')
+sys.path.insert(0, pkgdir)
+os.environ['PYTHONPATH'] = pkgdir + os.pathsep + os.environ.get('PYTHONPATH', '')
+
+def excepthook(etype, value, tb):
+    "Write unhandled exceptions to a file rather than exiting silently."
+    import traceback
+    with open(os.path.join(scriptdir, script+'.log'), 'w') as f:
+        traceback.print_exception(etype, value, tb, file=f)
+sys.excepthook = excepthook
+
+from {module} import {func}
+{func}()
+"""
     
     def write_script(self, entrypt, target):
         """Write a launcher script from a 'module:function' entry point