1. PyPA
  2. Python Packaging Authority Projects
  3. distlib

Commits

Vinay Sajip  committed 772b33c

Tweaks after merging PR.

  • Participants
  • Parent commits 49839b1
  • Branches default

Comments (0)

Files changed (2)

File PC/launcher.c

View file
  • Ignore whitespace
 
 static char *
 find_exe(char * line) {
-	char * p;
+    char * p;
 
-	while ((p = StrStrIA(line, ".exe")) != NULL) {
-		char c = p[4];
+    while ((p = StrStrIA(line, ".exe")) != NULL) {
+        char c = p[4];
 
-		if ((c == '\0') || (c == '"') || isspace(c))
-			break;
-		line = &p[4];
-	}
-	return p;
+        if ((c == '\0') || (c == '"') || isspace(c))
+            break;
+        line = &p[4];
+    }
+    return p;
 }
 
 static char *
 find_executable_and_args(char * line, char ** argp)
 {
-	char * p = find_exe(line);
+    char * p = find_exe(line);
 
-	assert(p != NULL, "Expected to find a command ending in '.exe' in shebang line.");
-	p += 4;
-	if (*line == '"') {
-		assert(*p == '"', "Expected terminating double-quote for executable in shebang line.");
-		*p++ = '\0';
-		++line;
-	}
-	/* p points just past the executable. It must either be a NUL or whitespace. */
-	assert(*p != '"', "Terminating quote without starting quote for executable in shebang line.");
-	/* Now we can skip the whitespace, having checked that it's there. */
-	while(*p && isspace(*p))
+    assert(p != NULL, "Expected to find a command ending in '.exe' in shebang line.");
+    p += 4;
+    if (*line == '"') {
+        assert(*p == '"', "Expected terminating double-quote for executable in shebang line.");
         *p++ = '\0';
-	*argp = p;
-	return line;
+        ++line;
+    }
+    /* p points just past the executable. It must either be a NUL or whitespace. */
+    assert(*p != '"', "Terminating quote without starting quote for executable in shebang line.");
+    /* Now we can skip the whitespace, having checked that it's there. */
+    while(*p && isspace(*p))
+        *p++ = '\0';    /* Ensure parameters are not included in executable */
+    *argp = p;
+    return line;
 }
 
 static int
     ++cp;
     while (*cp && isspace(*cp))
         ++cp;
-	p = NULL;
-	cp = find_executable_and_args(cp, &p);
-	assert(cp != NULL, "Expected to find executable in shebang line");
-	assert(p != NULL, "Expected to find arguments (even if empty) in shebang line");
-	 /* 3 spaces + 4 quotes + NUL */
+    p = NULL;
+    cp = find_executable_and_args(cp, &p);
+    assert(cp != NULL, "Expected to find executable in shebang line");
+    assert(p != NULL, "Expected to find arguments (even if empty) in shebang line");
+     /* 3 spaces + 4 quotes + NUL */
     len = strlen(cp) + strlen(p) + 8 + strlen(psp) + strlen(cmdline);
     cmdp = calloc(len, sizeof(char));
     assert(cmdp != NULL, "Expected to be able to allocate command line memory");
     _snprintf_s(cmdp, len, len, "\"%s\" %s \"%s\" %s", cp, p, psp, cmdline);
     run_child(cmdp);  /* never actually returns */
     free(cmdp);
-	return 0;
+    return 0;
 }
 
 #if defined(_CONSOLE)
 {
     return process(__argc, __argv);
 }
-#endif
+#endif

File distlib/scripts.py

View file
  • Ignore whitespace
         if enquote and ' ' in executable:
             executable = '"%s"' % executable
         executable = fsencode(executable)
-        # in case of IronPython, play safe and enable frames support
-        if sys.platform == 'cli' \
-           and "-X:Frames" not in post_interp \
-           and "-X:FullFrames" not in post_interp:
+        # in case of IronPython, play safe and enable frames support
+        if (sys.platform == 'cli' and '-X:Frames' not in post_interp
+            and '-X:FullFrames' not in post_interp):
             post_interp += b' -X:Frames'
         shebang = b'#!' + executable + post_interp + b'\n'
         # Python parser starts to read a script using UTF-8 until