|
5 | 5 | import os
|
6 | 6 | import re
|
7 | 7 | import tokenize
|
8 |
| -from distutils import sysconfig |
9 | 8 | from distutils._log import log
|
10 | 9 | from stat import ST_MODE
|
11 | 10 | from typing import ClassVar
|
@@ -76,7 +75,7 @@ def copy_scripts(self):
|
76 | 75 |
|
77 | 76 | return outfiles, updated_files
|
78 | 77 |
|
79 |
| - def _copy_script(self, script, outfiles, updated_files): # noqa: C901 |
| 78 | + def _copy_script(self, script, outfiles, updated_files): |
80 | 79 | shebang_match = None
|
81 | 80 | script = convert_path(script)
|
82 | 81 | outfile = os.path.join(self.build_dir, os.path.basename(script))
|
@@ -106,18 +105,8 @@ def _copy_script(self, script, outfiles, updated_files): # noqa: C901
|
106 | 105 | if shebang_match:
|
107 | 106 | log.info("copying and adjusting %s -> %s", script, self.build_dir)
|
108 | 107 | if not self.dry_run:
|
109 |
| - if not sysconfig.python_build: |
110 |
| - executable = self.executable |
111 |
| - else: |
112 |
| - executable = os.path.join( |
113 |
| - sysconfig.get_config_var("BINDIR"), |
114 |
| - "python{}{}".format( |
115 |
| - sysconfig.get_config_var("VERSION"), |
116 |
| - sysconfig.get_config_var("EXE"), |
117 |
| - ), |
118 |
| - ) |
119 | 108 | post_interp = shebang_match.group(1) or ''
|
120 |
| - shebang = "#!" + executable + post_interp + "\n" |
| 109 | + shebang = f"#!python{post_interp}\n" |
121 | 110 | self._validate_shebang(shebang, f.encoding)
|
122 | 111 | with open(outfile, "w", encoding=f.encoding) as outf:
|
123 | 112 | outf.write(shebang)
|
|
0 commit comments