Revert "bpo-34977: Add Windows App Store package (GH-10245)" (GH-11019) · python/cpython@cb0b78a (original) (raw)
`@@ -64,11 +64,10 @@ def create(self, env_dir):
`
64
64
`self.system_site_packages = False
`
65
65
`self.create_configuration(context)
`
66
66
`self.setup_python(context)
`
67
``
`-
if not self.upgrade:
`
68
``
`-
self.setup_scripts(context)
`
69
67
`if self.with_pip:
`
70
68
`self._setup_pip(context)
`
71
69
`if not self.upgrade:
`
``
70
`+
self.setup_scripts(context)
`
72
71
`self.post_setup(context)
`
73
72
`if true_system_site_packages:
`
74
73
`# We had set it to False before, now
`
`@@ -159,6 +158,14 @@ def create_configuration(self, context):
`
159
158
`f.write('include-system-site-packages = %s\n' % incl)
`
160
159
`f.write('version = %d.%d.%d\n' % sys.version_info[:3])
`
161
160
``
``
161
`+
if os.name == 'nt':
`
``
162
`+
def include_binary(self, f):
`
``
163
`+
if f.endswith(('.pyd', '.dll')):
`
``
164
`+
result = True
`
``
165
`+
else:
`
``
166
`+
result = f.startswith('python') and f.endswith('.exe')
`
``
167
`+
return result
`
``
168
+
162
169
`def symlink_or_copy(self, src, dst, relative_symlinks_ok=False):
`
163
170
`"""
`
164
171
` Try symlinking a file, and if that fails, fall back to copying.
`
`@@ -188,9 +195,9 @@ def setup_python(self, context):
`
188
195
`binpath = context.bin_path
`
189
196
`path = context.env_exe
`
190
197
`copier = self.symlink_or_copy
`
``
198
`+
copier(context.executable, path)
`
191
199
`dirname = context.python_dir
`
192
200
`if os.name != 'nt':
`
193
``
`-
copier(context.executable, path)
`
194
201
`if not os.path.islink(path):
`
195
202
`os.chmod(path, 0o755)
`
196
203
`for suffix in ('python', 'python3'):
`
`@@ -202,22 +209,26 @@ def setup_python(self, context):
`
202
209
`if not os.path.islink(path):
`
203
210
`os.chmod(path, 0o755)
`
204
211
`else:
`
205
``
`-
For normal cases, the venvlauncher will be copied from
`
206
``
`-
our scripts folder. For builds, we need to copy it
`
207
``
`-
manually.
`
208
``
`-
if sysconfig.is_python_build(True):
`
209
``
`-
suffix = '.exe'
`
210
``
`-
if context.python_exe.lower().endswith('_d.exe'):
`
211
``
`-
suffix = '_d.exe'
`
212
``
-
213
``
`-
src = os.path.join(dirname, "venvlauncher" + suffix)
`
214
``
`-
dst = os.path.join(binpath, context.python_exe)
`
215
``
`-
copier(src, dst)
`
216
``
-
217
``
`-
src = os.path.join(dirname, "venvwlauncher" + suffix)
`
218
``
`-
dst = os.path.join(binpath, "pythonw" + suffix)
`
219
``
`-
copier(src, dst)
`
``
212
`+
See bpo-34011. When using a proper install, we should only need to
`
``
213
`+
copy the top-level of DLLs.
`
``
214
`+
include = self.include_binary
`
``
215
`+
files = [f for f in os.listdir(dirname) if include(f)]
`
``
216
`+
for f in files:
`
``
217
`+
src = os.path.join(dirname, f)
`
``
218
`+
dst = os.path.join(binpath, f)
`
``
219
`+
if dst != context.env_exe: # already done, above
`
``
220
`+
copier(src, dst)
`
220
221
``
``
222
`+
When creating from a build directory, we continue to copy all files.
`
``
223
`+
if sysconfig.is_python_build(True):
`
``
224
`+
subdir = 'DLLs'
`
``
225
`+
dirname = os.path.join(dirname, subdir)
`
``
226
`+
if os.path.isdir(dirname):
`
``
227
`+
files = [f for f in os.listdir(dirname) if include(f)]
`
``
228
`+
for f in files:
`
``
229
`+
src = os.path.join(dirname, f)
`
``
230
`+
dst = os.path.join(binpath, f)
`
``
231
`+
copier(src, dst)
`
221
232
`# copy init.tcl over
`
222
233
`for root, dirs, files in os.walk(context.python_dir):
`
223
234
`if 'init.tcl' in files:
`
`@@ -315,7 +326,7 @@ def install_scripts(self, context, path):
`
315
326
`dstfile = os.path.join(dstdir, f)
`
316
327
`with open(srcfile, 'rb') as f:
`
317
328
`data = f.read()
`
318
``
`-
if not srcfile.endswith(('.exe', '.pdb')):
`
``
329
`+
if not srcfile.endswith('.exe'):
`
319
330
`try:
`
320
331
`data = data.decode('utf-8')
`
321
332
`data = self.replace_variables(data, context)
`