Update python to 2.6.1.
[openwrt/svn-archive/archive.git] / lang / python / patches / 080-distutils-dont_adjust_files.patch
1 diff --git a/Lib/distutils/command/build_scripts.py b/Lib/distutils/command/build_scripts.py
2 index c0d8f70..d36e29c 100644
3 --- a/Lib/distutils/command/build_scripts.py
4 +++ b/Lib/distutils/command/build_scripts.py
5 @@ -51,10 +51,7 @@ class build_scripts (Command):
6
7
8 def copy_scripts (self):
9 - """Copy each script listed in 'self.scripts'; if it's marked as a
10 - Python script in the Unix way (first line matches 'first_line_re',
11 - ie. starts with "\#!" and contains "python"), then adjust the first
12 - line to refer to the current Python interpreter as we copy.
13 + """Copy each script listed in 'self.scripts';
14 """
15 self.mkpath(self.build_dir)
16 outfiles = []
17 @@ -77,41 +74,9 @@ class build_scripts (Command):
18 if not self.dry_run:
19 raise
20 f = None
21 - else:
22 - first_line = f.readline()
23 - if not first_line:
24 - self.warn("%s is an empty file (skipping)" % script)
25 - continue
26 -
27 - match = first_line_re.match(first_line)
28 - if match:
29 - adjust = 1
30 - post_interp = match.group(1) or ''
31 -
32 - if adjust:
33 - log.info("copying and adjusting %s -> %s", script,
34 - self.build_dir)
35 - if not self.dry_run:
36 - outf = open(outfile, "w")
37 - if not sysconfig.python_build:
38 - outf.write("#!%s%s\n" %
39 - (self.executable,
40 - post_interp))
41 - else:
42 - outf.write("#!%s%s\n" %
43 - (os.path.join(
44 - sysconfig.get_config_var("BINDIR"),
45 - "python" + sysconfig.get_config_var("VERSION")
46 - + sysconfig.get_config_var("EXE")),
47 - post_interp))
48 - outf.writelines(f.readlines())
49 - outf.close()
50 - if f:
51 - f.close()
52 - else:
53 - if f:
54 - f.close()
55 - self.copy_file(script, outfile)
56 + if f:
57 + f.close()
58 + self.copy_file(script, outfile)
59
60 if os.name == 'posix':
61 for file in outfiles: