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