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