diff options
Diffstat (limited to 'meta/recipes-devtools/python/python3/080-distutils-dont_adjust_files.patch')
| -rw-r--r-- | meta/recipes-devtools/python/python3/080-distutils-dont_adjust_files.patch | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/meta/recipes-devtools/python/python3/080-distutils-dont_adjust_files.patch b/meta/recipes-devtools/python/python3/080-distutils-dont_adjust_files.patch deleted file mode 100644 index b96419a638..0000000000 --- a/meta/recipes-devtools/python/python3/080-distutils-dont_adjust_files.patch +++ /dev/null | |||
| @@ -1,92 +0,0 @@ | |||
| 1 | do not "adjust" python files before copying | ||
| 2 | |||
| 3 | -Khem | ||
| 4 | |||
| 5 | Upstream-Status: Inappropriate [Embedded-Specific] | ||
| 6 | |||
| 7 | --- | ||
| 8 | Lib/distutils/command/build_scripts.py | 43 +++------------------------------ | ||
| 9 | 1 file changed, 4 insertions(+), 39 deletions(-) | ||
| 10 | |||
| 11 | --- a/Lib/distutils/command/build_scripts.py | ||
| 12 | +++ b/Lib/distutils/command/build_scripts.py | ||
| 13 | @@ -51,10 +51,7 @@ class build_scripts(Command): | ||
| 14 | |||
| 15 | |||
| 16 | def copy_scripts(self): | ||
| 17 | - """Copy each script listed in 'self.scripts'; if it's marked as a | ||
| 18 | - Python script in the Unix way (first line matches 'first_line_re', | ||
| 19 | - ie. starts with "\#!" and contains "python"), then adjust the first | ||
| 20 | - line to refer to the current Python interpreter as we copy. | ||
| 21 | + """Copy each script listed in 'self.scripts' | ||
| 22 | """ | ||
| 23 | self.mkpath(self.build_dir) | ||
| 24 | outfiles = [] | ||
| 25 | @@ -78,64 +75,10 @@ class build_scripts(Command): | ||
| 26 | if not self.dry_run: | ||
| 27 | raise | ||
| 28 | f = None | ||
| 29 | - else: | ||
| 30 | - encoding, lines = tokenize.detect_encoding(f.readline) | ||
| 31 | - f.seek(0) | ||
| 32 | - first_line = f.readline() | ||
| 33 | - if not first_line: | ||
| 34 | - self.warn("%s is an empty file (skipping)" % script) | ||
| 35 | - continue | ||
| 36 | - | ||
| 37 | - match = first_line_re.match(first_line) | ||
| 38 | - if match: | ||
| 39 | - adjust = True | ||
| 40 | - post_interp = match.group(1) or b'' | ||
| 41 | - | ||
| 42 | - if adjust: | ||
| 43 | - log.info("copying and adjusting %s -> %s", script, | ||
| 44 | - self.build_dir) | ||
| 45 | - updated_files.append(outfile) | ||
| 46 | - if not self.dry_run: | ||
| 47 | - if not sysconfig.python_build: | ||
| 48 | - executable = self.executable | ||
| 49 | - else: | ||
| 50 | - executable = os.path.join( | ||
| 51 | - sysconfig.get_config_var("BINDIR"), | ||
| 52 | - "python%s%s" % (sysconfig.get_config_var("VERSION"), | ||
| 53 | - sysconfig.get_config_var("EXE"))) | ||
| 54 | - executable = os.fsencode(executable) | ||
| 55 | - shebang = b"#!" + executable + post_interp + b"\n" | ||
| 56 | - # Python parser starts to read a script using UTF-8 until | ||
| 57 | - # it gets a #coding:xxx cookie. The shebang has to be the | ||
| 58 | - # first line of a file, the #coding:xxx cookie cannot be | ||
| 59 | - # written before. So the shebang has to be decodable from | ||
| 60 | - # UTF-8. | ||
| 61 | - try: | ||
| 62 | - shebang.decode('utf-8') | ||
| 63 | - except UnicodeDecodeError: | ||
| 64 | - raise ValueError( | ||
| 65 | - "The shebang ({!r}) is not decodable " | ||
| 66 | - "from utf-8".format(shebang)) | ||
| 67 | - # If the script is encoded to a custom encoding (use a | ||
| 68 | - # #coding:xxx cookie), the shebang has to be decodable from | ||
| 69 | - # the script encoding too. | ||
| 70 | - try: | ||
| 71 | - shebang.decode(encoding) | ||
| 72 | - except UnicodeDecodeError: | ||
| 73 | - raise ValueError( | ||
| 74 | - "The shebang ({!r}) is not decodable " | ||
| 75 | - "from the script encoding ({})" | ||
| 76 | - .format(shebang, encoding)) | ||
| 77 | - with open(outfile, "wb") as outf: | ||
| 78 | - outf.write(shebang) | ||
| 79 | - outf.writelines(f.readlines()) | ||
| 80 | - if f: | ||
| 81 | - f.close() | ||
| 82 | - else: | ||
| 83 | - if f: | ||
| 84 | + if f: | ||
| 85 | f.close() | ||
| 86 | - updated_files.append(outfile) | ||
| 87 | - self.copy_file(script, outfile) | ||
| 88 | + updated_files.append(outfile) | ||
| 89 | + self.copy_file(script, outfile) | ||
| 90 | |||
| 91 | if os.name == 'posix': | ||
| 92 | for file in outfiles: | ||
